-
Notifications
You must be signed in to change notification settings - Fork 40
73 lines (71 loc) · 2.39 KB
/
single-postgres.yml
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
name: Run pytest tests
on:
workflow_call:
inputs:
python-versions:
description: 'Supported python versions'
default: '["3.8", "3.9", "3.10", "3.11", "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
secrets:
codecov_token:
description: 'Codecov token'
required: false
jobs:
postgres:
runs-on: ${{ inputs.os }}
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJSON(inputs.python-versions) }}
env:
OS: ${{ inputs.os }}
PYTHON: ${{ matrix.python-version }}
POSTGRES: ${{ inputs.postgresql }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: ankane/setup-postgres@v1
with:
postgres-version: ${{ inputs.postgresql }}
- name: Check installed locales
run: |
locale -a
- name: update locale for tests
if: ${{ inputs.os == 'ubuntu-latest' }}
run: |
sudo locale-gen de_DE.UTF-8
- name: Run test
uses: fizyk/actions-reuse/.github/actions/pipenv@v2.4.7
with:
python-version: ${{ matrix.python-version }}
command: py.test -svv -n 0 --postgresql-exec="/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" -k "not docker" --cov-report=xml
- name: Run xdist test
uses: fizyk/actions-reuse/.github/actions/pipenv@v2.4.7
with:
python-version: ${{ matrix.python-version }}
command: py.test -n 1 --postgresql-exec="/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" -k "not docker" --cov-report=xml:coverage-xdist.xml
- uses: actions/upload-artifact@v4
if: failure()
with:
name: postgresql-${{ matrix.python-version }}-${{ inputs.postgresql }}
path: /tmp/pytest-of-runner/**
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.4.1
with:
token: ${{ secrets.codecov_token }}
flags: unittests
env_vars: OS,PYTHON
fail_ci_if_error: false