Skip to content

Commit f3bb085

Browse files
Merge Windows workflow with pytest workflow
Closes #4517
1 parent 7cf6640 commit f3bb085

File tree

3 files changed

+65
-70
lines changed

3 files changed

+65
-70
lines changed

.github/workflows/pytest.yml

Lines changed: 64 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,29 @@ on:
55
push:
66
branches: [main]
77

8+
9+
# Tests are split into multiple jobs to accelerate the CI.
10+
# Different jobs should be organized to take approximately the same
11+
# time to complete (and not be prohibitely slow).
12+
# Because GitHub Actions don't support YAML anchors, we have to place the
13+
# splitting of testfiles into groups in the strategy/matrix/test-subset
14+
# and can't re-use the groups across jobs.
15+
# A pre-commit hook (scripts/check_all_tests_are_covered.py)
16+
# enforces that test run just once per OS / floatX setting.
17+
818
jobs:
9-
pytest:
19+
ubuntu:
1020
strategy:
1121
matrix:
1222
os: [ubuntu-18.04]
1323
floatx: [float32, float64]
1424
test-subset:
15-
# Tests are split into multiple jobs to accelerate the CI.
16-
# Different jobs should be organized to take approximately the same
17-
# time to complete (and not be prohibitely slow)
18-
#
1925
# How this works:
2026
# 1st block: Only passes --ignore parameters to pytest.
2127
# → pytest will run all test_*.py files that are NOT ignored.
28+
#
2229
# Subsequent blocks: Only pass paths to test files.
2330
# → pytest will run only these files
24-
#
25-
# Any test that was not ignored runs in the first job.
26-
# A pre-commit hook (scripts/check_all_tests_are_covered.py)
27-
# enforces that test run just once.
2831
- |
2932
--ignore=pymc3/tests/test_distributions_timeseries.py
3033
--ignore=pymc3/tests/test_mixture.py
@@ -128,3 +131,55 @@ jobs:
128131
env_vars: OS,PYTHON
129132
name: codecov-umbrella
130133
fail_ci_if_error: false
134+
windows:
135+
strategy:
136+
matrix:
137+
os: [windows-latest]
138+
floatx: [float64]
139+
test-subset:
140+
- pymc3/tests/test_distributions_random.py
141+
- pymc3/tests/test_sampling.py
142+
runs-on: ${{ matrix.os }}
143+
env:
144+
TEST_SUBSET: ${{ matrix.test-subset }}
145+
AESARA_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=core2'
146+
defaults:
147+
run:
148+
shell: bash -l {0}
149+
steps:
150+
- uses: actions/checkout@v2
151+
- name: Cache conda
152+
uses: actions/cache@v1
153+
env:
154+
# Increase this value to reset cache if conda-envs/environment-dev-py38.yml has not changed
155+
CACHE_NUMBER: 0
156+
with:
157+
path: ~/conda_pkgs_dir
158+
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
159+
hashFiles('conda-envs/windows-environment-dev-py38.yml') }}
160+
- name: Cache multiple paths
161+
uses: actions/cache@v2
162+
env:
163+
# Increase this value to reset cache if requirements.txt has not changed
164+
CACHE_NUMBER: 0
165+
with:
166+
path: |
167+
~/.cache/pip
168+
$RUNNER_TOOL_CACHE/Python/*
169+
~\AppData\Local\pip\Cache
170+
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{
171+
hashFiles('requirements.txt') }}
172+
- uses: conda-incubator/setup-miniconda@v2
173+
with:
174+
activate-environment: pymc3-dev-py38
175+
channel-priority: strict
176+
environment-file: conda-envs/windows-environment-dev-py38.yml
177+
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
178+
- name: Install-pymc3
179+
run: |
180+
conda activate pymc3-dev-py38
181+
pip install -e .
182+
python --version
183+
- run: |
184+
conda activate pymc3-dev-py38
185+
python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET

.github/workflows/windows.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

scripts/check_all_tests_are_covered.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def from_yaml():
3636
"""
3737
# First collect the matrix definitions from testing workflows
3838
matrices = {}
39-
for wf in ["pytest.yml", "windows.yml", "arviz_compat.yml", "jaxtests.yml"]:
39+
for wf in ["pytest.yml", "arviz_compat.yml", "jaxtests.yml"]:
4040
wfname = wf.strip(".yml")
4141
wfdef = yaml.safe_load(open(Path(".github", "workflows", wf)))
4242
for jobname, jobdef in wfdef["jobs"].items():

0 commit comments

Comments
 (0)