-
Notifications
You must be signed in to change notification settings - Fork 6
80 lines (71 loc) · 2.65 KB
/
Copy pathci_testing.yml
File metadata and controls
80 lines (71 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: CI testing
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
# cancel superseded runs only on PRs; never cancel pushes to protected branches
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
pytester:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 10
steps:
- name: 🔀 Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.python-version }}
- name: 📦 Install requirements
run: |
pip install ".[audit,cli]" -r tests/requirements.txt
pip list
shell: bash
- name: 🧪 Tests
shell: bash
run: |
python -m phmdoctest README.md -s "phmdoctest:skip" --outfile tests/integration/test_readme.py
for md in $(find docs -name "*.md" | sort); do
name="${md#docs/}"; name="${name%.md}"; name="${name//\//_}"; name="${name//-/_}"; \
python -m phmdoctest "$md" -s "phmdoctest:skip" --outfile "tests/docs/test_${name}.py"; \
done
python -m pytest . -vv --cov=deprecate
- name: 📊 Statistics
if: success()
run: |
coverage report
coverage xml
- name: 📡 Upload coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
if: success()
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: pytest,python${{ matrix.python-version }}
fail_ci_if_error: false
testing-guardian:
runs-on: ubuntu-latest
needs: pytester
if: always()
steps:
- run: echo "${{ needs.pytester.result }}"
- name: ❌ Failing...
if: needs.pytester.result == 'failure'
run: exit 1
- name: ⏭️ Cancelled or skipped...
if: contains(fromJSON('["cancelled", "skipped"]'), needs.pytester.result)
timeout-minutes: 1
run: sleep 90