forked from cylc/cylc-uiserver
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (126 loc) · 4.04 KB
/
Copy pathtest.yml
File metadata and controls
150 lines (126 loc) · 4.04 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
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
name: Test
on:
pull_request:
workflow_dispatch:
push:
branches:
- master
- '*.*.x'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 2
defaults:
run:
shell: bash -c "exec $CONDA_PREFIX/bin/bash -elo pipefail {0}"
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: ['3.12', '3']
include:
- os: 'macos-latest'
python-version: '3.12' # oldest supported
env:
PYTEST_ADDOPTS: --cov --color=yes
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Patch DNS
uses: cylc/release-actions/patch-dns@v1
- name: Install System Dependencies
uses: mamba-org/setup-micromamba@v3
with:
cache-environment: true
post-cleanup: 'all'
environment-name: cylc-uiserver
create-args: >-
python=${{ matrix.python-version }}
pip
bash
coreutils
- name: install cylc-flow
uses: cylc/release-actions/install-cylc-components@v1
with:
cylc_flow: true
cylc_flow_opts: ''
# Required for coverage collection
editable_installations: true
- name: install cylc-uiserver
run: |
pip install -e .[all]
- name: Style test
if: startsWith(matrix.os, 'ubuntu')
run: flake8
- name: Type checking
if: startsWith(matrix.os, 'ubuntu')
run: mypy
- name: Check changelog
uses: cylc/release-actions/towncrier-draft@v1
- name: Test
run: pytest
- name: Cylc Review tests
id: review_tests
run: |
CONF_PATH="$HOME/.cylc/flow/8"
mkdir -p "$CONF_PATH"
touch "$CONF_PATH/global.cylc"
ln -s "$CONF_PATH/global.cylc" "$CONF_PATH/global-tests.cylc"
cat >> "$CONF_PATH/global.cylc" <<__HERE__
[platforms]
[[_local_background_shared_tcp]]
hosts = localhost
install target = localhost
ssh command = ssh -oBatchMode=yes -oConnectTimeout=8 -oStrictHostKeyChecking=no
__HERE__
# Check that Cylc Review is installed!
# (We're only interested if it emits an error):
cylc review --help > /dev/null || exit 1
# Run tests on Cylc Review
export CYLC_COVERAGE=1
export CYLC_COVERAGE_BASE=$PWD
./etc/bin/run-functional-tests
- name: Debug
if: failure() && steps.review_tests.outcome == 'failure'
timeout-minutes: 1
run: |
find "$HOME/cylc-run" -name '*.err' -type f \
-exec echo \; -exec echo '====== {} ======' \; -exec cat '{}' \;
find "$HOME/cylc-run" -name '*.log' -type f \
-exec echo \; -exec echo '====== {} ======' \; -exec cat '{}' \;
find "${TMPDIR:-/tmp}/${USER}/cylctb-"* -type f \
-exec echo \; -exec echo '====== {} ======' \; -exec cat '{}' \;
- name: Coverage report
run: |
coverage combine .
coverage xml --ignore-errors
coverage report
- name: Upload coverage artifact
uses: actions/upload-artifact@v7
with:
name: coverage_${{ matrix.os }}_py-${{ matrix.python-version }}
path: coverage.xml
retention-days: 4
codecov:
needs: test
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download coverage artifacts
uses: actions/download-artifact@v8
- name: Codecov upload
uses: codecov/codecov-action@v5
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 }}