-
Notifications
You must be signed in to change notification settings - Fork 42
230 lines (177 loc) · 5.27 KB
/
test.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
# Workflow for running linting, tests, and other checks
#
# Detects where file changes occur so that the main Rust-based job
# (which takes up to 30 mins) is only run when there are related changes
# (and not when the `web` module changes for example).
#
# Tries to take a fail fast approach : dependency audits, linting etc,
# (which are faster), are run before tests (which are slower, particularly
# for Rust-based modules including the Node and Pythn SDKs).
name: Test
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
RUST_VERSION: "1.76.0"
CARGO_TERM_COLOR: always
NODE_VERSION: "20"
PYTHON_VERSION: "3.11"
jobs:
# Detect which folders have changes
changes:
runs-on: ubuntu-latest
outputs:
main: ${{ steps.changes.outputs.main }}
ts: ${{ steps.changes.outputs.ts }}
web: ${{ steps.changes.outputs.web }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Detect changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
main:
- 'node/**'
- 'python/**'
- 'rust/**'
ts:
- 'ts/**'
- 'package.json'
vscode:
- 'vscode/**'
web:
- 'web/**'
- 'package.json'
main:
runs-on: ubuntu-latest-m
needs: changes
if: needs.changes.outputs.main == 'true'
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
# Skip because on `ubuntu-latest-m` seems to be detrimental
if: false
with:
root-reserve-mb: "4096"
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy,rustfmt,llvm-tools
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Install onnxruntime.so
run: ./scripts/install-onnxruntime.sh
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup Python dev dependencies
run: pip install pdm ruff pyright
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Setup Chrome
uses: browser-actions/setup-chrome@v1
- run: which chrome
- name: Show disk usage
run: df -h && du -hd1
- name: Install dependencies
run: make install
- name: Run dependency audits
run: make audit
- name: Run package publishing checks
run: make pubcheck
- name: Run linting
run: make lint
- name: Run tests with coverage
run: make cover
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
verbose: true
- name: Run accessibility checks
run: make a11y
- name: Make generated files
run: make generated
- name: Pull branch before commit
if: github.ref == 'refs/heads/main'
run: git pull origin main
- name: Commit generated files
if: github.ref == 'refs/heads/main'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(*): update generated files"
- name: Show disk usage
run: df -h && du -hd1
ts:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.ts == 'true'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install dependencies
run: make -C ts install
- name: Run dependency audit and publishing checks
run: make -C ts audit pubcheck
- name: Run linting
run: make -C ts lint
- name: Run tests
run: make -C ts test
vscode:
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
needs: changes
if: needs.changes.outputs.vscode == 'true'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: make -C vscode install
- name: Lint
run: make -C vscode lint
- name: Test
run: make -C vscode test
if: runner.os != 'Linux'
- name: Test with xvfb
run: xvfb-run -a make -C vscode test
if: runner.os == 'Linux'
web:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.web == 'true'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install dependencies
run: make -C web install
- name: Run dependency audit
run: make -C web audit
- name: Run linting
run: make -C web lint
- name: Run tests
run: make -C web test