Debian Codegraph @

.github/workflows/test_fast.yml

raw
1 name: fast tests
2
3 on:
4 pull_request:
5 workflow_dispatch:
6 push:
7 branches:
8 - master
9 - '8.*.x'
10
11 concurrency:
12 group: ${{ github.workflow }}-${{ github.ref }}
13 cancel-in-progress: true
14
15 defaults:
16 run:
17 shell: bash -c "exec $CONDA_PREFIX/bin/bash -elo pipefail {0}"
18
19 env:
20 PIP_PROGRESS_BAR: off
21
22 jobs:
23 test:
24 runs-on: ${{ matrix.os }}
25 timeout-minutes: 20
26 strategy:
27 fail-fast: false # don't stop on first failure
28 matrix:
29 os: ['ubuntu-latest']
30 python-version: ['3.12', '3']
31 include:
32 - os: 'macos-latest'
33 python-version: '3.12' # oldest version we support
34 # non-utc timezone test
35 - os: 'ubuntu-latest'
36 python-version: '3'
37 time-zone: 'XXX-09:35'
38 env:
39 TZ: ${{ matrix.time-zone }}
40 PYTEST_ADDOPTS: --cov --cov-append -n 5 --color=yes
41 steps:
42 - name: Checkout
43 uses: actions/checkout@v5
44
45 - name: Install System Dependencies
46 uses: mamba-org/setup-micromamba@v2
47 with:
48 cache-environment: true
49 post-cleanup: 'all'
50 environment-name: cylc-fast-test
51 create-args: >-
52 python=${{ matrix.python-version }}
53 pip
54 bash
55 subversion
56 sqlite
57 graphviz
58
59 - name: Install Python Dependencies
60 run: |
61 pip install -e ."[all]"
62
63 - name: Patch DNS
64 uses: cylc/release-actions/patch-dns@v1
65
66 - name: Configure git # Needed by the odd test
67 uses: cylc/release-actions/configure-git@v1
68
69 # Useful debug info:
70 - name: Pip list
71 run: pip list
72
73 - name: Unit Tests
74 timeout-minutes: 5
75 run: |
76 pytest cylc/flow tests/unit
77
78 - name: Integration Tests
79 timeout-minutes: 5
80 run: |
81 pytest tests/integration --ignore tests/integration/tui/
82
83 - name: Tui Integration Tests
84 timeout-minutes: 5
85 # Re-run failed Tui tests as they can be flaky
86 run: |
87 pytest tests/integration/tui || pytest tests/integration/tui --last-failed
88
89 - name: Upload failed tests artifact
90 if: failure()
91 uses: actions/upload-artifact@v4
92 with:
93 name: cylc-run (${{ matrix.os }} py-${{ matrix.python-version }})
94 path: ~/cylc-run/
95 include-hidden-files: true
96
97 - name: Coverage report
98 run: |
99 coverage xml
100 coverage report
101
102 - name: Upload coverage artifact
103 uses: actions/upload-artifact@v4
104 with:
105 name: coverage_${{ matrix.os }}_py-${{ matrix.python-version }}
106 path: coverage.xml
107 retention-days: 7
108
109 lint:
110 runs-on: 'ubuntu-latest'
111 timeout-minutes: 10
112 strategy:
113 matrix:
114 python-version: ['3']
115 env:
116 FORCE_COLOR: 2
117 steps:
118 - name: Checkout
119 uses: actions/checkout@v5
120
121 - name: Install System Dependencies
122 uses: mamba-org/setup-micromamba@v2
123 with:
124 cache-environment: true
125 post-cleanup: 'all'
126 environment-name: cylc-lint-test
127 create-args: >-
128 python=${{ matrix.python-version }}
129 pip
130 bash
131 shellcheck
132
133 - name: Install Python Dependencies
134 run: |
135 pip install -e ."[tests]"
136
137 - name: Flake8
138 run: flake8
139
140 - name: Bandit
141 run: |
142 bandit -r --ini .bandit cylc/flow
143
144 - name: Shellchecker
145 run: etc/bin/shellchecker
146
147 - name: MyPy
148 run: mypy
149
150 - name: Towncrier - draft changelog
151 uses: cylc/release-actions/towncrier-draft@v1
152
153 - name: Linkcheck
154 env:
155 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156 run: pytest -m linkcheck -ra --dist=load --color=yes -n 10 tests/unit/test_links.py
157
158 codecov:
159 needs: test
160 runs-on: ubuntu-latest
161 timeout-minutes: 2
162 steps:
163 - name: Checkout
164 uses: actions/checkout@v5
165
166 - name: Download coverage artifacts
167 uses: actions/download-artifact@v5
168
169 - name: Codecov upload
170 uses: codecov/codecov-action@v5
171 with:
172 name: ${{ github.workflow }}
173 flags: fast-tests
174 fail_ci_if_error: true
175 verbose: true
176 # Token not required for public repos, but avoids upload failure due
177 # to rate-limiting (but not for PRs opened from forks)
178 token: ${{ secrets.CODECOV_TOKEN }}