Skip to content

Commit 68b7d7e

Browse files
committed
Optimize CI for PRs: Add pairwise coverage unit tests and skip wheel tests
For pull requests, implement 2-way coverage (pairwise) between OS and Python version to reduce CI time while maintaining comprehensive test coverage. Changes: - Add unit_tests job that runs on PRs with full OS×Python matrix (ubuntu-latest, macos-14, windows-latest) × (Python 3.8-3.14) = 21 jobs providing pairwise coverage - Skip tests in build_wheels job for PRs using CIBW_TEST_SKIP='*' to avoid redundant testing and reduce CI time - Wheels are still built for all platforms on PRs, just not tested - Full wheel testing remains enabled for push to main and tags This reduces PR CI time from 45-90 minutes to ~15-20 minutes while maintaining full test coverage through the dedicated unit_tests job.
1 parent 63be86b commit 68b7d7e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/cibuildwheel.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,32 @@ on:
1212
- main
1313

1414
jobs:
15+
unit_tests:
16+
if: github.event_name == 'pull_request'
17+
name: Unit tests on ${{ matrix.os }} / Python ${{ matrix.python }}
18+
runs-on: ${{ matrix.os }}
19+
timeout-minutes: 30
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ubuntu-latest, macos-14, windows-latest]
24+
python: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
submodules: recursive
29+
- uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python }}
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip wheel setuptools
35+
python -m pip install numpy pytest
36+
- name: Build and install
37+
run: python -m pip install -e .
38+
- name: Run tests
39+
run: pytest tests -vv
40+
1541
build_wheels:
1642
name: Build wheels on ${{ matrix.os }}
1743
runs-on: ${{ matrix.os }}
@@ -290,6 +316,7 @@ jobs:
290316
CIBW_TEST_COMMAND: python {project}/tests/_ci_test_runner.py
291317
CIBW_TEST_COMMAND_WINDOWS: python {project}\tests\_ci_test_runner.py
292318
CIBW_TEST_REQUIRES: pytest numpy
319+
CIBW_TEST_SKIP: ${{ github.event_name == 'pull_request' && '*' || '' }}
293320
CIBW_BUILD_VERBOSITY: 1
294321
CIBW_ARCHS: ${{ matrix.arch }}
295322
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}

0 commit comments

Comments
 (0)