| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main |
| 7 |
pull_request: |
| 8 |
|
| 9 |
concurrency: |
| 10 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 11 |
cancel-in-progress: true |
| 12 |
|
| 13 |
jobs: |
| 14 |
pre-commit: |
| 15 |
runs-on: ubuntu-latest |
| 16 |
steps: |
| 17 |
- uses: actions/checkout@v7 |
| 18 |
- uses: j178/[email protected] |
| 19 |
|
| 20 |
tests: |
| 21 |
name: Python ${{ matrix.python-version }} |
| 22 |
runs-on: ubuntu-24.04 |
| 23 |
|
| 24 |
services: |
| 25 |
postgres: |
| 26 |
image: postgres:16 |
| 27 |
env: |
| 28 |
POSTGRES_DB: postgres |
| 29 |
POSTGRES_USER: postgres |
| 30 |
POSTGRES_PASSWORD: postgres |
| 31 |
ports: |
| 32 |
- 5432:5432 |
| 33 |
options: >- |
| 34 |
--health-cmd pg_isready |
| 35 |
--health-interval 10s |
| 36 |
--health-timeout 5s |
| 37 |
--health-retries 5 |
| 38 |
|
| 39 |
strategy: |
| 40 |
matrix: |
| 41 |
python-version: |
| 42 |
- '3.10' |
| 43 |
- '3.11' |
| 44 |
- '3.12' |
| 45 |
- '3.13' |
| 46 |
- '3.14' |
| 47 |
|
| 48 |
env: |
| 49 |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres |
| 50 |
|
| 51 |
steps: |
| 52 |
- uses: actions/checkout@v7 |
| 53 |
|
| 54 |
- uses: actions/[email protected] |
| 55 |
with: |
| 56 |
python-version: ${{ matrix.python-version }} |
| 57 |
allow-prereleases: true |
| 58 |
cache: 'pip' |
| 59 |
|
| 60 |
- name: Upgrade packaging tools |
| 61 |
run: python -m pip install --upgrade pip setuptools virtualenv wheel |
| 62 |
|
| 63 |
- name: Install dependencies |
| 64 |
run: python -m pip install --upgrade tox |
| 65 |
|
| 66 |
- name: Run tox targets for ${{ matrix.python-version }} |
| 67 |
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d . | cut -f 1 -d '-') |
| 68 |
|
| 69 |
- name: Run extra tox targets |
| 70 |
if: ${{ matrix.python-version == '3.13' }} |
| 71 |
run: | |
| 72 |
tox -e base,dist,docs |
| 73 |
|
| 74 |
- name: Upload coverage |
| 75 |
uses: codecov/[email protected] |
| 76 |
with: |
| 77 |
env_vars: TOXENV,DJANGO |
| 78 |
|
| 79 |
test-docs: |
| 80 |
name: Test documentation links |
| 81 |
runs-on: ubuntu-24.04 |
| 82 |
steps: |
| 83 |
- uses: actions/checkout@v7 |
| 84 |
|
| 85 |
- uses: actions/[email protected] |
| 86 |
with: |
| 87 |
python-version: '3.13' |
| 88 |
|
| 89 |
- name: Install dependencies |
| 90 |
run: pip install --group docs |
| 91 |
|
| 92 |
# Start mkdocs server and wait for it to be ready |
| 93 |
- run: mkdocs serve & |
| 94 |
- run: WAIT_TIME=0 && until nc -vzw 2 localhost 8000 || [ $WAIT_TIME -eq 5 ]; do sleep $(( WAIT_TIME++ )); done |
| 95 |
- run: if [ $WAIT_TIME == 5 ]; then echo cannot start mkdocs server on http://localhost:8000; exit 1; fi |
| 96 |
|
| 97 |
- name: Check links |
| 98 |
run: pylinkvalidate.py -P http://localhost:8000/ |
| 99 |
|
| 100 |
- run: echo "Done" |