-
Notifications
You must be signed in to change notification settings - Fork 4
140 lines (115 loc) · 4.07 KB
/
build-and-test.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request events
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
linters:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Set node version
strategy:
matrix:
node-version: [12.17.0]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: npm ci
- name: pass linters
run: npm run lint
unit-test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Set node version
strategy:
matrix:
node-version: [12.17.0]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: npm ci
- name: pass unit test
run: npm run test
e2e-test:
# The type of runner that the job will run on
#
# NOTE: we don't use ubuntu-latest because this (https://github.com/cypress-io/github-action#important)
# We are getting reports that Cypress has suddenly started crashing when running on ubuntu-latest OS.
# Seems, GH Actions have switched from 16.04 to 18.04 overnight, and are having a xvfb issue. Please
# work around this problem by using runs-on: ubuntu-16.04 image or upgrading to Cypress v3.8.3 where
# we explicitly set XVFB arguments.
runs-on: ubuntu-16.04
# Set node version
strategy:
matrix:
node-version: [12.17.0]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: npm ci
- name: Cypress run
uses: cypress-io/github-action@v1
with:
start: npm start -- -c test
wait-on: 'http://localhost:4200'
wait-on-timeout: 200
# after the test run completes
# store videos and any screenshots
# NOTE: screenshots will be generated only if E2E test failed
# thus we store screenshots only on failures
# Alternative: create and commit an empty cypress/screenshots folder
# to always have something to upload
- uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
# Test run video was always captured, so this action uses "always()" condition
- uses: actions/upload-artifact@v1
if: always()
with:
name: cypress-videos
path: cypress/videos