-
Notifications
You must be signed in to change notification settings - Fork 134
120 lines (100 loc) · 2.58 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
119
120
name: Tests
on:
- push
- pull_request
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-24.04
steps:
- name: Repository checkout
uses: actions/checkout@v4
- name: Lint shell files
uses: ludeeus/action-shellcheck@master
- name: Install dependencies
run: |
python3 -m venv venv
. ./venv/bin/activate
./venv/bin/pip install --require-virtualenv --upgrade pip tox
- name: Lint Python files
run: |
. ./venv/bin/activate
tox -e lint
- name: Typecheck Python files
run: |
. ./venv/bin/activate
tox -e check
unit-tests:
name: Unit tests
runs-on: ubuntu-24.04
steps:
- name: Repository checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
python3 -m venv venv
. ./venv/bin/activate
./venv/bin/pip install --require-virtualenv --upgrade pip tox
- name: Run unit tests
run: |
. ./venv/bin/activate
tox -e unit
tests:
name: Tests
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.10", "3.12"]
track: ["latest/edge", "5.21/edge", "5.0/edge"]
os: ["24.04"]
include:
# 4.0/* isn't supported on 24.04
- python-version: "3.8"
track: "4.0/edge"
os: "22.04"
runs-on: ubuntu-${{ matrix.os }}
steps:
- name: Repository checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup LXD
uses: canonical/setup-lxd@main
with:
channel: ${{ matrix.track }}
- name: Install dependencies
run: |
set -x
python3 -m venv venv
. ./venv/bin/activate
./venv/bin/pip install --require-virtualenv --upgrade pip tox codecov
- name: Coverage
run: |
. ./venv/bin/activate
tox -e coverage
codecov
- name: Integration
run: |
. ./venv/bin/activate
integration/run-integration-tests
publish:
name: Publish
runs-on: ubuntu-22.04
if: startsWith(github.event.ref, 'refs/tags')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Release ${{ github.ref }}
generateReleaseNotes: true