Repository navigation
66 lines (62 loc) · 2.17 KB
/
Copy pathpython.yml
File metadata and controls
66 lines (62 loc) · 2.17 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
name: python
on:
push:
branches: [main]
pull_request:
paths:
- "python/**"
- "spec/**"
- ".github/workflows/python.yml"
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python }}
enable-cache: true
cache-dependency-glob: python/uv.lock
- run: uv sync --locked
- name: Data codegen is up to date
run: uv run python scripts/gen_data.py --check
- run: uv run ruff check .
- run: uv run ruff format --check .
- run: uv run mypy --strict src
- run: uv run pytest
# Build the sdist + wheel, then run every fixture against the installed wheel (not the source tree)
# in a clean venv, so packaging mistakes (missing modules, data) fail here rather than on PyPI.
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
enable-cache: true
cache-dependency-glob: python/uv.lock
- run: uv build
- run: uvx twine check dist/*
- name: Install the wheel into a clean venv
run: |
uv venv "$RUNNER_TEMP/wheel-venv" --python 3.12
uv pip install --python "$RUNNER_TEMP/wheel-venv/bin/python" dist/*.whl
- name: Smoke import and conformance against the installed wheel
run: |
py="$RUNNER_TEMP/wheel-venv/bin/python"
# Run from outside the source tree so `import trackparse` can only resolve to the wheel.
cd "$RUNNER_TEMP"
"$py" -c "import trackparse, sys; print(trackparse.__version__, trackparse.SPEC_VERSION, trackparse.__file__); assert 'site-packages' in trackparse.__file__; print(trackparse.parse('Artist - Title (Remix Artist Remix)').to_dict())"
"$py" "$GITHUB_WORKSPACE/python/scripts/conformance.py" --strict