-
Notifications
You must be signed in to change notification settings - Fork 54
79 lines (76 loc) · 3.27 KB
/
Copy pathasync-postgres.yml
File metadata and controls
79 lines (76 loc) · 3.27 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
name: Run async extra pytest tests
on:
workflow_call:
inputs:
python-version:
description: 'Python version'
default: '3.12'
required: false
type: string
postgresql:
description: 'PostgreSQL version'
required: true
type: number
os:
description: 'Operating system to run tests on'
default: 'ubuntu-latest'
required: false
type: string
permissions:
contents: read
jobs:
async-extra:
runs-on: ${{ inputs.os }}
timeout-minutes: 30
env:
OS: ${{ inputs.os }}
PYTHON: ${{ inputs.python-version }}
POSTGRES: ${{ inputs.postgresql }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up Python ${{ inputs.python-version }}
uses: fizyk/actions-reuse/.github/actions/uv-setup@e434952f57d1da48b52d0fe5454b365b2f297d2d # v5.2.6
with:
python-version: ${{ inputs.python-version }}
# ankane/setup-postgres publishes no tags/releases; v1 is a branch. Pinning
# to a SHA gains nothing (Dependabot can't track a branch). Revisit if the
# maintainer adds releases. See https://docs.zizmor.sh/audits/#unpinned-uses
- uses: ankane/setup-postgres@v1 # zizmor: ignore[unpinned-uses]
with:
postgres-version: ${{ inputs.postgresql }}
- name: Set PostgreSQL path on Linux
if: runner.os != 'Windows'
run: |
if command -v pg_ctl >/dev/null 2>&1; then
PG_CTL_PATH=$(command -v pg_ctl)
echo "POSTGRESQL_EXEC=$PG_CTL_PATH" >> $GITHUB_ENV
elif [ -f "/opt/homebrew/opt/postgresql@${{ inputs.postgresql }}/bin/pg_ctl" ]; then
echo "POSTGRESQL_EXEC=/opt/homebrew/opt/postgresql@${{ inputs.postgresql }}/bin/pg_ctl" >> $GITHUB_ENV
elif [ -f "/usr/local/opt/postgresql@${{ inputs.postgresql }}/bin/pg_ctl" ]; then
echo "POSTGRESQL_EXEC=/usr/local/opt/postgresql@${{ inputs.postgresql }}/bin/pg_ctl" >> $GITHUB_ENV
elif [ -f "/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" ]; then
echo "POSTGRESQL_EXEC=/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" >> $GITHUB_ENV
else
echo "Error: pg_ctl not found in expected locations"
exit 1
fi
- name: Detect PostgreSQL path on Windows
if: runner.os == 'Windows'
uses: ./.github/actions/detect-pg-ctl
with:
postgresql-version: ${{ inputs.postgresql }}
- name: update locale for tests
if: startsWith(inputs.os, 'ubuntu')
run: |
sudo locale-gen de_DE.UTF-8
- name: Run async tests
uses: fizyk/actions-reuse/.github/actions/uv-run@5e3ff7b4d544d6b3b8336cdc9c029cff9ab7abb3 # v5.2.7
with:
command: python -m pytest -svv -m asyncio -p no:xdist --postgresql-exec="${{ env.POSTGRESQL_EXEC }}" -k "not docker" --basetemp="${{ runner.temp }}/pytest-basetemp"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: failure()
with:
name: postgresql-async-${{ inputs.python-version }}-${{ inputs.postgresql }}-${{ inputs.os }}
path: ${{ runner.temp }}/pytest-basetemp/**