Fix CI #157
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Swag Labs Sample App Workflow | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./ | |
env: | |
BUILD_PREFIX: true | |
IS_MAIN: ${{ github.ref == 'refs/heads/main' }} | |
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | |
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} | |
SCREENER_API_KEY: ${{ secrets.SCREENER_API_KEY }} | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# Site Testing steps | |
- name: Install dependencies | |
run: npm install | |
- name: Run Unit Tests and generate coverage report | |
run: npm run test.coverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# Only run the last 2 steps when we are not on the main branch | |
- name: Run Storybook tests | |
if: ${{ !env.IS_MAIN }} | |
run: npm run test.storybook.ci | |
- name: Build and E2E test the site | |
if: ${{ !env.IS_MAIN }} | |
run: npm run start & npx wait-on --timeout 60000 http://localhost:3000 && npm run test.e2e.sauce.us |