-
Notifications
You must be signed in to change notification settings - Fork 331
306 lines (274 loc) · 11.2 KB
/
test-smokes.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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# Tests a broad set of Quarto functionality that users are likely to encounter.
# A failure indicates some signficant portion of functionality is likely to be broken.
name: Smoke Tests
on:
workflow_call:
inputs:
buckets:
description: "JSON string for buckets of tests to run in loop. Array of grouped tests."
required: true
type: string
time-test:
description: "Should we run tests to produce test file"
required: false
type: boolean
default: false
extra-r-packages:
description: "extra R package to install for the runs (like a dev version of one of the deps) - comma separated, passed to renv::install"
required: false
type: string
default: ""
workflow_dispatch:
inputs:
buckets:
description: "JSON string for buckets of tests to run in loop. Array of grouped tests."
required: false
type: string
default: ""
time-test:
description: "Should we run tests to produce test file"
required: false
type: boolean
default: false
extra-r-packages:
description: "extra R package to install for the runs (like a dev version of one of the deps) - comma separated, passed to renv::install"
required: false
type: string
default: ""
schedule:
- cron: "0 6 * * *"
jobs:
run-smokes:
name: Run smoke (${{ matrix.os }})${{ matrix.time-test && ' with timed file' || ''}}${{ inputs.extra-r-packages && ' - with some extra R packages'|| ''}}
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'quarto-dev/quarto-cli')
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
time-test:
- ${{ inputs.time-test }}
exclude:
# only run timed tests on Linux
- os: windows-latest
time-test: true
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Fix temp dir to use runner one (windows)
if: runner.os == 'Windows'
run: |
echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV
echo "TMP=${{ runner.temp }}" >> $GITHUB_ENV
echo "TEMP=${{ runner.temp }}" >> $GITHUB_ENV
shell: bash
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: "4.4.2"
use-public-rspm: true
# required to avoid rtools bin in path
windows-path-include-rtools: false
- name: Install node (for Playwright, MECA)
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install node dependencies
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
run: yarn
working-directory: ./tests/integration/playwright
shell: bash
- name: Install Playwright Browsers
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
run: npx playwright install --with-deps
working-directory: ./tests/integration/playwright
- name: Install MECA validator
if: ${{ runner.os != 'Windows' }}
run: npm install -g meca
- name: Set RENV_PATHS_ROOT
shell: bash
run: |
echo "RENV_PATHS_ROOT=${{ runner.temp }}/renv" >> $GITHUB_ENV
- name: Get R and OS version
id: get-version
run: |
cat("os-version=", sessionInfo()$running, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
cat("r-version=", R.Version()$version.string, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
shell: Rscript {0}
- name: Cache R packages
uses: actions/cache@v4
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-2-${{ hashFiles('tests/renv.lock') }}
restore-keys: |
${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-2-
save-always: ${{ inputs.extra-r-packages == '' }} # don't save cache if we have extra R packages
- name: Install missing system deps
if: runner.os == 'Linux'
run: |
sudo apt-get update -y
sudo apt-get install -y libcurl4-openssl-dev
sudo apt-get install -y libxml2-utils
sudo apt-get install -y libharfbuzz-dev libfribidi-dev
sudo apt-get install -y poppler-utils
- name: Restore R packages
working-directory: tests
run: |
if (!requireNamespace('renv', quietly = TRUE)) install.packages('renv')
renv::restore()
# Install dev versions for our testing
# Use r-universe to avoid github api calls
try(install.packages('rmarkdown', repos = c('https://rstudio.r-universe.dev', getOption('repos'))))
try(install.packages('knitr', repos = c('https://yihui.r-universe.dev', getOption('repos'))))
if ('${{ inputs.extra-r-packages }}' != '') {
cat(sprintf("::notice::Running with the following extra R packages for pak: %s\n", "${{ inputs.extra-r-packages }}"))
renv::install(strsplit("${{ inputs.extra-r-packages }}", split = ",")[[1]])
}
shell: Rscript {0}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Install uv for Python
uses: astral-sh/setup-uv@v3
with:
version: "0.5.9"
enable-cache: true
cache-dependency-glob: "tests/uv.lock"
- name: Install Python and Dependencies
working-directory: tests
run: |
uv sync --frozen
- uses: ./.github/workflows/actions/quarto-dev
- name: Install Tinytex
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
quarto install tinytex
- name: Cache Typst packages
id: cache-typst
uses: ./.github/actions/cache-typst
- name: Install Chrome
uses: browser-actions/setup-chrome@latest
- name: Setup Julia
uses: julia-actions/setup-julia@v2
with:
version: "1.11"
- name: Cache Julia Packages
uses: julia-actions/cache@v2
- name: Restore Julia Packages
working-directory: tests
shell: bash
run: |
# Setup IJulia with the jupyter from the Python environment
# https://julialang.github.io/IJulia.jl/stable/manual/installation/
export JUPYTER=$(find $(dirname $(uv run --frozen which jupyter))/ -type f -name "jupyter.exe" -o -name "jupyter")
uv run --frozen julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.build(\"IJulia\"); Pkg.precompile()"
echo "Julia Jupyter:"
uv run julia --project=. -e "import IJulia;println(IJulia.JUPYTER);println(IJulia.find_jupyter_subcommand(\"notebook\"))"
- name: Setup timing file for timed test
if: ${{ matrix.time-test == true }}
run: |
echo "QUARTO_TEST_TIMING=timing-for-ci.txt" >> "$GITHUB_ENV"
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Run all Smoke Tests Windows
if: ${{ runner.os == 'Windows' && format('{0}', inputs.buckets) == '' && matrix.time-test == false }}
env:
# Useful as TinyTeX latest release is checked in run-test.sh
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./run-tests.ps1
working-directory: tests
shell: pwsh
- name: Run all Smoke Tests Linux
if: ${{ runner.os != 'Windows' && format('{0}', inputs.buckets) == '' }}
env:
# Useful as TinyTeX latest release is checked in run-test.sh
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./run-tests.sh
working-directory: tests
shell: bash
- name: Run Smoke Tests as a bucket on Linux
if: ${{ runner.os != 'Windows' && format('{0}', inputs.buckets) != '' }}
env:
# Useful as TinyTeX latest release is checked in run-test.sh
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
QUARTO_LOG_LEVEL: DEBUG
run: |
haserror=0
readarray -t my_array < <(echo '${{ inputs.buckets }}' | jq -rc '.[]')
for file in "${my_array[@]}"; do
echo ">>> ./run-tests.sh ${file}"
./run-tests.sh $file
status=$?
[ $status -eq 0 ] && echo ">>> No error in this test file" || haserror=1
done
[ $haserror -eq 0 ] && echo ">>> All tests passed" || exit 1
working-directory: tests
shell: bash
- name: Run Smoke Tests as a bucket on Windows
if: ${{ runner.os == 'Windows' && format('{0}', inputs.buckets) != '' }}
env:
# Useful as TinyTeX latest release is checked in run-test.sh
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$haserror=$false
foreach ($file in ('${{ inputs.buckets }}' | ConvertFrom-Json)) {
Write-Host ">>> ./run-tests.ps1 ${file}"
./run-tests.ps1 $file
$status=$LASTEXITCODE
if ($status -eq 1) {
Write-Host ">>> Error found in test file"
$haserror=$true
} else {
Write-Host ">>> No error in this test file"
}
}
if ($haserror) {
Exit 1
} else {
Write-Host ">>> All tests have passed"
}
working-directory: tests
shell: pwsh
- name: Create Pull Request for new tests timing
if: matrix.time-test
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: tests/timing-for-ci.txt
commit-message: |
timing for new tests [auto PR]
branch: updates/timing-for-ci
delete-branch: true
assignees: cderv
reviewers: cderv
title: |
[CI] Update timing file
body: |
This PR was created automatically with new timing test file for our parallel smoke tests.
Please review and merge to trigger a new build of the website.
- name: Check auto PR outputs
if: steps.cpr.outcome == 'success'
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
echo "Pull Request Action Performed - ${{ steps.cpr.outputs.pull-request-operation }}"
- name: Upload test timing file
uses: actions/upload-artifact@v4
if: matrix.time-test && ( failure() || cancelled())
with:
name: timed test file
path: tests/timing-for-ci.txt
- name: Save Typst cache
if: always()
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-typst.outputs.cache-primary-key }}
path: ${{ steps.cache-typst.outputs.cache-path }}
- uses: actions/upload-artifact@v4
# PLaywright test only runs on Linux for now
if: ${{ !cancelled() && runner.os != 'Windows' }}
with:
name: playwright-report
path: ./tests/integration/playwright/playwright-report/
retention-days: 30