-
Notifications
You must be signed in to change notification settings - Fork 71
82 lines (63 loc) · 1.96 KB
/
_test-contrast.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
name: CI | A11y
on:
workflow_call:
inputs:
max-chunks:
required: false
type: number
default: 1
# concurrency:
# group: test-contrast-${{ github.ref }}
# cancel-in-progress: true
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
chunk-var: ${{ steps.generate-matrix.outputs.MATRIX }}
steps:
- id: generate-matrix
run: |
MATRIX=$(echo $(seq ${{ inputs.max-chunks }}) | sed 's/ /, /g')
MATRIX="[ $MATRIX ]"
echo $MATRIX
echo "MATRIX=$MATRIX" >> $GITHUB_OUTPUT
run-checks:
runs-on: ubuntu-latest
needs: [ prepare ]
strategy:
fail-fast: false
matrix:
chunk: ${{ fromJson(needs.prepare.outputs.chunk-var) }}
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Install virtual display on Linux
run: sudo apt-get install xvfb
- name: Setup node
id: setup-node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Use cache for root node_modules
id: cache-root-node_modules
uses: actions/cache@v4
with:
path: node_modules
key: root-node_modules-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('package-lock.json') }}
- name: Install
if: steps.cache-root-node_modules.outputs.cache-hit != 'true'
run: |
npm ci --no-audit --no-fund
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: .tmp
- name: Unpack artifacts
run: find .tmp -name "*.tar" -type f -exec tar -xf {} \;
- name: Test contrast (${{ matrix.chunk }} of ${{ matrix.max-chunks }})
run: xvfb-run --auto-servernum --server-args="-screen 0, 1366x768x24" npm run test-contrast
env:
MAX_CHUNKS: ${{ inputs.max-chunks }}
CURRENT_CHUNK: ${{ matrix.chunk }}
- name: Done
run: echo "Done!"