-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (80 loc) · 2.82 KB
/
build_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
# This workflow will do a clean installation of node dependencies, cache/restore them, 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: Build & test
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
# ========== BUILD APP ========== #
build_lint_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
task: [run lint, test]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: Run ${{ matrix.task }}
run: npm ${{ matrix.task }}
# ========== E2E TESTING ========== #
cypress_e2e_tests:
runs-on: ubuntu-latest
container:
image: cypress/browsers:node16.5.0-chrome94-ff93
options: --user 1001
strategy:
# when one test fails, DO NOT cancel the other containers, because this will kill Cypress processes
# leaving the Dashboard hanging... https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# Containers to run copies of the job in parallel.
containers: [1, 2, 3]
browsers: [firefox, chrome]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Cypress run
uses: cypress-io/github-action@v4
with:
browser: ${{ matrix.browser }}
record: true
parallel: true
build: npm run build
start: npm start
wait-on: 'http://localhost:3000/suivie'
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# overwrite commit message sent to Dashboard
COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}}
# re-enable PR comment bot
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}}