-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (149 loc) · 5.83 KB
/
test.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
name: Tests
on:
pull_request:
push:
branches: [main]
jobs:
unit:
runs-on: ubuntu-latest
steps:
- name: Checkout NodeCG
uses: actions/checkout@v3
with:
repository: ystv/nodecg
ref: ystv
path: ./nodecg
- uses: actions/checkout@v3
with:
path: ./nodecg/bundles/ystv-sports-graphics
- name: Get yarn cache directory path
id: yarn-cache-dir-path
working-directory: ./nodecg/bundles/ystv-sports-graphics
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock,**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
working-directory: ./nodecg/bundles/ystv-sports-graphics
run: yarn --immutable --inline-builds
- name: Run unit tests
run: nodecg/bundles/ystv-sports-graphics/scripts/test-unit.sh
- name: Upload coverage
uses: codecov/[email protected]
with:
root_dir: ./nodecg/bundles/ystv-sports-graphics
files: scores-src/src/common/coverage/clover.xml,scores-src/src/server/coverage/clover.xml,scores-src/src/client/coverage/clover.xml
gcov_ignore: ./nodecg/bundles/ystv-sports-graphics/.yarn
integration:
runs-on: ubuntu-latest
if: false # TODO: disabled due to flake
steps:
- name: Checkout NodeCG
uses: actions/checkout@v3
with:
repository: ystv/nodecg
ref: ystv
path: ./nodecg
- uses: actions/checkout@v3
with:
path: ./nodecg/bundles/ystv-sports-graphics
- name: Get yarn cache directory path
id: yarn-cache-dir-path
working-directory: ./nodecg/bundles/ystv-sports-graphics
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock,**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
working-directory: ./nodecg/bundles/ystv-sports-graphics
run: |
yarn --immutable --inline-builds
- name: Run integration tests
run: nodecg/bundles/ystv-sports-graphics/scripts/test-integration.sh
- name: Upload coverage
uses: codecov/[email protected]
with:
root_dir: ./nodecg/bundles/ystv-sports-graphics
files: scores-src/src/common/coverage/clover.xml,scores-src/src/server/coverage/clover.xml,scores-src/src/client/coverage/clover.xml
gcov_ignore: ./nodecg/bundles/ystv-sports-graphics/.yarn
- name: Upload logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: Server logs (Integration)
path: |
./nodecg/bundles/ystv-sports-graphics/test-server.log
e2e:
strategy:
matrix:
component: [bundle, scores]
runs-on: ubuntu-latest
steps:
- name: Checkout NodeCG
uses: actions/checkout@v3
with:
repository: ystv/nodecg
ref: ystv
path: ./nodecg
- name: Checkout
uses: actions/checkout@v3
with:
path: ./nodecg/bundles/ystv-sports-graphics
- name: Get yarn cache directory path
id: yarn-cache-dir-path
working-directory: ./nodecg/bundles/ystv-sports-graphics
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock,**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
working-directory: ./nodecg/bundles/ystv-sports-graphics
run: |
yarn --immutable --inline-builds
- name: Install NodeCG dependencies
if: matrix.component == 'bundle'
working-directory: ./nodecg
run: npm ci
- name: Start everything!
run: nodecg/bundles/ystv-sports-graphics/scripts/test-e2e.sh --setup-only ${{ matrix.component != 'bundle' && '--no-bundle' || '' }}
- name: Run Cypress
uses: cypress-io/github-action@v5
with:
browser: chrome
record: true
spec: ${{ matrix.component }}-src/**
working-directory: ./nodecg/bundles/ystv-sports-graphics
group: ${{ matrix.component }}
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# overwrite commit message sent to Cypress Cloud
COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}}
# re-enable PR comment bot
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}}
- name: Upload videos of failures
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: E2E test video
path: ./nodecg/bundles/ystv-sports-graphics/cypress/videos
- name: Upload logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: Server logs (E2E)
path: |
./nodecg/bundles/ystv-sports-graphics/test-server.log
./nodecg/bundles/ystv-sports-graphics/test-nodecg.log