Skip to content

Commit 34643e4

Browse files
authored
Run browser tests on forked PRs by a dedicated label (#4616)
* ci: don't run browser tests on forked PRs * ci: browser tests workflow for forked PRs * ci: remove the label after running browser test * ci: fyx typos and remove commnets
1 parent 8a2da76 commit 34643e4

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.github/workflows/browser-test.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Browser Tests for forked PRs
2+
'on':
3+
pull_request_target:
4+
types:
5+
- labeled
6+
7+
jobs:
8+
test-browser:
9+
# TODO: configure to retain build artifacts in `.karma/` dir
10+
name: 'Browser Tests'
11+
timeout-minutes: 20
12+
runs-on: ubuntu-latest
13+
if: contains(github.event.pull_request.labels.*.name, 'run-browser-test')
14+
steps:
15+
- uses: actions/setup-node@v2
16+
with:
17+
node-version: 14
18+
- uses: actions/checkout@v2
19+
with:
20+
ref: ${{ github.event.pull_request.head.sha }}
21+
- name: 'Cache node_modules'
22+
uses: actions/cache@v2
23+
with:
24+
path: '~/.npm'
25+
key: "ubuntu-latest-node-full-v14-${{ hashFiles('**/package-lock.json') }}"
26+
restore-keys: |
27+
ubuntu-latest-node-full-v14-
28+
- name: Install Dependencies
29+
run: npm ci
30+
- name: Run Browser Tests
31+
run: npm start test.browser
32+
env:
33+
SAUCE_USERNAME: '${{secrets.SAUCE_USERNAME}}'
34+
SAUCE_ACCESS_KEY: '${{secrets.SAUCE_ACCESS_KEY}}'
35+
- name: remove 'run-browser-test' label
36+
uses: buildsville/add-remove-label@v1
37+
if: ${{ always() }}
38+
with:
39+
token: ${{secrets.GITHUB_TOKEN}}
40+
label: run-browser-test
41+
type: remove

.github/workflows/mocha.yml

+2
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ jobs:
174174
needs: smoke
175175
timeout-minutes: 20
176176
runs-on: ubuntu-latest
177+
# Run 'push' event only because of sauce labs token
178+
if: github.event_name == 'push'
177179
steps:
178180
- uses: actions/setup-node@v2
179181
with:

0 commit comments

Comments
 (0)