-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (97 loc) · 3.15 KB
/
Copy pathci.yml
File metadata and controls
119 lines (97 loc) · 3.15 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
name: CI
on:
push:
branches: [main]
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
test:
name: lint + mypy + pytest (py${{ matrix.python }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python ${{ matrix.python }}
run: uv python install ${{ matrix.python }}
- name: Sync dependencies
run: uv sync --frozen --python ${{ matrix.python }}
- name: Ruff (lint)
run: uv run ruff check src/ tests/
- name: Ruff (format)
run: uv run ruff format --check src/ tests/
- name: Mypy (--strict)
run: uv run mypy src/ tests/
- name: Pytest
run: uv run pytest -v
build:
name: build wheel + sdist
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Sync dependencies
run: uv sync --frozen
- name: Fetch openapi.yaml
run: curl -fsSL https://raw.githubusercontent.com/QTSurfer/qtsurfer.github.io/main/openapi.yaml -o openapi.yaml
- name: Verify pyproject.toml version matches openapi.yaml
run: |
PYPROJECT_VERSION=$(uv run python -c "import tomllib; print(tomllib.loads(open('pyproject.toml','rb').read().decode())['project']['version'])")
SPEC_VERSION=$(uv run python -c "import yaml; print(yaml.safe_load(open('openapi.yaml'))['info']['version'])")
echo "pyproject: $PYPROJECT_VERSION"
echo "openapi: $SPEC_VERSION"
if [ "$PYPROJECT_VERSION" != "$SPEC_VERSION" ]; then
echo "::error::pyproject.toml version ($PYPROJECT_VERSION) does not match openapi.yaml info.version ($SPEC_VERSION). Run scripts/regenerate.sh."
exit 1
fi
- name: Build
run: uv run python -m build
- name: Twine check
run: uv run twine check dist/*
- name: Upload artefacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
docs:
name: publish pdoc to GitHub Pages
runs-on: ubuntu-latest
needs: test
# Only tagged versions get published, so the site always describes a release
# rather than whatever main happens to be.
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Sync dependencies
run: uv sync --frozen
- name: Generate docs
run: ./scripts/docs.sh
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: docs
- id: deploy
uses: actions/deploy-pages@v4