Fix CI errors in statspace test suite (#251) #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pytest | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
paths: | |
- ".github/workflows/*" | |
- "pymc_experimental/**" | |
- "setup.py" | |
- "pyproject.toml" | |
- "buildosx" | |
- "conda-envs/**" | |
- "codecov.yml" | |
jobs: | |
ubuntu: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
floatx: [float64] | |
python-version: ["3.9"] | |
test-subset: | |
- pymc_experimental/tests | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
env: | |
TEST_SUBSET: ${{ matrix.test-subset }} | |
PYTENSOR_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=native' | |
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 environment-test.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{ | |
hashFiles('conda-envs/environment-test.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: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
mamba-version: "*" | |
activate-environment: pymc-experimental-test | |
channel-priority: strict | |
environment-file: conda-envs/environment-test.yml | |
python-version: ${{matrix.python-version}} | |
use-mamba: true | |
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
- name: Install pymc-experimental | |
run: | | |
conda activate pymc-experimental-test | |
pip install -e . | |
python --version | |
- name: Run tests | |
run: | | |
conda activate pymc-experimental-test | |
python -m pytest -vv --cov=pymc_experimental --cov-append --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
env_vars: TEST_SUBSET | |
name: ${{ matrix.os }} ${{ matrix.floatx }} | |
fail_ci_if_error: false | |
windows: | |
strategy: | |
matrix: | |
os: [windows-latest] | |
floatx: [float32] | |
python-version: ["3.11"] | |
test-subset: | |
- pymc_experimental/tests | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
env: | |
TEST_SUBSET: ${{ matrix.test-subset }} | |
PYTENSOR_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=core2' | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache conda | |
uses: actions/cache@v1 | |
env: | |
# Increase this value to reset cache if conda-envs/windows-environment-test.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{ | |
hashFiles('conda-envs/windows-environment-test.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: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
mamba-version: "*" | |
activate-environment: pymc-experimental-test | |
channel-priority: strict | |
environment-file: conda-envs/windows-environment-test.yml | |
python-version: ${{matrix.python-version}} | |
use-mamba: true | |
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
- name: Install pymc-experimental | |
run: | | |
conda activate pymc-experimental-test | |
pip install -e . | |
python --version | |
- name: Run tests | |
# This job uses a cmd shell, therefore the environment variable syntax is different! | |
# The ">-" in the next line replaces newlines with spaces (see https://stackoverflow.com/a/66809682). | |
run: >- | |
conda activate pymc-experimental-test && | |
python -m pytest -vv --cov=pymc_experimental --cov-append --cov-report=xml --cov-report term --durations=50 %TEST_SUBSET% | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
env_vars: TEST_SUBSET | |
name: ${{ matrix.os }} ${{ matrix.floatx }} | |
fail_ci_if_error: false |