-
Notifications
You must be signed in to change notification settings - Fork 8
139 lines (117 loc) · 3.47 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
name: Tests
on:
workflow_call:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
paths-ignore:
- "**.md"
- "**.rst"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Complete git history is required to generate the version from git tags.
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y yamllint
python -m pip install --upgrade pip
# pin tox to the current major version to avoid
# workflows breaking all at once when a new major version is released.
python -m pip install 'tox<5'
- name: Run linters
run: tox -e lint
- name: Lint yaml files
run: |
yamllint .yamllint snap/snapcraft.yaml
unit:
name: Unit
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.10"]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install 'tox<5'
- name: Run unit tests
run: tox -e unit
build:
needs:
- lint
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [[ubuntu-22.04]]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Complete git history is required to generate the version from git tags.
- name: Verify snap builds successfully
id: build
uses: canonical/action-build@v1
- name: Determine system architecture
run: echo "SYSTEM_ARCH=$(uname -m)" >> $GITHUB_ENV
- name: Upload the built snap
uses: actions/upload-artifact@v4
with:
name: snap_${{ env.SYSTEM_ARCH }}
path: ${{ steps.build.outputs.snap }}
func:
needs:
- build
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [[ubuntu-22.04]]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Complete git history is required to generate the version from git tags.
- 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: 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<5'
- name: Setup Juju environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: "lxd"
juju-channel: "3.5/stable"
charmcraft-channel: "3.x/stable"
- name: Run func tests
run: |
export TEST_SNAP="$(pwd)/$(ls | grep '.*_.*\.snap$')"
echo "$TEST_SNAP"
tox -e func