forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (71 loc) · 2.4 KB
/
test-chunk.yml
File metadata and controls
79 lines (71 loc) · 2.4 KB
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
name: Test chunk
on:
workflow_call:
inputs:
serialize:
required: false
type: boolean
cmd:
required: true
type: string
chunk-no:
required: true
type: number
wdir:
required: true
type: string
outputs:
wdir:
description: "Cache key for the working directory after running tests"
value: test-${{ inputs.cmd }}-${{ inputs.chunk-no }}-${{ github.run_id }}
secrets:
BROWSERSTACK_USER_NAME:
description: "Browserstack user name"
BROWSERSTACK_ACCESS_KEY:
description: "Browserstack access key"
concurrency:
# The following generates 'browserstack-<run_id>' when inputs.serialize is true, and a hopefully unique ID otherwise
# Ideally we'd like to serialize browserstack access across all workflows, but github's max queue length is only 1
# (cfr. https://github.com/orgs/community/discussions/12835)
# so we add the run_id to serialize only within one push / pull request (which has the effect of queueing e2e and unit tests)
group: ${{ inputs.serialize && 'browser' || github.run_id }}${{ inputs.serialize && 'stack' || inputs.cmd }}-${{ github.run_id }}
cancel-in-progress: false
jobs:
test:
name: "Test chunk ${{ inputs.chunk-no }}"
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USER_NAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
TEST_CHUNKS: 4
TEST_CHUNK: ${{ inputs.chunk-no }}
runs-on: ubuntu-latest
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Restore working directory
id: restore-dir
uses: actions/cache/restore@v4
with:
path: .
key: ${{ inputs.wdir }}
fail-on-cache-miss: true
- name: Run tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 8
max_attempts: 3
command: ${{ inputs.cmd }}
- name: Save working directory
uses: actions/cache/save@v4
with:
path: .
key: test-${{ inputs.cmd }}-${{ inputs.chunk-no }}-${{ github.run_id }}
- name: Verify cache
uses: actions/cache/restore@v4
with:
path: .
key: test-${{ inputs.cmd }}-${{ inputs.chunk-no }}-${{ github.run_id }}
lookup-only: true
fail-on-cache-miss: true