-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (86 loc) · 2.2 KB
/
build-and-test.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
name: Build/Test
on:
workflow_call:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: python3 -m pip install tox
- name: Run linters
run: tox -e pep8
unit-test:
name: Unit tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get -qq install libxslt-dev libxml2-dev python3-lxml
python3 -m pip install tox
- name: Run tests
run: tox -e py3
build:
name: Build the charm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup LXD
uses: canonical/setup-lxd@v0.1.1
with:
channel: 5.20/stable
- name: Install dependencies
run: python3 -m pip install tox
- name: Build charm(s)
id: builder
run: |
sudo snap install charmcraft --classic
tox -e build
- name: Upload built charm
uses: actions/upload-artifact@v3
with:
name: charms
path: "*.charm"
functional-test:
needs:
- lint
- unit-test
- build
name: Functional tests
runs-on: self-hosted
steps:
- name: Download charm
uses: actions/download-artifact@v3
with:
name: charms
path: ~/artifacts/
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup LXD
uses: canonical/setup-lxd@v0.1.1
with:
# pin lxd to LTS release.
channel: 5.21/stable
- name: Install dependencies
run: |
python3 -m pip install tox
if [ ! -d "$HOME/.local/share/juju" ]; then
sudo snap install juju
mkdir -p ~/.local/share/juju
juju bootstrap localhost localhost
fi
- name: Run focal-ussuri tests
run: |
date
mv ~/artifacts/ceph-fs.charm ./
tox -c src -e func-target -- focal-ussuri