Skip to content

Commit

Permalink
Merge Windows workflow with pytest workflow
Browse files Browse the repository at this point in the history
Closes #4517
  • Loading branch information
michaelosthege committed Jun 20, 2021
1 parent 7cf6640 commit 879adf4
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 70 deletions.
73 changes: 64 additions & 9 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,29 @@ on:
push:
branches: [main]


# Tests are split into multiple jobs to accelerate the CI.
# Different jobs should be organized to take approximately the same
# time to complete (and not be prohibitely slow).
# Because GitHub Actions don't support YAML anchors, we have to place the
# splitting of testfiles into groups in the strategy/matrix/test-subset
# and can't re-use the groups across jobs.
# A pre-commit hook (scripts/check_all_tests_are_covered.py)
# enforces that test run just once per OS / floatX setting.

jobs:
pytest:
ubuntu:
strategy:
matrix:
os: [ubuntu-18.04]
floatx: [float32, float64]
test-subset:
# Tests are split into multiple jobs to accelerate the CI.
# Different jobs should be organized to take approximately the same
# time to complete (and not be prohibitely slow)
#
# How this works:
# 1st block: Only passes --ignore parameters to pytest.
# → pytest will run all test_*.py files that are NOT ignored.
#
# Subsequent blocks: Only pass paths to test files.
# → pytest will run only these files
#
# Any test that was not ignored runs in the first job.
# A pre-commit hook (scripts/check_all_tests_are_covered.py)
# enforces that test run just once.
- |
--ignore=pymc3/tests/test_distributions_timeseries.py
--ignore=pymc3/tests/test_mixture.py
Expand Down Expand Up @@ -128,3 +131,55 @@ jobs:
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
windows:
strategy:
matrix:
os: [windows-latest]
floatx: [float64]
test-subset:
- pymc3/tests/test_distributions_random.py
- pymc3/tests/test_sampling.py
runs-on: ${{ matrix.os }}
env:
TEST_SUBSET: ${{ matrix.test-subset }}
AESARA_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=core2'
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Cache conda
uses: actions/cache@v1
env:
# Increase this value to reset cache if conda-envs/environment-dev-py38.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('conda-envs/windows-environment-dev-py38.yml') }}
- name: Cache multiple paths
uses: actions/cache@v2
env:
# Increase this value to reset cache if requirements.txt has not changed
CACHE_NUMBER: 0
with:
path: |
~/.cache/pip
$RUNNER_TOOL_CACHE/Python/*
~\AppData\Local\pip\Cache
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{
hashFiles('requirements.txt') }}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: pymc3-dev-py38
channel-priority: strict
environment-file: conda-envs/windows-environment-dev-py38.yml
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Install-pymc3
run: |
conda activate pymc3-dev-py38
pip install -e .
python --version
- run: |
conda activate pymc3-dev-py38
python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET
60 changes: 0 additions & 60 deletions .github/workflows/windows.yml

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/check_all_tests_are_covered.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def from_yaml():
"""
# First collect the matrix definitions from testing workflows
matrices = {}
for wf in ["pytest.yml", "windows.yml", "arviz_compat.yml", "jaxtests.yml"]:
for wf in ["pytest.yml", "arviz_compat.yml", "jaxtests.yml"]:
wfname = wf.strip(".yml")
wfdef = yaml.safe_load(open(Path(".github", "workflows", wf)))
for jobname, jobdef in wfdef["jobs"].items():
Expand Down

0 comments on commit 879adf4

Please sign in to comment.