| 1 |
# Lint and test on every push/PR. Also callable from deploy.yml |
| 2 |
# (workflow_call) so a release can't publish untested code. |
| 3 |
|
| 4 |
name: CI |
| 5 |
|
| 6 |
on: |
| 7 |
push: |
| 8 |
# PR branches are covered by the pull_request trigger; listing them |
| 9 |
# here too would run every pipeline twice per push. |
| 10 |
branches: [develop, master] |
| 11 |
pull_request: |
| 12 |
workflow_call: |
| 13 |
|
| 14 |
permissions: |
| 15 |
contents: read |
| 16 |
|
| 17 |
# A force-push or rapid successive pushes should replace the running |
| 18 |
# pipeline, not queue behind it. |
| 19 |
concurrency: |
| 20 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 21 |
cancel-in-progress: true |
| 22 |
|
| 23 |
jobs: |
| 24 |
lint: |
| 25 |
runs-on: ubuntu-latest |
| 26 |
timeout-minutes: 10 |
| 27 |
steps: |
| 28 |
- uses: actions/checkout@v4 |
| 29 |
- uses: actions/setup-python@v5 |
| 30 |
with: |
| 31 |
python-version: "3.13" |
| 32 |
# Run the same hooks as local pre-commit (black, ruff, ruff-format, |
| 33 |
# codespell, prettier, mypy) so CI can't disagree with them. |
| 34 |
- uses: pre-commit/[email protected] |
| 35 |
test: |
| 36 |
needs: |
| 37 |
- lint |
| 38 |
runs-on: ubuntu-latest |
| 39 |
timeout-minutes: 10 |
| 40 |
strategy: |
| 41 |
matrix: |
| 42 |
python-version: ["3.11", "3.12", "3.13", "3.14"] |
| 43 |
|
| 44 |
steps: |
| 45 |
- uses: actions/checkout@v4 |
| 46 |
# Poetry must be on PATH before setup-python so its cache: poetry |
| 47 |
# integration can resolve the environment from poetry.lock. |
| 48 |
- uses: snok/install-poetry@v1 |
| 49 |
- name: Set up Python ${{ matrix.python-version }} |
| 50 |
uses: actions/setup-python@v5 |
| 51 |
with: |
| 52 |
python-version: ${{ matrix.python-version }} |
| 53 |
cache: poetry |
| 54 |
- name: Install dependencies |
| 55 |
run: | |
| 56 |
poetry install --no-interaction --no-root |
| 57 |
- name: Test with pytest |
| 58 |
run: | |
| 59 |
poetry run pytest |