-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (101 loc) · 3.72 KB
/
e2e.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
name: e2e
on:
push:
branches:
# Disable for now. I'll run e2e before push.
- e2e_disabled
jobs:
#-----------------------------------------
# e2e test
#-----------------------------------------
e2e:
runs-on: ubuntu-18.04
container:
image: cypress/browsers:node14.15.0-chrome86-ff82
options: --user 1001 --shm-size=2g
#needs: build
name: e2e test
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres-service:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
# use postgres for the host here because we have specified a container for the job.
# If we were running the job on the VM this would be localhost
POSTGRES_HOST: postgres
# Set health checks to wait until postgres has started
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
# Maps tcp port 5432 on service container to the host
ports: ["5432:5432"]
strategy:
fail-fast: false
matrix:
# browser: chrome
# browser: [ chrome, firefox ]
containers: [1, 2, 3]
# Run e2e only on develop
# FIXME: if: github.ref == 'refs/heads/e2e' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
# CRA "Bug" : https://github.com/facebook/create-react-app/issues/7612
# - name: Fixing known bug
# run: echo "fs.inotify.max_user_watches=524288" >> /etc/sysctl.conf
# e2e
# https://medium.com/swlh/publish-your-cypress-test-report-with-github-actions-47248788713a
# https://github.com/bahmutov/cypress-gh-action-example/tree/master/.github/workflows
- name: e2e
uses: cypress-io/github-action@v2
with:
working-directory: /home/runner/work/calcetto/calcetto
# Start server and wait for response
start: npm run test:app:server , npm run test:app:client
wait-on: 'http://localhost:5000 , http://localhost:5001'
# Test options
# config: baseUrl=http://localhost:5001
# browser: ${{ matrix.browser }}
browser: chrome
# FIXME: check code coverage
parallel: true
group: 'e2e_${{ matrix.browser }}'
headless: true
record: true
env:
# DEBUG: cypress:webpack
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_ENV: test
DATABASE_URL: 'postgresql://postgres:password@postgres-service:5432/postgres'
DATABASE_SCHEMA: test_${{ matrix.browser }}_${{ matrix.containers }}
IS_DOCKER: true
# if tests fails save screenshots
- name: Save screenshots on failure
uses: actions/upload-artifact@v2.2.2
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
# if tests success save videos and coverage
- name: Save videos
uses: actions/upload-artifact@v2.2.2
if: always()
with:
name: cypress-videos
path: cypress/videos
# TODO: e2e coverage
- name: Save Coverage
if: ${{ success() }}
uses: actions/upload-artifact@v2.2.2
with:
name: coverage-cypress
path: |
coverage
# if tests success save videos and coverage
# - name: Merge coverage from different processes
# if tests success save videos and coverage
# - name: Save e2e-coverage