-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (82 loc) · 2.49 KB
/
tests.yaml
File metadata and controls
101 lines (82 loc) · 2.49 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
name: Tests
on:
workflow_call:
permissions:
contents: read
jobs:
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.13", "3.14"]
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: zodb
POSTGRES_PASSWORD: zodb
POSTGRES_DB: zodb_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U zodb"
--health-interval 5s
--health-timeout 3s
--health-retries 5
env:
ZODB_TEST_DSN: "dbname=zodb_test user=zodb password=zodb host=localhost port=5432"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv venv && uv pip install -e ".[test,s3]"
- name: Run tests with coverage
run: uv run pytest --cov --cov-report=
- name: Rename coverage data
run: mv .coverage .coverage.${{ matrix.python-version }}
- name: Upload coverage data
uses: actions/upload-artifact@v7
with:
name: coverage-data-${{ matrix.python-version }}
path: .coverage.${{ matrix.python-version }}
include-hidden-files: true
if-no-files-found: ignore
coverage:
name: Combine & check coverage
if: always()
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install dependencies
run: uv venv && uv pip install -e ".[test]"
- uses: actions/download-artifact@v8
with:
pattern: coverage-data-*
merge-multiple: true
- name: Combine coverage & check threshold
run: |
uv run coverage combine
uv run coverage html --skip-covered --skip-empty
uv run coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
uv run coverage report
- name: Upload HTML report if check failed
uses: actions/upload-artifact@v7
with:
name: html-report
path: htmlcov
if: ${{ failure() }}