forked from cylc/cylc-flow
-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (133 loc) · 4.05 KB
/
test_fast.yml
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: fast tests
on:
pull_request:
workflow_dispatch:
push:
branches:
- master
- '8.*.x'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false # don't stop on first failure
matrix:
os: ['ubuntu-latest']
python-version: ['3.7', '3.8', '3.10', '3.11', '3']
include:
# mac os test
- os: 'macos-latest'
python-version: '3.9' # oldest supported version
# non-utc timezone test
- os: 'ubuntu-latest'
python-version: '3.9' # not the oldest, not the most recent version
time-zone: 'XXX-09:35'
env:
TZ: ${{ matrix.time-zone }}
PYTEST_ADDOPTS: --cov --cov-append -n 5 --color=yes
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Apt-Get Install
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y sqlite3
- name: Patch DNS
uses: cylc/release-actions/patch-dns@v1
- name: Install
run: |
pip install -e ."[all]"
- name: Configure git # Needed by the odd test
uses: cylc/release-actions/configure-git@v1
- name: Unit Tests
timeout-minutes: 5
run: |
pytest cylc/flow tests/unit
- name: Integration Tests
timeout-minutes: 6
run: |
pytest tests/integration
- name: Upload failed tests artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: cylc-run (${{ matrix.os }} py-${{ matrix.python-version }})
path: ~/cylc-run/
- name: Coverage report
run: |
coverage xml
coverage report
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage_${{ matrix.os }}_py-${{ matrix.python-version }}
path: coverage.xml
retention-days: 7
lint:
runs-on: 'ubuntu-latest'
timeout-minutes: 10
steps:
- name: Apt-Get Install
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Checkout
uses: actions/checkout@v4
- name: Check Towncrier Files
run: |
set -eu pipefail
if ls changes.d | grep ^[a-z].*.md; then
echo "the following towncrier files may be wrong:"
ls changes.d | grep ^[a-z].*.md
exit 1
fi
# note: exclude python 3.10+ from mypy checks as these produce false
# positives in installed libraries for python 3.7
- name: Configure Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install
run: |
pip install -e ."[tests]"
- name: Flake8
run: flake8
- name: Bandit
run: |
bandit -r --ini .bandit cylc/flow
- name: Shellchecker
run: etc/bin/shellchecker
- name: MyPy
run: mypy
- name: Towncrier - draft changelog
uses: cylc/release-actions/towncrier-draft@v1
- name: Linkcheck
run: pytest -m linkcheck --dist=load --color=yes -n 10 tests/unit/test_links.py
codecov:
needs: test
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download coverage artifacts
uses: actions/download-artifact@v4
- name: Codecov upload
uses: codecov/codecov-action@v4
with:
name: ${{ github.workflow }}
flags: fast-tests
fail_ci_if_error: true
verbose: true
# Token not required for public repos, but avoids upload failure due
# to rate-limiting (but not for PRs opened from forks)
token: ${{ secrets.CODECOV_TOKEN }}