Repository navigation
72 lines (68 loc) · 2.33 KB
/
Copy pathci.yml
File metadata and controls
72 lines (68 loc) · 2.33 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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: ruff format --check
run: ruff format --check src tests scripts ci examples
- name: ruff check
run: ruff check src tests scripts ci examples
- name: ty check
run: ty check src
- name: SPDX headers
run: python3 ci/check_headers.py
- name: pytest
run: pytest -v --tb=short
# Build the artefact that ships and test that, not the checkout. The src/ layout
# means the checkout cannot shadow the installed wheel.
build-and-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Build wheel and sdist
run: |
python -m pip install --upgrade pip build
python -m build
- name: Check licence files ship in the wheel
run: |
python - <<'EOF'
import pathlib, zipfile
wheel = next(pathlib.Path("dist").glob("*.whl"))
names = zipfile.ZipFile(wheel).namelist()
for required in ("LICENSE", "THIRD_PARTY_NOTICES.md"):
assert any(n.endswith("/" + required) for n in names), f"{required} missing from {wheel}"
print(f"{wheel}: licence files present")
EOF
- name: Install the wheel and run the suite against it
run: |
pip install dist/*.whl fastapi pydantic pytest httpx jsonschema typesafe-sdk==0.7.5
pytest -q
# Secret scanning over the full history (all refs), the same check the
# pre-commit gitleaks hook runs on staged files.
secrets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install gitleaks 8.30.1
run: |
curl -sSfL https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz \
| sudo tar -xz -C /usr/local/bin gitleaks
- name: gitleaks over all refs
run: gitleaks git --log-opts="--all" --no-banner --redact