Repository navigation
73 lines (59 loc) · 2.73 KB
/
Copy pathci.yml
File metadata and controls
73 lines (59 loc) · 2.73 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
name: CI
on:
push:
branches: [main, master]
pull_request:
permissions:
contents: read
jobs:
build:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.0.0
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.0.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install package with dev dependencies
run: pip install -e ".[dev]"
# src/polytypo/_data/ is generated from vendor/polytypo-spec/ and is gitignored (never
# committed, never hand-edited) -- must run before anything that imports polytypo or builds
# a distribution, in every job that does either.
- name: Generate locale/rule data
run: python scripts/gen_data.py
- name: Lint (ruff check)
run: ruff check .
- name: Format check (ruff format)
run: ruff format --check .
- name: Type-check (mypy --strict)
run: mypy src
- name: Test
run: pytest tests -q --ignore=tests/packaging
- name: Build sdist and wheel
run: python -m build
# Installs the actual built wheel into a scratch venv and exercises every public entry
# point from there -- source-tree imports (PYTHONPATH=src, used by every other test) cannot
# catch a packaging defect like a missing py.typed marker or a file excluded from the wheel.
- name: Packaging smoke test
run: pytest tests/packaging -q
vendored-spec:
name: Vendored spec matches canonical
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.0.0
# The vendored spec subset in this repository is a manually synced copy of canonical
# polytypo's spec/. Its data half stays current because the test suite fails without it;
# nothing checked its rules/*.md half, and four published packages shipped rule
# documentation that contradicted their own engine (polytypo/polytypo#56). This compares
# every vendored file against canonical at the tag the vendored VERSION names, so a stale
# copy — or a released spec amended in place — fails here rather than reaching a package.
# Completeness is checked against canonical's own tree, so a deleted vendored file fails
# too, and a tree current with the tag it claims while canonical has tagged a newer
# version is a warning here and a refusal in the release job.
- name: Compare against canonical spec tag
run: sh scripts/check-vendored-spec.sh vendor/polytypo-spec