|
| 1 | +name: checks |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: {} |
| 5 | + |
| 6 | +jobs: |
| 7 | + lint: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v6 |
| 11 | + - uses: extractions/setup-just@v4 |
| 12 | + - uses: astral-sh/setup-uv@v8.2.0 |
| 13 | + with: |
| 14 | + enable-cache: true |
| 15 | + cache-dependency-glob: "**/pyproject.toml" |
| 16 | + - run: uv python install 3.11 |
| 17 | + - run: uv python pin 3.11 |
| 18 | + - run: just install lint-ci |
| 19 | + |
| 20 | + links: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v6 |
| 24 | + - name: Check local links |
| 25 | + uses: lycheeverse/lychee-action@v2 |
| 26 | + with: |
| 27 | + args: >- |
| 28 | + --offline |
| 29 | + --no-progress |
| 30 | + --remap |
| 31 | + 'https://github\.com/${{ github.repository }}/(?:blob|tree)/main/(.*) file://${{ github.workspace }}/$1' |
| 32 | + '**/*.md' |
| 33 | +
|
| 34 | + pytest: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + strategy: |
| 37 | + fail-fast: false |
| 38 | + matrix: |
| 39 | + python-version: |
| 40 | + - "3.11" |
| 41 | + - "3.12" |
| 42 | + - "3.13" |
| 43 | + - "3.14" |
| 44 | + - "3.14t" |
| 45 | + - "3.15" |
| 46 | + - "3.15t" |
| 47 | + services: |
| 48 | + postgres: |
| 49 | + image: postgres:17 |
| 50 | + env: |
| 51 | + POSTGRES_USER: inbox |
| 52 | + POSTGRES_PASSWORD: inbox |
| 53 | + POSTGRES_DB: inbox |
| 54 | + ports: |
| 55 | + - 5432:5432 |
| 56 | + options: >- |
| 57 | + --health-cmd "pg_isready -U inbox" |
| 58 | + --health-interval 10s |
| 59 | + --health-timeout 5s |
| 60 | + --health-retries 5 |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v6 |
| 63 | + - uses: extractions/setup-just@v4 |
| 64 | + - uses: astral-sh/setup-uv@v8.2.0 |
| 65 | + with: |
| 66 | + enable-cache: true |
| 67 | + cache-dependency-glob: "**/pyproject.toml" |
| 68 | + - run: uv python install ${{ matrix.python-version }} |
| 69 | + - run: uv python pin ${{ matrix.python-version }} |
| 70 | + - run: just install |
| 71 | + - name: Assert the GIL is actually disabled |
| 72 | + if: endsWith(matrix.python-version, 't') |
| 73 | + run: uv run --no-sync python -c "import sys, asyncpg, sqlalchemy, sqlalchemy_inbox; assert not sys._is_gil_enabled(), 'GIL re-enabled - a dependency lacks free-threaded support'" |
| 74 | + - run: just test-ci |
| 75 | + env: |
| 76 | + PYTHONDONTWRITEBYTECODE: 1 |
| 77 | + PYTHONUNBUFFERED: 1 |
| 78 | + POSTGRES_DSN: postgresql+asyncpg://inbox:inbox@127.0.0.1:5432/inbox |
| 79 | + |
| 80 | + floors: |
| 81 | + # Installs the declared floors on each Python, against the oldest supported PostgreSQL. |
| 82 | + if: github.event_name != 'schedule' |
| 83 | + runs-on: ubuntu-latest |
| 84 | + strategy: |
| 85 | + fail-fast: false |
| 86 | + matrix: |
| 87 | + python-version: |
| 88 | + - "3.11" |
| 89 | + - "3.12" |
| 90 | + - "3.13" |
| 91 | + - "3.14" |
| 92 | + services: |
| 93 | + postgres: |
| 94 | + image: postgres:14 |
| 95 | + env: |
| 96 | + POSTGRES_USER: inbox |
| 97 | + POSTGRES_PASSWORD: inbox |
| 98 | + POSTGRES_DB: inbox |
| 99 | + ports: |
| 100 | + - 5432:5432 |
| 101 | + options: >- |
| 102 | + --health-cmd "pg_isready -U inbox" |
| 103 | + --health-interval 10s |
| 104 | + --health-timeout 5s |
| 105 | + --health-retries 5 |
| 106 | + steps: |
| 107 | + - uses: actions/checkout@v6 |
| 108 | + - uses: astral-sh/setup-uv@v8.2.0 |
| 109 | + with: |
| 110 | + enable-cache: true |
| 111 | + cache-dependency-glob: "**/pyproject.toml" |
| 112 | + - run: uv python install ${{ matrix.python-version }} |
| 113 | + - run: uv python pin ${{ matrix.python-version }} |
| 114 | + - run: uv venv |
| 115 | + - if: matrix.python-version == '3.11' |
| 116 | + run: uv pip compile pyproject.toml --no-deps --resolution lowest-direct -o floors.txt |
| 117 | + - if: matrix.python-version != '3.11' |
| 118 | + run: uv pip compile pyproject.toml --resolution lowest-direct --no-build -o floors.txt |
| 119 | + - run: uv pip install -r pyproject.toml --group dev --constraints floors.txt --no-build |
| 120 | + - run: uv run --no-sync pytest . --no-cov |
| 121 | + env: |
| 122 | + PYTHONDONTWRITEBYTECODE: 1 |
| 123 | + PYTHONUNBUFFERED: 1 |
| 124 | + POSTGRES_DSN: postgresql+asyncpg://inbox:inbox@127.0.0.1:5432/inbox |
0 commit comments