Repository navigation
74 lines (64 loc) · 2.53 KB
/
Copy pathrun-postgres-tests.yml
File metadata and controls
74 lines (64 loc) · 2.53 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
name: Run PostgreSQL Tests
on:
push:
branches: [main, dev, extension-type-system]
pull_request:
workflow_dispatch: # Allows manual triggering
# Read-only token, whatever the repository default is (ITL-1193).
permissions:
contents: read
jobs:
test:
# Check name `PostgreSQL tests (3.13)`; distinct from the other suites' (ITL-1212).
name: PostgreSQL tests (${{ matrix.python-version }})
runs-on: ubuntu-latest
# id-token: write lets the Codecov upload authenticate by GitHub OIDC, with no stored
# token (ITL-1193). A fork's pull request gets no OIDC token: the action detects the fork
# and uploads tokenless instead.
permissions:
contents: read
id-token: write
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: testdb
POSTGRES_USER: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --locked --all-extras --dev --python ${{ matrix.python-version }}
- name: Run PostgreSQL tests
# Serial (-n 0): the tests share one PostgreSQL server (ITL-1181).
run: uv run --python ${{ matrix.python-version }} pytest -n 0 -v -m postgres --postgres --cov=src --cov-report=term-missing --cov-report=xml
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: testdb
- name: Upload coverage reports to Codecov
if: github.repository == 'metamorphic-labs/orcapod-python'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
use_oidc: true
# A failed upload fails a push run, where it would otherwise go unseen; it never
# fails a pull request, whose fork uploads are tokenless (ITL-1193).
fail_ci_if_error: ${{ github.event_name != 'pull_request' }}