Skip to content

Commit c507aaf

Browse files
Refs #36620 -- Guarded coverage tests workflow behind a label.
This also removes the skip on the primary tests workflow so that it runs more predictably.
1 parent bb7f4f8 commit c507aaf

2 files changed

Lines changed: 31 additions & 10 deletions

File tree

.github/workflows/coverage_tests.yml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Coverage Tests
22

33
on:
44
pull_request:
5+
types: [labeled, synchronize, opened, reopened]
56
paths-ignore:
67
- 'docs/**'
7-
- '**/*.md'
88

99
concurrency:
1010
group: ${{ github.workflow }}-${{ github.ref }}
@@ -15,9 +15,24 @@ permissions:
1515

1616
jobs:
1717
coverage:
18-
name: Coverage Tests (Windows)
19-
runs-on: windows-latest
18+
if: contains(github.event.pull_request.labels.*.name, 'coverage')
19+
runs-on: ubuntu-latest
20+
name: Coverage Tests (PostgreSQL)
2021
timeout-minutes: 60
22+
services:
23+
postgres:
24+
image: postgres:18-alpine
25+
env:
26+
POSTGRES_DB: django
27+
POSTGRES_USER: user
28+
POSTGRES_PASSWORD: postgres
29+
ports:
30+
- 5432:5432
31+
options: >-
32+
--health-cmd pg_isready
33+
--health-interval 10s
34+
--health-timeout 5s
35+
--health-retries 5
2136
steps:
2237
- name: Checkout
2338
uses: actions/checkout@v6
@@ -32,19 +47,26 @@ jobs:
3247
cache: 'pip'
3348
cache-dependency-path: 'tests/requirements/py3.txt'
3449

50+
- name: Update apt repo
51+
run: sudo apt update
52+
- name: Install libmemcached-dev for pylibmc
53+
run: sudo apt install -y libmemcached-dev
3554
- name: Install dependencies
3655
run: |
3756
python -m pip install --upgrade pip wheel
38-
python -m pip install -r tests/requirements/py3.txt -e .
57+
python -m pip install -r tests/requirements/py3.txt -r tests/requirements/postgres.txt -e .
3958
python -m pip install 'coverage[toml]' diff-cover
4059
60+
- name: Create PostgreSQL settings file
61+
run: mv ./.github/workflows/data/test_postgres.py.tpl ./tests/test_postgres.py
62+
4163
- name: Run tests with coverage
4264
env:
4365
PYTHONPATH: ${{ github.workspace }}/tests
4466
COVERAGE_PROCESS_START: ${{ github.workspace }}/tests/.coveragerc
4567
RUNTESTS_DIR: ${{ github.workspace }}/tests
4668
run: |
47-
python -Wall tests/runtests.py -v2
69+
python -Wall tests/runtests.py --settings=test_postgres -v2
4870
4971
- name: Generate coverage report
5072
if: success()
@@ -59,11 +81,11 @@ jobs:
5981
- name: Generate diff coverage report
6082
if: success()
6183
run: |
62-
if (Test-Path 'tests/coverage.xml') {
84+
if [ -f tests/coverage.xml ]; then
6385
diff-cover tests/coverage.xml --compare-branch=origin/main --fail-under=0 > diff-cover-report.md
64-
} else {
65-
Set-Content -Path diff-cover-report.md -Value 'No coverage data available.'
66-
}
86+
else
87+
echo "No coverage data available." > diff-cover-report.md
88+
fi
6789
6890
- name: Save PR number
6991
if: success()

.github/workflows/tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ permissions:
1919

2020
jobs:
2121
windows:
22-
if: github.event_name == 'push'
2322
runs-on: windows-latest
2423
strategy:
2524
matrix:

0 commit comments

Comments
 (0)