-
Notifications
You must be signed in to change notification settings - Fork 0
182 lines (170 loc) · 5.43 KB
/
Copy pathci.yml
File metadata and controls
182 lines (170 loc) · 5.43 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: ci
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch: {}
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
lint:
name: lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: python -m pip install --upgrade pip
- run: pip install -e ".[dev]"
- run: ruff check src tests
- run: ruff format --check src tests
typecheck:
name: typecheck (mypy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: python -m pip install --upgrade pip
- run: pip install -e ".[dev,server,fhe]"
- run: mypy
bandit:
name: bandit (static security)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: python -m pip install --upgrade pip
- run: pip install -e ".[dev]"
- run: bandit -r src -c pyproject.toml --severity-level medium
release-gate:
name: release-gate (fresh-clone verify)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: python -m pip install --upgrade pip
- run: pip install -e ".[dev]"
- run: |
python -m py_compile src/regaudit_fhe/*.py \
src/regaudit_fhe/fhe/*.py \
tests/*.py
- run: python -c "import regaudit_fhe; print(regaudit_fhe.__version__)"
- run: regaudit-fhe --help
- run: regaudit-fhe schema --list
- run: pytest -q
test:
name: tests (${{ matrix.os }}, py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
exclude:
# Trim macOS to two interpreters to keep CI minutes bounded —
# full Python matrix runs on Linux.
- { os: macos-latest, python-version: "3.10" }
- { os: macos-latest, python-version: "3.11" }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- run: python -m pip install --upgrade pip
- run: pip install -e ".[dev,server,fhe]"
- run: pytest tests/ -q --cov=regaudit_fhe --cov-report=term-missing --cov-fail-under=80
benchmark:
name: benchmarks (smoke, py3.12)
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: python -m pip install --upgrade pip
- run: pip install -e ".[dev,fhe]"
- run: python benchmarks/bench_fhe.py --rings 14 --reps 1 --flip-trials 5
audit:
name: pip-audit
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: python -m pip install --upgrade pip pip-audit
- run: pip install -e ".[dev,server,fhe]"
- run: pip-audit --strict --vulnerability-service osv
reproducible-build:
name: reproducible build (wheel SHA stable)
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: python -m pip install --upgrade pip build
- name: Pin SOURCE_DATE_EPOCH to last commit timestamp
run: |
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> "$GITHUB_ENV"
- name: First wheel build
run: |
python -m build --wheel --outdir dist1
(cd dist1 && sha256sum *.whl | sort > ../WHEEL_SHA256.1)
- name: Second wheel build
run: |
python -m build --wheel --outdir dist2
(cd dist2 && sha256sum *.whl | sort > ../WHEEL_SHA256.2)
- name: Compare wheel digests
run: |
if ! diff -u WHEEL_SHA256.1 WHEEL_SHA256.2; then
echo "::error::Reproducible-build check failed: wheel digest "\
"differs across two builds at the same commit." >&2
exit 1
fi
echo "Wheel-reproducibility check passed:"; cat WHEEL_SHA256.1
- uses: actions/upload-artifact@v4
with:
name: reproducible-build-digests
path: |
WHEEL_SHA256.1
WHEEL_SHA256.2
sbom:
name: sbom (cyclonedx)
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: python -m pip install --upgrade pip cyclonedx-bom
- run: pip install -e ".[server,fhe]"
- run: cyclonedx-py environment --output-format JSON --output-file sbom.cdx.json
- uses: actions/upload-artifact@v4
with:
name: sbom
path: sbom.cdx.json