forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (103 loc) · 3.16 KB
/
Copy pathrun-unit-tests.yml
File metadata and controls
109 lines (103 loc) · 3.16 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
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
name: Run unit tests
on:
workflow_call:
inputs:
build-cmd:
description: Build command, run once
required: true
type: string
test-cmd:
description: Test command, run once per chunk
required: true
type: string
serialize:
description: If true, allow only one concurrent chunk (see note on concurrency below)
required: false
type: boolean
outputs:
wdir:
description: Cache key for the working directory after running tests
value: ${{ jobs.chunk-4.outputs.wdir }}
secrets:
BROWSERSTACK_USER_NAME:
description: "Browserstack user name"
BROWSERSTACK_ACCESS_KEY:
description: "Browserstack access key"
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Fetch source
uses: actions/cache/restore@v4
with:
path: .
key: source-${{ github.run_id }}
fail-on-cache-miss: true
- name: Build
run: ${{ inputs.build-cmd }}
- name: Cache build output
uses: actions/cache/save@v4
with:
path: .
key: build-${{ inputs.build-cmd }}-${{ github.run_id }}
- name: Verify cache
uses: actions/cache/restore@v4
with:
path: .
key: build-${{ inputs.build-cmd }}-${{ github.run_id }}
lookup-only: true
fail-on-cache-miss: true
chunk-1:
needs: build
name: Run tests (chunk 1 of 4)
uses: ./.github/workflows/test-chunk.yml
with:
chunk-no: 1
wdir: build-${{ inputs.build-cmd }}-${{ github.run_id }}
cmd: ${{ inputs.test-cmd }}
serialize: ${{ inputs.serialize }}
secrets:
BROWSERSTACK_USER_NAME: ${{ secrets.BROWSERSTACK_USER_NAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
chunk-2:
name: Run tests (chunk 2 of 4)
needs: chunk-1
uses: ./.github/workflows/test-chunk.yml
with:
chunk-no: 2
wdir: ${{ needs.chunk-1.outputs.wdir }}
cmd: ${{ inputs.test-cmd }}
serialize: ${{ inputs.serialize }}
secrets:
BROWSERSTACK_USER_NAME: ${{ secrets.BROWSERSTACK_USER_NAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
chunk-3:
name: Run tests (chunk 3 of 4)
needs: chunk-2
uses: ./.github/workflows/test-chunk.yml
with:
chunk-no: 3
wdir: ${{ needs.chunk-2.outputs.wdir }}
cmd: ${{ inputs.test-cmd }}
serialize: ${{ inputs.serialize }}
secrets:
BROWSERSTACK_USER_NAME: ${{ secrets.BROWSERSTACK_USER_NAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
chunk-4:
name: Run tests (chunk 4 of 4)
needs: chunk-3
uses: ./.github/workflows/test-chunk.yml
with:
chunk-no: 4
wdir: ${{ needs.chunk-3.outputs.wdir }}
cmd: ${{ inputs.test-cmd }}
serialize: ${{ inputs.serialize }}
secrets:
BROWSERSTACK_USER_NAME: ${{ secrets.BROWSERSTACK_USER_NAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}