Skip to content

Commit 04388da

Browse files
committed
use a single workflow file
1 parent 6de1eeb commit 04388da

File tree

4 files changed

+81
-95
lines changed

4 files changed

+81
-95
lines changed

Diff for: .github/workflows/test.yml

+68-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ on:
1515
branches: [ "master" ]
1616

1717
jobs:
18-
test:
18+
unit:
19+
name: Unit tests
1920
runs-on: ubuntu-latest
2021
strategy:
21-
fail-fast: false
22+
fail-fast: true
2223
matrix:
2324
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2425
steps:
@@ -33,11 +34,74 @@ jobs:
3334
run: make lint
3435
- name: test
3536
run: make test
36-
- name: test update
37+
instance-changes:
38+
name: Instance tests (only changes)
39+
runs-on: ubuntu-latest
40+
needs: [unit]
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0
49+
- name: Set up Python ${{ matrix.python-version }}
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: ${{ matrix.python-version }}
53+
- name: Install dependencies
54+
run: make install
55+
- name: Test instance changes on this branch
56+
run: make test-changes T_FLAGS+='-n 10 --json-report --json-report-file=report/report.json'
57+
# Only run summary once
58+
- name: all summary
59+
if: (success() || failure()) && matrix.python-version == '3.8'
3760
run: |
38-
make report T_FLAGS+='-n 10' || true
61+
make github-summary >> $GITHUB_STEP_SUMMARY
62+
instance-tests:
63+
name: Instance tests (all)
64+
runs-on: ubuntu-latest
65+
needs: [unit]
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
70+
steps:
71+
- uses: actions/checkout@v4
72+
- name: Set up Python ${{ matrix.python-version }}
73+
uses: actions/setup-python@v5
74+
with:
75+
python-version: ${{ matrix.python-version }}
76+
- name: Install dependencies
77+
run: make install
78+
- name: Test all instances (ok to fail)
79+
run: |
80+
make report! T_FLAGS+='-n 10' || true
3981
# Only run summary once
4082
- name: summary
4183
if: (success() || failure()) && matrix.python-version == '3.8'
4284
run: |
4385
make github-summary >> $GITHUB_STEP_SUMMARY
86+
87+
python2:
88+
name: test (2.7)
89+
runs-on: ubuntu-latest
90+
steps:
91+
- uses: actions/checkout@v3
92+
- name: Set up Python 2.7
93+
uses: MatteoH2O1999/setup-python@v4
94+
with:
95+
python-version: '2.7'
96+
allow-build: info
97+
cache-build: true
98+
- name: Install dependencies
99+
run: make install
100+
- name: lint
101+
run: make lint
102+
- name: test
103+
run: make test
104+
- name: test update
105+
run: |
106+
# allowed to fail for test runs
107+
make test-update T_FLAGS+='-n 10' || true

Diff for: .github/workflows/test_changes.yml

-41
This file was deleted.

Diff for: .github/workflows/test_python2.yml

-41
This file was deleted.

Diff for: Makefile

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
T_FLAGS =
2+
R_FILE ?= report.json
23

34
.PHONY: install
45
install:
@@ -22,27 +23,30 @@ lint:
2223
flake8 pybikes tests --count --select=E9,F63,F7,F82 --show-source --statistics
2324
flake8 pybikes tests --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
2425

25-
report/report.json:
26-
pytest tests -m update --json-report --json-report-file=report/report.json $(T_FLAGS)
26+
report/$(R_FILE):
27+
pytest tests -m update $(T_FLAGS) --json-report --json-report-file=report/$(R_FILE)
2728

2829
.PHONY: report
29-
report: report/report.json
30+
report: report/$(R_FILE)
31+
32+
.PHONY: report!
33+
report!: clean report
3034

3135
.PHONY: summary
32-
summary: report/report.json
33-
@./utils/report.py report/report.json
36+
summary: report/$(R_FILE)
37+
@./utils/report.py report/$(R_FILE)
3438

3539
.PHONY: map
36-
map: report/report.json
37-
@./utils/report.py report/report.json --template utils/map.tpl.html > report/map.html
40+
map: report/$(R_FILE)
41+
@./utils/report.py report/$(R_FILE) --template utils/map.tpl.html > report/map.html
3842
@open report/map.html || xdg-open report/map.html
3943

4044
.PHONY: map!
4145
map!: clean map
4246

4347
.PHONY: github-summary
44-
github-summary: report/report.json
45-
@./utils/report.py report/report.json --template utils/github-summary.tpl.md
48+
github-summary: report/$(R_FILE)
49+
@./utils/report.py report/$(R_FILE) --template utils/github-summary.tpl.md
4650

4751
.PHONY: clean
4852
clean: clean-report

0 commit comments

Comments
 (0)