Skip to content

Commit 789aa0d

Browse files
authored
Don't run tests for non-code changes (#898)
1 parent 6779fd1 commit 789aa0d

File tree

4 files changed

+103
-73
lines changed

4 files changed

+103
-73
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -17,76 +17,3 @@ jobs:
1717
- uses: actions/checkout@v3
1818
- uses: actions/setup-python@v3
1919
- uses: pre-commit/[email protected]
20-
test:
21-
runs-on: ubuntu-latest
22-
strategy:
23-
matrix:
24-
config: [ {python-version: "3.10", oldest-pymc: false}, {python-version: "3.12", oldest-pymc: true}]
25-
steps:
26-
- uses: actions/checkout@v3
27-
- name: Set up Python
28-
uses: actions/setup-python@v3
29-
with:
30-
python-version: ${{ matrix.config.python-version }}
31-
- name: Install oldest version of PyMC
32-
if: ${{ matrix.config.oldest-pymc }}
33-
run: pip install pymc==${{ env.OLDEST_PYMC_VERSION }}
34-
- name: Run tests
35-
run: |
36-
pip install -e .[test]
37-
pytest --cov-report=xml --no-cov-on-fail --durations=50
38-
- name: Check oldest version of PyMC
39-
if: ${{ matrix.config.oldest-pymc }}
40-
run: python -c "import pymc; assert pymc.__version__ == '${{ env.OLDEST_PYMC_VERSION }}'"
41-
- name: Upload coverage to Codecov
42-
uses: codecov/codecov-action@v3
43-
with:
44-
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
45-
name: ${{ matrix.config.python-version }}
46-
fail_ci_if_error: false
47-
48-
test_slow:
49-
runs-on: ubuntu-latest
50-
steps:
51-
- uses: actions/checkout@v3
52-
- name: Set up Python
53-
uses: actions/setup-python@v3
54-
with:
55-
python-version: "3.10"
56-
- name: Run tests
57-
run: |
58-
pip install -e .[test]
59-
pytest --only-slow --cov-report=xml --no-cov-on-fail --durations=50
60-
- name: Upload coverage to Codecov
61-
uses: codecov/codecov-action@v3
62-
with:
63-
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
64-
name: "test_slow"
65-
fail_ci_if_error: false
66-
67-
example_notebooks:
68-
runs-on: ubuntu-latest
69-
steps:
70-
- uses: actions/checkout@v3
71-
- name: Set up Python
72-
uses: actions/setup-python@v3
73-
with:
74-
python-version: "3.12"
75-
- name: Install dependencies
76-
run: |
77-
sudo apt-get install graphviz
78-
pip install -e .[docs]
79-
pip install -e .[test]
80-
- name: Run notebooks
81-
run: make run_notebooks
82-
83-
84-
all:
85-
if: ${{ always() }}
86-
runs-on: ubuntu-latest
87-
name: All checks
88-
needs: [ test, test_slow ]
89-
steps:
90-
- name: Confirm checks passed
91-
if: ${{ (needs.test.result != 'success' || needs.test_slow.result != 'success') }}
92-
run: exit 1

.github/workflows/test.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths: '**.py'
7+
push:
8+
branches: [main]
9+
paths: '**.py'
10+
11+
env:
12+
# The lower bound from the pyproject.toml file
13+
OLDEST_PYMC_VERSION: "$(grep -E 'pymc *>' pyproject.toml | sed -n 's/.*>=\\([0-9]*\\.[0-9]*\\.[0-9]*\\).*/\\1/p')"
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
config: [ {python-version: "3.10", oldest-pymc: false}, {python-version: "3.12", oldest-pymc: true}]
21+
steps:
22+
- uses: actions/checkout@v3
23+
- name: Set up Python
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: ${{ matrix.config.python-version }}
27+
- name: Install oldest version of PyMC
28+
if: ${{ matrix.config.oldest-pymc }}
29+
run: pip install pymc==${{ env.OLDEST_PYMC_VERSION }}
30+
- name: Run tests
31+
run: |
32+
pip install -e .[test]
33+
pytest --cov-report=xml --no-cov-on-fail --durations=50
34+
- name: Check oldest version of PyMC
35+
if: ${{ matrix.config.oldest-pymc }}
36+
run: python -c "import pymc; assert pymc.__version__ == '${{ env.OLDEST_PYMC_VERSION }}'"
37+
- name: Upload coverage to Codecov
38+
uses: codecov/codecov-action@v3
39+
with:
40+
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
41+
name: ${{ matrix.config.python-version }}
42+
fail_ci_if_error: false
43+
44+
test_slow:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v3
48+
- name: Set up Python
49+
uses: actions/setup-python@v3
50+
with:
51+
python-version: "3.10"
52+
- name: Run tests
53+
run: |
54+
pip install -e .[test]
55+
pytest --only-slow --cov-report=xml --no-cov-on-fail --durations=50
56+
- name: Upload coverage to Codecov
57+
uses: codecov/codecov-action@v3
58+
with:
59+
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
60+
name: "test_slow"
61+
fail_ci_if_error: false
62+
63+
all:
64+
if: ${{ always() }}
65+
runs-on: ubuntu-latest
66+
name: All checks
67+
needs: [ test, test_slow ]
68+
steps:
69+
- name: Confirm checks passed
70+
if: ${{ (needs.test.result != 'success' || needs.test_slow.result != 'success') }}
71+
run: exit 1
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Test Notebook
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- '**.py'
8+
- '**.ipynb'
9+
push:
10+
branches: [main]
11+
paths:
12+
- '**.py'
13+
- '**.ipynb'
14+
15+
jobs:
16+
example_notebooks:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up Python
21+
uses: actions/setup-python@v3
22+
with:
23+
python-version: "3.12"
24+
- name: Install dependencies
25+
run: |
26+
sudo apt-get install graphviz
27+
pip install -e .[docs]
28+
pip install -e .[test]
29+
- name: Run notebooks
30+
run: make run_notebooks

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
----
88

99
![Build](https://github.com/pymc-labs/pymc-marketing/actions/workflows/ci.yml/badge.svg)
10+
![Test](https://github.com/pymc-labs/pymc-marketing/actions/workflows/test.yml/badge.svg)
11+
![Notebook](https://github.com/pymc-labs/pymc-marketing/actions/workflows/test_notebook.yml/badge.svg)
1012
[![codecov](https://codecov.io/gh/pymc-labs/pymc-marketing/branch/main/graph/badge.svg?token=OBV3BS5TYE)](https://codecov.io/gh/pymc-labs/pymc-marketing)
1113
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
1214
[![docs](https://readthedocs.org/projects/pymc-marketing/badge/?version=latest)](https://docs.readthedocs.io/en/latest/)

0 commit comments

Comments
 (0)