Skip to content

Commit 86cfdca

Browse files
chore: update ci workflow to fix ci (#396)
1 parent d7116c5 commit 86cfdca

File tree

1 file changed

+48
-38
lines changed

1 file changed

+48
-38
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,62 +3,72 @@ name: ci
33
on: [push, pull_request]
44

55
jobs:
6+
should-skip:
7+
continue-on-error: true
8+
runs-on: ubuntu-latest
9+
# Map a step output to a job output
10+
outputs:
11+
should-skip-job: ${{steps.skip-check.outputs.should_skip}}
12+
steps:
13+
- id: skip-check
14+
uses: fkirc/[email protected]
15+
with:
16+
github_token: ${{github.token}}
17+
618
ci:
7-
env:
8-
BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
9-
BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
10-
runs-on: ${{ matrix.os }}
19+
needs: should-skip
20+
if: ${{needs.should-skip.outputs.should-skip-job != 'true' || github.ref == 'refs/heads/main'}}
1121
strategy:
12-
# TODO: test IE 11, Legacy Edge, and New Edge on windows-latest
13-
# test Safari on macos-latest
22+
fail-fast: false
1423
matrix:
1524
os: [ubuntu-latest]
16-
25+
test-type: ['unit']
26+
env:
27+
BROWSER_STACK_USERNAME: ${{secrets.BROWSER_STACK_USERNAME}}
28+
BROWSER_STACK_ACCESS_KEY: ${{secrets.BROWSER_STACK_ACCESS_KEY}}
29+
CI_TEST_TYPE: ${{matrix.test-type}}
30+
runs-on: ${{matrix.os}}
1731
steps:
18-
- uses: actions/checkout@v2
19-
- name: Cache dependencies
20-
uses: actions/cache@v2
21-
with:
22-
path: |
23-
~/.npm
24-
**/node_modules
25-
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
26-
restore-keys: |
27-
${{ runner.os }}-npm-
28-
${{ runner.os }}-
32+
- name: checkout code
33+
uses: actions/checkout@v2
2934

30-
- name: Read .nvmrc
35+
- name: read node version from .nvmrc
3136
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
3237
shell: bash
3338
id: nvm
3439

35-
- name: Install ffmpeg/pulseaudio for firefox on linux w/o browserstack
40+
- name: update apt cache on linux w/o browserstack
41+
run: sudo apt-get update
42+
43+
- name: install ffmpeg/pulseaudio for firefox on linux w/o browserstack
3644
run: sudo apt-get install ffmpeg pulseaudio
37-
if: ${{ startsWith(matrix.os, 'ubuntu') && !env.BROWSER_STACK_USERNAME }}
3845

3946
- name: start pulseaudio for firefox on linux w/o browserstack
4047
run: pulseaudio -D
41-
if: ${{ startsWith(matrix.os, 'ubuntu') && !env.BROWSER_STACK_USERNAME }}
4248

43-
- name: Setup node
44-
uses: actions/setup-node@v1
49+
- name: setup node
50+
uses: actions/setup-node@v2
4551
with:
46-
node-version: '${{ steps.nvm.outputs.NVMRC }}'
47-
- run: npm i --prefer-offline --no-audit
52+
node-version: '${{steps.nvm.outputs.NVMRC}}'
53+
cache: npm
4854

49-
# run safari on macos
50-
- name: Run Mac test
51-
run: npm run test -- --browsers Safari
52-
if: ${{ startsWith(matrix.os, 'macos') }}
55+
# turn off the default setup-node problem watchers...
56+
- run: echo "::remove-matcher owner=eslint-compact::"
57+
- run: echo "::remove-matcher owner=eslint-stylish::"
58+
- run: echo "::remove-matcher owner=tsc::"
5359

54-
# only run ie 11 on windows
55-
- name: Run Windows test
56-
run: npm run test -- --browsers IE
57-
if: ${{ startsWith(matrix.os, 'windows') }}
60+
- name: npm install
61+
run: npm i --prefer-offline --no-audit
5862

59-
# run chrome/firefox or browserstack in linux
60-
- name: Run linux test
63+
- name: run npm test
6164
uses: GabrielBB/xvfb-action@v1
6265
with:
63-
run: npm test
64-
if: ${{ startsWith(matrix.os, 'ubuntu') }}
66+
run: npm run test
67+
68+
- name: coverage
69+
uses: codecov/codecov-action@v1
70+
with:
71+
token: ${{secrets.CODECOV_TOKEN}}
72+
files: './test/dist/coverage/coverage-final.json'
73+
fail_ci_if_error: true
74+
if: ${{startsWith(env.CI_TEST_TYPE, 'coverage')}}

0 commit comments

Comments
 (0)