-
Notifications
You must be signed in to change notification settings - Fork 64
118 lines (112 loc) · 3.29 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Test Suite
on:
pull_request:
branches: [ master ]
jobs:
unit:
name: Unit tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.8' # focal
- '3.10' # jammy
- '3.12' # noble
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Tox
run: pip install tox
- name: Run tests
run: tox -e py
build:
name: Build snap
needs: unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Add fake tag to make vergit happy
run: git tag v0.0.0
- uses: snapcore/action-build@v1
id: snap-build
- uses: actions/upload-artifact@v1
with:
name: charm-snap
path: ${{ steps.snap-build.outputs.snap }}
integration:
name: Integration test
needs: build
runs-on: ubuntu-latest
steps:
- name: Init LXD
run: |
set -euxo pipefail
sudo lxd init --auto
# This is a throw-away CI environment, do not do this at home
sudo chmod 666 /var/snap/lxd/common/lxd/unix.socket
# Fixup iptables forwarding issues from LXD containers with a flush and
# re-create of rules.
sudo iptables -F FORWARD
sudo iptables -P FORWARD ACCEPT
- name: Checkout layer-basic
uses: actions/checkout@v2
with:
repository: juju-solutions/layer-basic
- name: Download built charm snap
uses: actions/download-artifact@v3
with:
name: charm-snap
path: tests/charm-minimal/charm-snap
- name: Build reactive charm with charmcraft
run: |
set -euxo pipefail
sudo snap install --classic --channel latest/edge charmcraft
cat << EOF | tee tests/charm-minimal/charmcraft.yaml
type: charm
parts:
charm-tools:
plugin: nil
override-build: |
snap install --dangerous --classic \$CRAFT_PROJECT_DIR/parts/charm/src/charm-snap/*.snap
rm -rf \$CRAFT_PROJECT_DIR/parts/charm/src/charm-snap
charm:
after: [charm-tools]
source: .
plugin: reactive
reactive-charm-build-arguments:
- -v
- --binary-wheels-from-source
- --upgrade-buildvenv-core-deps
build-packages:
- python3-dev
- libpq-dev
bases:
- name: ubuntu
channel: "18.04"
architectures: [amd64]
- name: ubuntu
channel: "20.04"
architectures: [amd64]
- name: ubuntu
channel: "22.04"
architectures: [amd64]
EOF
charmcraft pack -p tests/charm-minimal -v
- name: Upload charmcraft execution logs
if: always()
uses: actions/upload-artifact@v3
with:
name: charmcraft execution logs
path: ~/snap/charmcraft/common/cache/charmcraft/log/*.log
- name: Upload built charms
uses: actions/upload-artifact@v3
with:
name: Built charms
path: |
minimal_ubuntu-18.04-amd64.charm
minimal_ubuntu-20.04-amd64.charm
minimal_ubuntu-22.04-amd64.charm