-
Notifications
You must be signed in to change notification settings - Fork 153
165 lines (146 loc) · 4.55 KB
/
ci.yaml
File metadata and controls
165 lines (146 loc) · 4.55 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: CI check
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:
types: [checks_requested]
workflow_dispatch:
defaults:
run:
shell: bash
permissions:
contents: read
packages: read
jobs:
changes:
runs-on: ubuntu-24.04
if: ${{ !github.event.pull_request.draft }}
outputs:
python: ${{ steps.filter.outputs.python }}
go: ${{ steps.filter.outputs.go }}
docs: ${{ steps.filter.outputs.docs }}
lint: ${{ steps.filter.outputs.lint }}
image: ${{ steps.image.outputs.tag }}
steps:
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
- name: Set build env image tag
id: image
run: |
ref="${{ github.event.merge_group.base_ref || github.base_ref || github.ref_name }}"
echo "tag=${ref#refs/heads/}" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@61f87a10cd2c304679af17bb73ef192addf33c1c
id: filter
with:
filters: |
lint:
- 'src/**/*.py'
- 'pyproject.toml'
- 'tox.ini'
- 'setup.py'
- 'openapi.yaml'
- 'Makefile'
- 'utilities/**'
- 'src/**/*.go'
- 'src/**/go.mod'
- 'src/**/go.sum'
- 'src/**/Makefile'
- 'snap/local/tree/usr/bin/*'
python:
- 'src/**/*.py'
- 'utilities/generate_builders.py'
- 'utilities/run-py-tests-ci'
- 'pyproject.toml'
- 'tox.ini'
go:
- 'src/**/*.go'
- 'src/**/go.mod'
- 'src/**/go.sum'
docs:
- 'docs/**'
- 'src/**/*.py'
- 'utilities/run-py-tests-ci'
- 'pyproject.toml'
- 'tox.ini'
- 'required-packages/base'
- 'snap/snapcraft.yaml'
lint:
runs-on: ubuntu-24.04
needs: changes
if: >-
${{ !github.event.pull_request.draft && needs.changes.outputs.lint == 'true' }}
container:
image: ghcr.io/${{ github.repository }}-build-env:${{ needs.changes.outputs.image }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
- uses: ./.github/actions/ci-setup
- name: Run lint
run: |
su ubuntu -c "make lint"
test-python:
needs: changes
runs-on: ubuntu-24.04
if: >-
${{ !github.event.pull_request.draft && needs.changes.outputs.python == 'true' }}
container:
image: ghcr.io/${{ github.repository }}-build-env:${{ needs.changes.outputs.image }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
- uses: ./.github/actions/ci-setup
- name: Test
run: |
CACHE_DIR=/home/ubuntu/.cache/pip
su ubuntu -c "PIP_CACHE_DIR=$CACHE_DIR make test-py"
test-go:
needs: changes
runs-on: ubuntu-24.04
if: >-
${{ !github.event.pull_request.draft && needs.changes.outputs.go == 'true' }}
container:
image: ghcr.io/${{ github.repository }}-build-env:${{ needs.changes.outputs.image }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
- uses: ./.github/actions/ci-setup
- name: Test
run: |
su ubuntu -c "make test-go"
test-docs:
needs: changes
runs-on: ubuntu-24.04
if: >-
${{ !github.event.pull_request.draft && needs.changes.outputs.docs == 'true' }}
steps:
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
with:
fetch-depth: 0
- name: Create venv
working-directory: "docs"
run: make install
- name: Lint markdown
working-directory: "docs"
run: make lint-md
- name: Test build
working-directory: "docs"
run: make html
- name: Run scripts tests
working-directory: "docs"
run: |
source .sphinx/venv/bin/activate
pip install -r requirements-dev.txt
cd _scripts && python -m pytest .
ci-check:
runs-on: ubuntu-slim
if: always()
needs: [lint, test-python, test-go, test-docs]
steps:
- name: Check job results
if: contains(needs.*.result, 'failure')
run: exit 1