-
Notifications
You must be signed in to change notification settings - Fork 326
90 lines (83 loc) · 3.16 KB
/
test-smokes-parallel.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
# 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: Parallel Smokes Tests
on:
workflow_dispatch:
inputs:
nBuckets:
description: "Number of buckets to split tests into"
required: true
default: 10
type: number
extra-r-packages:
description: "extra R package to install for the tests runs (like a dev version of one of the deps) - comma separated, passed to renv::install"
required: false
type: string
default: ""
pull_request:
branches:
- main
- "v[1-9].[0-9]+" # run also on released version branch (for patch releases)
paths-ignore:
- "src/resources/language/**"
push:
# only trigger on branches, not on tags
branches:
- main
- "v[1-9].[0-9]+" # run also on released version branch (for patch releases)
paths-ignore:
- "news/**"
concurrency:
# Use github.run_id on main branch
# Use github.event.pull_request.number on pull requests, so it's unique per pull request
# Use github.ref on other branches, so it's unique per branch
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
jobs-matrix:
runs-on: ubuntu-latest
outputs:
BUCKETS: ${{ steps.tests-buckets.outputs.BUCKETS }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: ${{ github.ref == 'refs/heads/main' && 'pre-release' || 'release' }}
- name: Create Job for tests
id: tests-buckets
run: |
BUCKETS=$(./run-parallel-tests.sh -n=${{ inputs.nBuckets || 20 }} --json-for-ci --timing-file=timing-for-ci.txt | jq -rc 'def lpad(n): tostring | if (n > length) then ((n - length) * "0") + . else . end; to_entries | map(.key |= tostring)| map({ num: .key| tonumber | (. + 1) | lpad(2), files: .value | tojson }) | {buckets: .}')
if [ -z $BUCKETS ]; then
echo "::error::Failed to create buckets. Something possibly wrong in run-parallel-tests.sh."
exit 1
fi
echo "BUCKETS=$BUCKETS" >> "$GITHUB_OUTPUT"
working-directory: tests
- name: Read buckets
run: |
echo ${{ steps.tests-buckets.outputs.BUCKETS }}
check-matrix:
runs-on: ubuntu-latest
needs: jobs-matrix
steps:
- name: Install json2yaml
run: |
sudo npm install -g json2yaml
- name: Check matrix definition
run: |
matrix='${{ needs.jobs-matrix.outputs.BUCKETS }}'
echo $matrix
echo $matrix | jq .
echo $matrix | json2yaml
run-smoke-tests:
needs: jobs-matrix
name: Running Tests buckets ${{ matrix.buckets.num }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.jobs-matrix.outputs.BUCKETS) }}
uses: ./.github/workflows/test-smokes.yml
with:
buckets: ${{ matrix.buckets.files }}
extra-r-packages: ${{ inputs.extra-r-packages }}