forked from cylc/cylc-flow
-
Notifications
You must be signed in to change notification settings - Fork 0
225 lines (200 loc) · 7.1 KB
/
test_functional.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: functional tests
on:
workflow_dispatch:
pull_request:
paths-ignore:
- '.github/workflows/*.ya?ml'
- '!.github/workflows/test_functional.yml'
- 'cylc/flow/etc/syntax/**'
- 'etc/syntax/**'
- 'tests/unit/**'
- 'tests/integration/**'
- '**.md'
- '**/README*/**'
push:
branches:
- master
- '8.*.x'
paths-ignore:
- '.github/workflows/*.ya?ml'
- '!.github/workflows/test_functional.yml'
- 'cylc/flow/etc/syntax/**'
- 'etc/syntax/**'
- 'tests/unit/**'
- 'tests/integration/**'
- '**.md'
- '**/README*/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
name: ${{ matrix.name || matrix.chunk }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: ['3']
test-base: ['tests/f']
chunk: ['1/4']
platform: ['_local_background* _local_at*']
env:
# Use non-UTC time zone
TZ: XXX-05:30
# these vars are used by etc/bin/run-functional-tests
CYLC_TEST_PLATFORMS: ${{ matrix.platform }}
CYLC_COVERAGE: 1
REMOTE_PLATFORM: ${{ contains(matrix.platform, '_remote') }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Brew Install
if: startsWith(matrix.os, 'macos')
run: |
# install system deps
brew update
brew install bash coreutils gnu-sed
# add GNU coreutils and sed to the user PATH
# (see instructions in brew install output)
echo \
"$(brew --prefix)/opt/coreutils/libexec/gnubin" \
>> "${GITHUB_PATH}"
echo \
"/usr/local/opt/gnu-sed/libexec/gnubin" \
>> "${GITHUB_PATH}"
# add coreutils to the bashrc too (for jobs)
cat >> "${HOME}/.bashrc" <<__HERE__
PATH="$(brew --prefix)/opt/coreutils/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
export PATH
__HERE__
- name: Apt-Get Install
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y sqlite3 tree at
- name: Add .github/bin/ to PATH
# Sets up mocked mail command & any other custom executables
run: echo "${{ github.workspace }}/.github/bin" >> $GITHUB_PATH
- name: Install
run: |
pip install -e ."[all]"
mkdir "$HOME/cylc-run"
- name: Configure Atrun
if: contains(matrix.platform, '_local_at')
run: |
PTH="$HOME/.cylc/flow/"
mkdir -p "${PTH}"
cat > "${PTH}/global.cylc" << __HERE__
[platforms]
[[_local_at_indep_tcp]]
hosts = localhost
install target = localhost
job runner = at
__HERE__
cp "${PTH}/global.cylc" "${PTH}/global-tests.cylc"
- name: Swarm Configure
run: |
etc/bin/swarm --yes --debug configure
- name: Swarm Build
if: env.REMOTE_PLATFORM == 'true'
run: |
# `swarm configure` seems to get ignored so override the user config
cp etc/conf/ssh_config $HOME/.ssh/config
# build and run the swarm
etc/bin/swarm --yes --debug build
etc/bin/swarm --yes --debug run
# test that it's up and running before proceeding
sleep 1
ssh -vv _remote_background_indep_poll hostname
- name: Configure git # Needed by the odd test
uses: cylc/release-actions/configure-git@v1
- name: Filter Tests
env:
# NOTE: we only want the CHUNK set in this step else we will
# re-chunk tests later when they run
CHUNK: ${{ matrix.chunk }}
run: |
etc/bin/run-functional-tests \
--dry \
${{ matrix.test-base }} \
> test-file
if [[ $REMOTE_PLATFORM == 'true' ]]; then
# skip tests that don't configure platform requirements
grep -l --color=never REQUIRE_PLATFORM $(cat test-file) > test-file
fi
- name: Test
id: test
timeout-minutes: 35
continue-on-error: true
run: |
echo "finished=false" >> $GITHUB_OUTPUT
if [[ '${{ matrix.test-base }}' == 'tests/k' ]]; then
NPROC=4
else
NPROC=8
fi
# NOTE: test base is purposefully un-quoted
etc/bin/run-functional-tests \
-j "${NPROC}" \
--state=save \
$(cat test-file) \
|| (echo "finished=true" >> $GITHUB_OUTPUT && false)
- name: Time Out
if: steps.test.outcome == 'failure' && steps.test.outputs.finished != 'true'
run: |
echo '::error:: tests timed-out'
# help to identify the tests that were running at the time
cylc scan --state=all --format=rich --color-blind
# fail the workflow
false
- name: Re-run failed tests
timeout-minutes: 10
if: steps.test.outcome == 'failure' && steps.test.outputs.finished == 'true'
run: |
# re-run failed tests providing that they didn't time out first time
# TODO: make the tests deterministic so we don't need to do this
etc/bin/run-functional-tests \
-j 1 \
-v \
--state=save,failed $(cat test-file)
- name: Copy cylc-run out of container
if: failure() && steps.test.outcome == 'failure' && env.REMOTE_PLATFORM == 'true'
run: |
# pick the first host in the list
host="$(cut -d ' ' -f 1 <<< "${{ matrix.platform }}")"
# copy back the remote cylc-run dir
rsync -av \
"${host}:/root/cylc-run/" \
"${HOME}/cylc-run/${host}/"
- name: Debug
if: failure() && steps.test.outcome == 'failure'
timeout-minutes: 1
run: |
find "$HOME/cylc-run" -name '*.err' -type f \
-exec echo '====== {} ======' \; -exec cat '{}' \;
find "$HOME/cylc-run" -name '*.log' -type f \
-exec echo '====== {} ======' \; -exec cat '{}' \;
find "${TMPDIR:-/tmp}/${USER}/cylctb-"* -type f \
-exec echo '====== {} ======' \; -exec cat '{}' \;
- name: Set artifact upload name
id: uploadname
run: |
# artifact name cannot contain '/' characters
CID="$(sed 's|/|-|g' <<< "${{ matrix.name || matrix.chunk }}")"
echo "uploadname=$CID" >> $GITHUB_OUTPUT
- name: Upload failed tests artifact
if: failure() && steps.test.outcome == 'failure'
uses: actions/upload-artifact@v3
with:
name: cylc-run (${{ steps.uploadname.outputs.uploadname }})
path: ~/cylc-run/
- name: Shutdown
if: always()
run: |
etc/bin/swarm kill