Skip to content

Commit d854361

Browse files
committed
worfklow and tests
1 parent 72939bf commit d854361

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed

.github/workflows/test.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: pytest
2+
3+
on:
4+
pull_request:
5+
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"
15+
16+
jobs:
17+
ubuntu:
18+
strategy:
19+
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}
30+
steps:
31+
- 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
46+
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
54+
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
64+
run: |
65+
conda activate pymc-test-py38
66+
pip install -e .
67+
python --version
68+
- name: Run tests
69+
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-py310.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-py310.yml') }}
102+
- name: Cache multiple paths
103+
uses: actions/cache@v2
104+
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-py310
120+
channel-priority: strict
121+
environment-file: conda-envs/windows-environment-test-py310.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-py310
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-py310 &&
134+
python -m pytest -vv --cov=pymc_bart --doctest-modules pymc_bart --cov-append --cov-report=xml --cov-report term --durations=50 %TEST_SUBSET%
135+
- name: Upload coverage to Codecov
136+
uses: codecov/codecov-action@v2
137+
with:
138+
env_vars: TEST_SUBSET
139+
name: ${{ matrix.os }} ${{ matrix.floatx }}
140+
fail_ci_if_error: false

buildosx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
export CFLAGS="-arch x86_64"
3+
export FFLAGS="-static -ff2c -arch x86_64"
4+
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch x86_64"
5+
rm -rf build
6+
python setupegg.py bdist_egg

0 commit comments

Comments
 (0)