Skip to content

Commit 990f3de

Browse files
committed
simplify tests
1 parent 8aefddf commit 990f3de

File tree

6 files changed

+45
-161
lines changed

6 files changed

+45
-161
lines changed

.github/workflows/test.yml

Lines changed: 40 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,58 @@
1-
name: pytest
1+
name: Run tests
22

33
on:
4-
pull_request:
54
push:
6-
branches: [main]
7-
paths:
8-
- ".github/workflows/*"
9-
- "pymc_bart/**"
10-
- "setup.py"
11-
- "pyproject.toml"
12-
- "buildosx"
13-
- "conda-envs/**"
14-
- "codecov.yml"
5+
branches:
6+
- main
7+
pull_request:
158

169
jobs:
17-
ubuntu:
10+
test:
11+
runs-on: ubuntu-latest
1812
strategy:
1913
matrix:
20-
os: [ubuntu-18.04]
21-
floatx: [float32, float64]
22-
fail-fast: false
23-
runs-on: ${{ matrix.os }}
24-
env:
25-
TEST_SUBSET: ${{ matrix.test-subset }}
26-
AESARA_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=native'
27-
defaults:
28-
run:
29-
shell: bash -l {0}
14+
python-version: ["3.8", "3.9", "3.10"]
15+
16+
name: Set up Python ${{ matrix.python-version }}
3017
steps:
3118
- uses: actions/checkout@v2
32-
- name: Cache conda
33-
uses: actions/cache@v1
34-
env:
35-
# Increase this value to reset cache if environment-test-py38.yml has not changed
36-
CACHE_NUMBER: 0
37-
with:
38-
path: ~/conda_pkgs_dir
39-
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
40-
hashFiles('conda-envs/environment-test-py38.yml') }}
41-
- name: Cache multiple paths
42-
uses: actions/cache@v2
43-
env:
44-
# Increase this value to reset cache if requirements.txt has not changed
45-
CACHE_NUMBER: 0
4619
with:
47-
path: |
48-
~/.cache/pip
49-
$RUNNER_TOOL_CACHE/Python/*
50-
~\AppData\Local\pip\Cache
51-
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{
52-
hashFiles('requirements.txt') }}
53-
- uses: conda-incubator/setup-miniconda@v2
20+
fetch-depth: 0
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: conda-incubator/setup-miniconda@v2
5424
with:
55-
miniforge-variant: Mambaforge
56-
miniforge-version: latest
57-
mamba-version: "*"
58-
activate-environment: pymc-test-py38
59-
channel-priority: strict
60-
environment-file: conda-envs/environment-test-py38.yml
61-
use-mamba: true
62-
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
63-
- name: Install-pymc
25+
channels: conda-forge, defaults
26+
channel-priority: true
27+
python-version: ${{ matrix.python-version }}
28+
auto-update-conda: true
29+
30+
- name: Install pymc_bart
31+
shell: bash -l {0}
6432
run: |
65-
conda activate pymc-test-py38
66-
pip install -e .
33+
conda install pip
34+
pip install -r requirements-dev.txt
35+
pip install .
6736
python --version
37+
conda list
38+
pip freeze
39+
- name: Run linters
40+
shell: bash -l {0}
41+
run: |
42+
python -m black pymc_bart --check
43+
echo "Success!"
44+
echo "Checking code style with pylint..."
45+
python -m pylint pymc_bart/
6846
- name: Run tests
47+
shell: bash -l {0}
6948
run: |
70-
conda activate pymc-test-py38
71-
python -m pytest -vv --cov=pymc_bart --cov-append --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET
72-
- name: Upload coverage to Codecov
73-
uses: codecov/codecov-action@v2
74-
with:
75-
env_vars: TEST_SUBSET
76-
name: ${{ matrix.os }} ${{ matrix.floatx }}
77-
fail_ci_if_error: false
78-
windows:
79-
strategy:
80-
matrix:
81-
os: [windows-latest]
82-
floatx: [float32, float64]
83-
fail-fast: false
84-
runs-on: ${{ matrix.os }}
85-
env:
86-
TEST_SUBSET: ${{ matrix.test-subset }}
87-
AESARA_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=core2'
88-
defaults:
89-
run:
90-
shell: cmd
91-
steps:
92-
- uses: actions/checkout@v2
93-
- name: Cache conda
94-
uses: actions/cache@v1
95-
env:
96-
# Increase this value to reset cache if conda-envs/environment-test-py37.yml has not changed
97-
CACHE_NUMBER: 0
98-
with:
99-
path: ~/conda_pkgs_dir
100-
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
101-
hashFiles('conda-envs/windows-environment-test-py37.yml') }}
102-
- name: Cache multiple paths
103-
uses: actions/cache@v2
49+
python -m pytest -vv --cov=pymc_bart --cov-report=term --cov-report=xml pymc_bart/tests
10450
env:
105-
# Increase this value to reset cache if requirements.txt has not changed
106-
CACHE_NUMBER: 0
107-
with:
108-
path: |
109-
~/.cache/pip
110-
$RUNNER_TOOL_CACHE/Python/*
111-
~\AppData\Local\pip\Cache
112-
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{
113-
hashFiles('requirements.txt') }}
114-
- uses: conda-incubator/setup-miniconda@v2
115-
with:
116-
miniforge-variant: Mambaforge
117-
miniforge-version: latest
118-
mamba-version: "*"
119-
activate-environment: pymc-test-py37
120-
channel-priority: strict
121-
environment-file: conda-envs/windows-environment-test-py37.yml
122-
use-mamba: true
123-
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
124-
- name: Install-pymc
125-
run: |
126-
conda activate pymc-test-py37
127-
pip install -e .
128-
python --version
129-
- name: Run tests
130-
# This job uses a cmd shell, therefore the environment variable syntax is different!
131-
# The ">-" in the next line replaces newlines with spaces (see https://stackoverflow.com/a/66809682).
132-
run: >-
133-
conda activate pymc-test-py37 &&
134-
python -m pytest -vv --cov=pymc_bart --doctest-modules pymc_bart --cov-append --cov-report=xml --cov-report term --durations=50 %TEST_SUBSET%
51+
PYTHON_VERSION: ${{ matrix.python-version }}
52+
13553
- name: Upload coverage to Codecov
136-
uses: codecov/codecov-action@v2
54+
uses: codecov/codecov-action@v1
13755
with:
138-
env_vars: TEST_SUBSET
139-
name: ${{ matrix.os }} ${{ matrix.floatx }}
140-
fail_ci_if_error: false
56+
env_vars: OS,PYTHON
57+
name: codecov-umbrella
58+
fail_ci_if_error: false

buildosx

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

conda-envs/environment-test-py38.yml

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

conda-envs/environment-test-py39.yml

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

conda-envs/windows-environment-test-py37.yml

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

requirements-dev.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
black==22.3.0
2+
click==8.0.4
3+
pylint==2.10.2
4+
pytest-cov>=2.6.1
5+
pytest>=4.4.0

0 commit comments

Comments
 (0)