Skip to content

Commit aca3aaa

Browse files
committed
add CI similar to pymc
1 parent 9db597a commit aca3aaa

9 files changed

+260
-0
lines changed

buildosx

+6
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

codecov.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
codecov:
2+
require_ci_to_pass: no
3+
notify:
4+
after_n_builds: 6
5+
6+
coverage:
7+
precision: 2
8+
round: down
9+
range: "70...100"
10+
status:
11+
project:
12+
default:
13+
# basic
14+
target: auto
15+
threshold: 1%
16+
base: auto
17+
patch:
18+
default:
19+
# basic
20+
target: 50%
21+
threshold: 1%
22+
base: auto
23+
24+
ignore:
25+
- "pymc_experimental/tests/*"
26+
27+
comment:
28+
layout: "reach, diff, flags, files"
29+
behavior: default
30+
require_changes: false # if true: only post the comment if coverage changes
31+
require_base: no # [yes :: must have a base report to post]
32+
require_head: yes # [yes :: must have a head report to post]
33+
branches: null # branch names that can post comment

conda-envs/environment-test-py37.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: pymc-test-py37
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
- pymc>=4.0.0b1
7+
- pip
8+
- pytest-cov>=2.5
9+
- pytest>=3.0
10+
- python=3.7

conda-envs/environment-test-py38.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: pymc-test-py38
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
- pymc>=4.0.0b1
7+
- pip
8+
- pytest-cov>=2.5
9+
- pytest>=3.0
10+
- python=3.8

conda-envs/environment-test-py39.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: pymc-test-py39
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
- pymc>=4.0.0b1
7+
- pip
8+
- pytest-cov>=2.5
9+
- pytest>=3.0
10+
- python=3.9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: pymc-test-py38
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
- pymc>=4.0.0b1
7+
- pip
8+
- pytest-cov>=2.5
9+
- pytest>=3.0
10+
- python=3.8
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_experimental/**"
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-py37.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-py37.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-py37
59+
channel-priority: strict
60+
environment-file: conda-envs/environment-test-py37.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-py37
66+
pip install -e .
67+
python --version
68+
- name: Run tests
69+
run: |
70+
conda activate pymc-test-py37
71+
python -m pytest -vv --cov=pymc_experimental --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-py38.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-py38.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-py38
120+
channel-priority: strict
121+
environment-file: conda-envs/windows-environment-test-py38.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-py38
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-py38 &&
134+
python -m pytest -vv --cov=pymc_experimental --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

pyproject.toml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[tool.pytest.ini_options]
2+
minversion = "6.0"
3+
xfail_strict=true
4+
5+
[tool.black]
6+
line-length = 100
7+
8+
[tool.coverage.report]
9+
exclude_lines = [
10+
"pragma: nocover",
11+
"raise NotImplementedError",
12+
"if TYPE_CHECKING:",
13+
]
14+
15+
[tool.nbqa.mutate]
16+
isort = 1
17+
black = 1
18+
pyupgrade = 1

setupegg.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2020 The PyMC Developers
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
#!/usr/bin/env python
16+
"""
17+
A setup.py script to use setuptools, which gives egg goodness, etc.
18+
"""
19+
20+
from setuptools import setup
21+
22+
with open("setup.py") as s:
23+
exec(s.read())

0 commit comments

Comments
 (0)