forked from 3liz/lizmap-web-client
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (81 loc) · 2.83 KB
/
e2e_tests_cypress.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
name: "🎳 Cypress"
on:
pull_request:
types: [ labeled, opened, synchronize, reopened ]
branches:
- master
- release_3_*
schedule:
# Run every monday at 3:00
- cron: '0 3 * * 1'
workflow_dispatch:
jobs:
cypress:
# The first condition is triggered when we set the new label
# The second one when we update the PR with new commits without changing labels
# The third one when it's a cron job
# The fourth one is for the manual button
if: |
github.event.label.name == 'run cypress' ||
contains(github.event.pull_request.labels.*.name, 'run cypress') ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
name: "End-to-end"
runs-on: ubuntu-latest
env:
CYPRESS_CI: TRUE
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/} with ${CYPRESS_CI}
- name: Install Lizmap as a QGIS Server plugin
run: cd tests && ./add_server_plugins.sh
- name: Pull docker images
run: cd tests && ./run-docker pull
# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
- name: Build and start docker images
run: cd tests && ./run-docker up --build -d
- name: Wait docker images ready and install Lizmap
run: cd tests && sleep 30 && ./lizmap-ctl install
- name: Load SQL data
run: cd tests/qgis-projects/tests && ./load_sql.sh
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: cypress-io/github-action@v2
with:
browser: chrome
headless: true
working-directory: tests/end2end
spec: cypress/integration/*-ghaction.js
wait-on: http://localhost:8130
- name: Save screenshots as artifacts if a test fails to ease debug
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: |
tests/end2end/cypress/screenshots
tests/end2end/cypress/downloads
- name: Display Lizmap errors.log and fail if not empty
run: |
if [ -s "lizmap/var/log/errors.log" ]; then
echo "errors.log not empty!";
cat lizmap/var/log/errors.log;
exit -1;
fi
# debug:
# name: "Debug"
# runs-on: ubuntu-latest
# steps:
# - name: Dump GitHub context
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: |
# echo "$GITHUB_CONTEXT"