Skip to content

Commit

Permalink
chore: update ci workflow to fix ci (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey committed Aug 24, 2021
1 parent d7116c5 commit 86cfdca
Showing 1 changed file with 48 additions and 38 deletions.
86 changes: 48 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,72 @@ name: ci
on: [push, pull_request]

jobs:
should-skip:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should-skip-job: ${{steps.skip-check.outputs.should_skip}}
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@v2.1.0
with:
github_token: ${{github.token}}

ci:
env:
BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
runs-on: ${{ matrix.os }}
needs: should-skip
if: ${{needs.should-skip.outputs.should-skip-job != 'true' || github.ref == 'refs/heads/main'}}
strategy:
# TODO: test IE 11, Legacy Edge, and New Edge on windows-latest
# test Safari on macos-latest
fail-fast: false
matrix:
os: [ubuntu-latest]

test-type: ['unit']
env:
BROWSER_STACK_USERNAME: ${{secrets.BROWSER_STACK_USERNAME}}
BROWSER_STACK_ACCESS_KEY: ${{secrets.BROWSER_STACK_ACCESS_KEY}}
CI_TEST_TYPE: ${{matrix.test-type}}
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
~/.npm
**/node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
${{ runner.os }}-
- name: checkout code
uses: actions/checkout@v2

- name: Read .nvmrc
- name: read node version from .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
shell: bash
id: nvm

- name: Install ffmpeg/pulseaudio for firefox on linux w/o browserstack
- name: update apt cache on linux w/o browserstack
run: sudo apt-get update

- name: install ffmpeg/pulseaudio for firefox on linux w/o browserstack
run: sudo apt-get install ffmpeg pulseaudio
if: ${{ startsWith(matrix.os, 'ubuntu') && !env.BROWSER_STACK_USERNAME }}

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

- name: Setup node
uses: actions/setup-node@v1
- name: setup node
uses: actions/setup-node@v2
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- run: npm i --prefer-offline --no-audit
node-version: '${{steps.nvm.outputs.NVMRC}}'
cache: npm

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

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

# run chrome/firefox or browserstack in linux
- name: Run linux test
- name: run npm test
uses: GabrielBB/xvfb-action@v1
with:
run: npm test
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: npm run test

- name: coverage
uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}
files: './test/dist/coverage/coverage-final.json'
fail_ci_if_error: true
if: ${{startsWith(env.CI_TEST_TYPE, 'coverage')}}

0 comments on commit 86cfdca

Please sign in to comment.