-
Notifications
You must be signed in to change notification settings - Fork 12
142 lines (135 loc) · 3.79 KB
/
check.yaml
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Tests
on:
workflow_call:
workflow_dispatch:
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ master, main ]
paths-ignore:
- '**.md'
- '**.rst'
concurrency:
# We do not want to run multiple jobs for single PR.
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run lint checkers
run: tox -e lint
unit:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run unit tests
run: tox -e unit
mocked-plans:
name: Mocked plans
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run mocked-plans tests
run: tox -e mocked-plans
snap-build:
name: Build snap
needs:
- lint
- unit
- mocked-plans
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0 # Complete git history is required to generate the version from git tags.
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Setup LXD
uses: canonical/[email protected]
with:
channel: latest/stable
- name: Install snapcraft
run: sudo snap install snapcraft --classic
- name: Build snap
run: snapcraft --use-lxd
- name: Determine system architecture
run: echo "SYSTEM_ARCH=$(uname -m)" >> $GITHUB_ENV
- name: Upload the built snap as an artifact
uses: actions/upload-artifact@v4
with:
name: snap_${{ env.SYSTEM_ARCH }}
path: charmed-openstack-upgrader_*.snap
func:
name: Functional tests
needs: snap-build
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Setup Juju 3.4/stable environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
juju-channel: 3.4/stable
- name: Remove tox install by actions-operator
run: sudo apt remove tox -y
- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Determine system architecture
run: echo "SYSTEM_ARCH=$(uname -m)" >> $GITHUB_ENV
- name: Download snap file artifact
uses: actions/download-artifact@v4
with:
name: snap_${{ env.SYSTEM_ARCH }}
- name: Run func tests
run: |
export TEST_SNAP="$(pwd)/$(ls | grep '.*charmed-openstack-upgrader_.*\.snap$')"
echo "$TEST_SNAP"
tox -e func