-
-
Notifications
You must be signed in to change notification settings - Fork 0
256 lines (211 loc) · 7.24 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
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
name: Tests
# Run when a new PR is created for main branch:
on:
pull_request:
branches:
- "main"
jobs:
# This can be used as the status check for branch protection, saves added each and every actual test job to the rules.
# https://github.com/marketplace/actions/alls-green
check_all_passed: # This job does nothing and is only used for the branch protection
if: always()
runs-on: ubuntu-latest
needs:
- qa
- tests_docs
- tests_python
- tests_js
- tests_py_rust
- tests_rust
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
id: all-green
with:
jobs: ${{ toJSON(needs) }}
# Everything but qa might be skipped if nothing's changed in its folder:
allowed-skips: tests_docs, tests_python, tests_js, tests_py_rust, tests_rust,
qa:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-python
with:
pdm: true
# Js project
- name: "Install Bun, no npm should be needed"
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install js dependencies
run: |
cd ./js
bun install
- uses: ./.github/actions/install-rust
with:
secret_config_toml: ${{ secrets.CUSTOM_RUST_CONFIG_TOML }}
qa: true
- uses: ./.github/actions/install-pre-commit
- name: Run QA
run: |
./dev_scripts/test.sh qa
whos_changed:
uses: ./.github/workflows/whos-changed.yml
tests_docs:
name: Test documentation build
needs: whos_changed
# Only run if applicable things have changed:
if: needs.whos_changed.outputs.docs-changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Basic python always needed:
- uses: ./.github/actions/install-python
with:
pdm: false
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: "3.12"
cache: true
cache-dependency-path: 'docs/pdm.lock'
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "20"
- uses: ./.github/actions/install-rust
with:
secret_config_toml: ${{ secrets.CUSTOM_RUST_CONFIG_TOML }}
qa: true
- name: Install dependencies
run: |
pdm sync -p ./docs
- name: Test docs
run: |
./dev_scripts/test.sh docs
tests_python:
needs: whos_changed
# Only run if applicable things have changed:
if: needs.whos_changed.outputs.py-changed == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Ubuntu test on all versions:
- {python: "3.11", os: "ubuntu-latest", coverage: false}
- {python: "3.12", os: "ubuntu-latest", coverage: true} # Only run coverage check on the newest version to save time
# Make sure other os types work on newest version:
# - { python: "3.12", os: "macOS-latest" } # Mac uses 10x minutes, skipping for now considering devs usually use mac and v similar to linux
- {python: "3.12", os: "windows-latest", coverage: false,} # 2x minutes, most different architecture so worth testing
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-redis
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python }}
cache: true
cache-dependency-path: 'py/pdm.lock'
- name: Install dependencies
run: |
pdm sync -p ./py -G:all
- name: Run tests (linux)
if: matrix.os == 'ubuntu-latest'
run: |
COVERAGE=${{ matrix.coverage }} ./dev_scripts/test.sh py
- name: Run tests (windows)
if: matrix.os == 'windows-latest'
run: |
$env:COVERAGE=${{ matrix.coverage }}
bash ./dev_scripts/test.sh py
tests_js:
needs: whos_changed
# Only run if applicable things have changed:
if: needs.whos_changed.outputs.js-changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-redis
# Js project
- name: "Install Bun, no npm should be needed"
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install js dependencies
run: |
cd ./js
bun install
- name: Run tests
run: |
./dev_scripts/test.sh js
tests_py_rust:
needs: whos_changed
# Only run if applicable things have changed:
if: needs.whos_changed.outputs.py-rust-changed == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Ubuntu test on all versions:
- {python: "3.11", os: "ubuntu-latest"}
- {python: "3.12", os: "ubuntu-latest"}
# Make sure other os types work on newest version:
# - { python: "3.12", os: "macOS-latest" } # Mac uses 10x minutes, skipping for now considering devs usually use mac and v similar to linux
- {python: "3.12", os: "windows-latest",} # 2x minutes, most different architecture so worth testing
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-redis
- uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python }}"
- uses: ./.github/actions/install-rust
with:
secret_config_toml: ${{ secrets.CUSTOM_RUST_CONFIG_TOML }}
test: true
- name: Setup venv (problems with the automatic creating in scripts as it uses pipx and for some
reason ends with wrong py version)
run: |
pip install virtualenv
python -m virtualenv ./py_rust/.venv
- name: Run tests (linux)
if: matrix.os == 'ubuntu-latest'
run: |
./dev_scripts/test.sh py_rust
- name: Run tests (windows)
if: matrix.os == 'windows-latest'
run: |
bash ./dev_scripts/test.sh py_rust
tests_rust:
needs: whos_changed
# Only run if applicable things have changed:
if: needs.whos_changed.outputs.rust-changed == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Run on both linux and windows (dev testing on mac and much more expensive in terms of build minutes),
# windows most likely to fail unexpectedly.
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-redis
# Basic python always needed:
- uses: ./.github/actions/install-python
with:
pdm: false
- uses: ./.github/actions/install-rust
with:
secret_config_toml: ${{ secrets.CUSTOM_RUST_CONFIG_TOML }}
test: true
- name: Run tests (linux)
if: matrix.os == 'ubuntu-latest'
run: |
./dev_scripts/test.sh rust --no-fail-fast
- name: Run tests (windows)
if: matrix.os == 'windows-latest'
run: |
bash ./dev_scripts/test.sh rust --no-fail-fast