-
Notifications
You must be signed in to change notification settings - Fork 41
57 lines (46 loc) · 1.59 KB
/
sample-app-web.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
# 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