Repository navigation
138 lines (108 loc) · 3.74 KB
/
Copy pathpython-checks.yml
File metadata and controls
138 lines (108 loc) · 3.74 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
name: Python checks
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- R26.2-PRE
- R26.3
permissions:
contents: read
jobs:
clipy-test:
name: Ensure cli.py is up to date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.11'
cache: 'pip'
- name: Install tox
run: pip install tox tox-uv
- name: Checking cli.py status
run: |
tox run -e generate
changes="$(git diff simplyblock_cli/cli.py)"
if [[ "${changes}" ]]; then
echo "cli.py has changed after regeneration. Stopping."
echo "${changes}"
exit 1
fi
env-var:
name: Deployment image pins
runs-on: ubuntu-latest
# env_var pins the images built from the branch it sits on, so its tags can
# only be checked on the long-lived branches. Keep in sync with the push
# trigger above.
if: contains(fromJSON('["main", "R26.2-PRE"]'), github.base_ref || github.ref_name)
steps:
- uses: actions/checkout@v7
# A test image pinned here ships to everyone deploying from this branch, and
# is regularly forgotten in a merge. Only the tag is checked: the registry
# has legitimately differed per branch.
- name: Checking env_var image pins
env:
BRANCH: ${{ github.base_ref || github.ref_name }}
run: |
docker_image="$(sed -n 's|^SIMPLY_BLOCK_DOCKER_IMAGE=||p' simplyblock_core/env_var)"
ultra_image="$(sed -n 's|^SIMPLY_BLOCK_SPDK_ULTRA_IMAGE=||p' simplyblock_core/env_var)"
status=0
if [[ "${docker_image}" != */*:"${BRANCH}" ]]; then
echo "::error file=simplyblock_core/env_var::SIMPLY_BLOCK_DOCKER_IMAGE is ${docker_image:-unset}, expected an image tagged ${BRANCH}. Revert the test pin before merging."
status=1
fi
if [[ "${ultra_image}" != */*:"${BRANCH}" && "${ultra_image}" != */*:"${BRANCH}-latest" ]]; then
echo "::error file=simplyblock_core/env_var::SIMPLY_BLOCK_SPDK_ULTRA_IMAGE is ${ultra_image:-unset}, expected an image tagged ${BRANCH} or ${BRANCH}-latest. Revert the test pin before merging."
status=1
fi
exit "${status}"
lock:
name: Lockfile up to date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install uv
run: pip install uv
# Fails if uv.lock no longer matches pyproject.toml. The image build uses
# `uv sync --locked`, so a stale lock breaks the build rather than silently
# resolving something new -- this reports it on the PR instead.
- name: Check uv.lock
run: uv lock --check
lint:
name: Linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.11'
cache: 'pip'
- name: Install linter
run: pip install 'ruff>=0.17'
- name: Execute linter
run: ruff check
# ruff's target version comes from requires-python (>=3.11); this asserts the
# sources also parse on the interpreter the image actually runs.
- name: Check sources parse on the image interpreter
run: |
pip install uv
uv run --python 3.14t --no-project -- \
python -m compileall -q simplyblock_core simplyblock_web simplyblock_cli
types:
name: Type checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.11'
cache: 'pip'
- name: Install tox
run: pip install tox tox-uv
- name: Execute type checker
run: tox run -e types