This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (85 loc) · 2.93 KB
/
cypress-tests.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
name: End-to-end tests
on:
push:
branches: [ development ]
pull_request:
branches: [development]
paths:
- 'client/src/**'
- 'server/src/**'
- '!server/src/generated/**'
jobs:
cypress-run:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['16.19.1']
mongodb-version: ['6.0']
# Cypress Docker image with Chrome v100
# and Firefox v98 pre-installed
# container: cypress/browsers:node14.17.6-chrome100-ff98
env:
# prevents extra Cypress installation progress messages
CI: 1
# avoid warnings like "tput: No value for $TERM and no -T specified"
TERM: xterm
steps:
# Starts a MongoDB server using custom port and credentials
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.8.0
with:
mongodb-port: 27018
mongodb-username: root
mongodb-password: secret
mongodb-db: grapevine-db
mongodb-version: ${{ matrix.mongodb-version }}
# Downloads a copy of the code in your repository before running CI tests
- name: Checkout
uses: actions/checkout@v2
# Pick the Node version to use and install it
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# Install NPM dependencies but SKIP Cypress binary installation
- name: Install dependencies
uses: bahmutov/npm-install@v1
with:
working-directory: |
./
client
server
env:
CYPRESS_INSTALL_BINARY: 0
ACTIONS_RUNNER_DEBUG: true
ACTIONS_STEP_DEBUG: true
# Install system required dependencies
- run: sudo apt-get install -y xvfb
# confirm there is no Cypress installed
- run: npx cypress cache path
# should return empty list of installed versions
- run: npx cypress cache list
# restore / cache the binary ourselves on Linux
# see https://github.com/actions/cache
- name: Cache Cypress
id: cache-cypress
uses: actions/cache@v1
with:
path: ~/.cache/Cypress
key: cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }}
# now let's install Cypress binary
- run: npx cypress install
- run: npx cypress cache list
# and run Cypress tests
- run: npm run test:e2e:run
# Cypress binary will be cached after successful workflow finish
env:
AUTH_USER: root
AUTH_PASS: secret
DB_NAME: grapevine-db
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# uses the debug module to output additional verbose logs
DEBUG: '@cypress/github-action'