-
Notifications
You must be signed in to change notification settings - Fork 11
155 lines (131 loc) · 3.97 KB
/
tests.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
name: tests
on:
pull_request:
workflow_dispatch:
push:
branches: [master]
schedule:
- cron: '53 0 * * 1-5' # 00:53 Mon-Fri
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 2
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
fail-fast: false
env:
PYTEST_ADDOPTS: --cov --cov-append --color=yes
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: install libs
uses: cylc/release-actions/install-cylc-components@v1
with:
cylc_flow: true
cylc_flow_opts: 'empy'
metomi_rose: true
metomi_rose_opts: ''
- name: Install cylc-rose
# need editable install for coverage
run: |
pip install -e .[tests]
- name: Checkout FCM
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.fcm_repo || 'metomi/fcm' }}
ref: ${{ github.event.inputs.fcm_ref || 'master' }}
path: 'fcm'
- name: Install FCM
run: |
# install FCM deps
sudo apt-get install -y \
subversion \
build-essential \
gfortran \
libxml-parser-perl \
libconfig-inifiles-perl \
libdbi-perl \
libdbd-sqlite3-perl
# install wandisco
sudo sh -c 'echo "deb http://opensource.wandisco.com/ubuntu \
`lsb_release -cs` svn19" \
>> /etc/apt/sources.list.d/subversion19.list'
sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- \
| sudo apt-key add -
# prepend FCM bin to $PATH
FCM_PATH="$GITHUB_WORKSPACE/fcm/bin"
# the github actions way (needed for cylc jobs)
echo "$FCM_PATH" >> "${GITHUB_PATH}"
# the bashrc way (needed for subsequent gh action steps)
echo "export PATH=\"$FCM_PATH:\$PATH\"" >> "$HOME/.bashrc"
- name: Test
run: |
pytest -n 5 tests/
- name: Doctest
run: |
# note: not configuring this via a pytest.ini file
# due to strange behaviour when using --doctest-modules
# in the tests/ directory
pytest --doctest-modules cylc/
- name: Coverage report
run: |
coverage xml
coverage report
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage_py-${{ matrix.python-version }}
path: coverage.xml
retention-days: 4
lint:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: install libs
uses: cylc/release-actions/install-cylc-components@v1
with:
cylc_flow: true
cylc_flow_opts: ''
metomi_rose: true
metomi_rose_opts: ''
- name: Install cylc-rose
run: |
pip install .[lint]
- name: Style
run: flake8
- name: Mypy
run: mypy
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 }}
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 }}