-
Notifications
You must be signed in to change notification settings - Fork 54
79 lines (76 loc) · 2.91 KB
/
Copy pathdockerised-postgres.yml
File metadata and controls
79 lines (76 loc) · 2.91 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 pytest tests
on:
workflow_call:
inputs:
python-versions:
description: 'Supported python versions'
default: '["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]'
required: false
type: string
postgresql:
description: 'PostgreSQL version'
required: true
type: number
secrets:
codecov_token:
description: 'Codecov token'
required: false
jobs:
postgres:
runs-on: 'ubuntu-latest'
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJSON(inputs.python-versions) }}
env:
OS: ${{ inputs.os }}
PYTHON: ${{ matrix.python-version }}
POSTGRES: ${{ inputs.postgresql }}
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image:
image: postgres:${{ inputs.postgresql }}
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5433:5432
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up uv with python ${{ matrix.python-version }}
uses: fizyk/actions-reuse/.github/actions/uv-setup@e434952f57d1da48b52d0fe5454b365b2f297d2d # v5.2.6
with:
python-version: ${{ matrix.python-version }}
- name: Run test noproc fixture on docker
id: run_docker_tests
uses: fizyk/actions-reuse/.github/actions/uv-run@5e3ff7b4d544d6b3b8336cdc9c029cff9ab7abb3 # v5.2.7
with:
command: python -m coverage run --data-file=.coverage.docker -m pytest -n 0 --max-worker-restart 0 -k docker --postgresql-host=localhost --postgresql-port 5433 --postgresql-password=postgres
env: '{"COVERAGE_PROCESS_START": ".coveragerc", "COVERAGE_FILE": ".coverage.docker"}'
- name: Combine and export docker coverage
if: ${{ always() && (steps.run_docker_tests.conclusion == 'success' || steps.run_docker_tests.conclusion == 'failure') }}
uses: fizyk/actions-reuse/.github/actions/coverage-combine-export-uv@e434952f57d1da48b52d0fe5454b365b2f297d2d # v5.2.6
with:
data-file: .coverage.docker
output-file: coverage-docker.xml
- name: Upload coverage to Codecov
if: always()
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.1
with:
token: ${{ secrets.codecov_token }}
flags: unittests
env_vars: OS,PYTHON
fail_ci_if_error: false
files: coverage-docker.xml