-
Notifications
You must be signed in to change notification settings - Fork 7
164 lines (141 loc) · 5.35 KB
/
application_e2e_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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Application E2E Tests
on:
workflow_run:
workflows:
- "Application Build"
types:
- completed
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
jobs:
e2e_test:
name: Run E2E tests
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04
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:
# Run 10 copies of the current job in parallel
containers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
CYPRESS_PROJECT_ID: ${{ secrets.PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUPPETEER_SKIP_DOWNLOAD: "true"
VITE_CYPRESS_PORT: 8880
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_commit.id }}
- name: Set version and environment profile
uses: ./.github/actions/set-version-and-environment-profile
- name: Set MONITORFISH_VERSION environment variable
run: echo "MONITORFISH_VERSION=${VERSION}" >> $GITHUB_ENV
- name: Download image
uses: ishworkh/container-image-artifact-download@v1.0.0
with:
commit_sha: ${{ github.event.workflow_run.head_commit.id }}
image: monitorfish-app:${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
workflow: "Application Build"
- name: Run docker images
run: make docker-compose-up
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: ./frontend/package-lock.json
node-version: 20
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
with:
firefox-version: 119.0.1
- name: Check versions
run: |
cat /etc/lsb-release
node -v
npm -v
docker -v
docker compose version
firefox -v
which firefox
- uses: cypress-io/github-action@v6
with:
browser: firefox
config-file: config/cypress.config.ts
env: PORT=8880
install: true
install-command: npm ci
parallel: true
record: true
wait-on: "http://localhost:8880"
working-directory: ./frontend
- uses: LouisBrunner/checks-action@v2.0.0
if: ${{ always() }}
with:
# check_id: application-e2e-cypress-${{ github.event.workflow_run.head_commit.id }}
conclusion: ${{ job.status }}
details_url: "https://github.com/MTES-MCT/monitorfish/actions/runs/${{ github.run_id }}/job/${{ github.job_id }}"
name: Application E2E Tests (Cypress)
sha: ${{ github.event.workflow_run.head_commit.id }}
token: ${{ secrets.GITHUB_TOKEN }}
e2e_multi_windows_test:
name: Run E2E multi windows tests
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUPPETEER_SKIP_DOWNLOAD: "true"
VITE_CYPRESS_PORT: 8880
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_commit.id }}
- name: Set version and environment profile
uses: ./.github/actions/set-version-and-environment-profile
- name: Set MONITORFISH_VERSION environment variable
run: echo "MONITORFISH_VERSION=${VERSION}" >> $GITHUB_ENV
- name: Download image
uses: ishworkh/container-image-artifact-download@v1.0.0
with:
commit_sha: ${{ github.event.workflow_run.head_commit.id }}
image: monitorfish-app:${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
workflow: "Application Build"
- name: Docker login
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: ./frontend/package-lock.json
node-version: 20
- name: Install Node.js dependencies
run: npm ci
working-directory: ./frontend
- name: Run docker images
run: make docker-compose-puppeteer-up
- name: Install Firefox
run: npx puppeteer browsers install firefox
- name: Run multi-windows tests
run: npm run test:multi-windows:run
working-directory: ./frontend
- uses: LouisBrunner/checks-action@v2.0.0
if: ${{ always() }}
with:
# check_id: application-e2e-puppeteer-${{ github.event.workflow_run.head_commit.id }}
conclusion: ${{ job.status }}
details_url: "https://github.com/MTES-MCT/monitorfish/actions/runs/${{ github.run_id }}/job/${{ github.job_id }}"
name: Application E2E Tests (Puppeteer)
sha: ${{ github.event.workflow_run.head_commit.id }}
token: ${{ secrets.GITHUB_TOKEN }}