Skip to content

Commit

Permalink
use a single workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
eskerda committed Sep 26, 2024
1 parent 6de1eeb commit 5636edd
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 95 deletions.
72 changes: 68 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ on:
branches: [ "master" ]

jobs:
test:
unit:
name: Unit tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
Expand All @@ -33,11 +34,74 @@ jobs:
run: make lint
- name: test
run: make test
- name: test update
instance-changes:
name: Instance tests (only changes)
runs-on: ubuntu-latest
needs: [unit]
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: make install
- name: Test instance changes on this branch
run: make test-changes T_FLAGS+='-n 10 --json-report --json-report-file=report/report.json'
# Only run summary once
- name: all summary
if: (success() || failure()) && matrix.python-version == '3.8'
run: |
make report T_FLAGS+='-n 10' || true
make github-summary >> $GITHUB_STEP_SUMMARY
instance-tests:
name: Instance tests (all)
runs-on: ubuntu-latest
needs: [unit]
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: make install
- name: Test all instances
run: |
make report! T_FLAGS+='-n 10' || true
# Only run summary once
- name: summary
if: (success() || failure()) && matrix.python-version == '3.8'
run: |
make github-summary >> $GITHUB_STEP_SUMMARY
python2:
name: test (2.7)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 2.7
uses: MatteoH2O1999/setup-python@v4
with:
python-version: '2.7'
allow-build: info
cache-build: true
- name: Install dependencies
run: make install
- name: lint
run: make lint
- name: test
run: make test
- name: test update
run: |
# allowed to fail for test runs
make test-update T_FLAGS+='-n 10' || true
41 changes: 0 additions & 41 deletions .github/workflows/test_changes.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/test_python2.yml

This file was deleted.

22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
T_FLAGS =
R_FILE ?= report.json

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

report/report.json:
pytest tests -m update --json-report --json-report-file=report/report.json $(T_FLAGS)
report/$(R_FILE):
pytest tests -m update $(T_FLAGS) --json-report --json-report-file=report/$(R_FILE)

.PHONY: report
report: report/report.json
report: report/$(R_FILE)

.PHONY: report!
report!: clean report

.PHONY: summary
summary: report/report.json
@./utils/report.py report/report.json
summary: report/$(R_FILE)
@./utils/report.py report/$(R_FILE)

.PHONY: map
map: report/report.json
@./utils/report.py report/report.json --template utils/map.tpl.html > report/map.html
map: report/$(R_FILE)
@./utils/report.py report/$(R_FILE) --template utils/map.tpl.html > report/map.html
@open report/map.html || xdg-open report/map.html

.PHONY: map!
map!: clean map

.PHONY: github-summary
github-summary: report/report.json
@./utils/report.py report/report.json --template utils/github-summary.tpl.md
github-summary: report/$(R_FILE)
@./utils/report.py report/$(R_FILE) --template utils/github-summary.tpl.md

.PHONY: clean
clean: clean-report
Expand Down

0 comments on commit 5636edd

Please sign in to comment.