-
Notifications
You must be signed in to change notification settings - Fork 61
231 lines (203 loc) · 7.65 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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
name: E2E Testing
on:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
env:
COMPOSE_PROJECT_NAME: "${{ github.run_id }}_playwright_1"
# Control testing parallelism
PARALLELISM: 10
jobs:
build-mattermost-plugin-calls:
runs-on: ubuntu-22.04
steps:
- name: e2e/checkout-mattermost-plugin-calls-repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: e2e/setup-go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: e2e/setup-node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: webapp/package-lock.json
- name: e2e/build-mattermost-plugin-calls
env:
MM_SERVICESETTINGS_ENABLEDEVELOPER: 1
run: make dist
- name: e2e/persist-mattermost-plugin-calls-package
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: mattermost-plugin-calls-package
path: ${{ github.workspace }}/dist/*.tar.gz
if-no-files-found: error
compression-level: 0
retention-days: 1
build-rtcd-image:
runs-on: ubuntu-22.04
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
# Try to fetch branch that matches branch on plugin side.
- name: e2e/checkout-rtcd-repo
id: try-checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
continue-on-error: true
with:
repository: mattermost/rtcd
path: rtcd
ref: ${{ env.BRANCH_NAME }}
# Fallback to default branch if the above is missing.
- name: e2e/checkout-rtcd-repo-fallback
if: steps.try-checkout.outcome == 'failure'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: mattermost/rtcd
path: rtcd
- name: e2e/setup-docker-buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: e2e/build-image
working-directory: ./rtcd
run: |
make docker-build CI=false
if [[ ${{steps.try-checkout.outcome}} == 'failure' ]]; then
RTCD_IMAGE="rtcd:master"
else
RTCD_IMAGE="rtcd:dev-$(git log --pretty=format:'%h' -n 1)"
fi
docker tag "${RTCD_IMAGE}" "rtcd:e2e"
docker save --output rtcd.tar "rtcd:e2e"
- name: e2e/persist-mattermost-rtcd-image
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: mattermost-rtcd-image
path: ${{ github.workspace }}/rtcd/rtcd.tar
if-no-files-found: error
compression-level: 0
retention-days: 1
generate-matrix:
runs-on: ubuntu-22.04
outputs:
parallelism-matrix: ${{ steps.calculation.outputs.PARALLELISM }}
parallelism: ${{ env.PARALLELISM }}
steps:
- name: e2e/generate-e2e-matrix
id: calculation
run: |
RANGE=$(( ${{ env.PARALLELISM }}+1 ))
echo PARALLELISM=$(jq -n "{ run_id: [range(1;${RANGE})]}") > ${GITHUB_OUTPUT}
e2e-playwright-test:
runs-on: ubuntu-22.04
needs:
- build-mattermost-plugin-calls
- generate-matrix
- build-rtcd-image
env:
COMPOSE_PROJECT_NAME: playwright_tests
DOCKER_NETWORK: playwright_tests
CONTAINER_SERVER: playwright_tests_server
CONTAINER_PROXY: playwright_tests_proxy
CONTAINER_RTCD: playwright_tests_rtcd
CONTAINER_OFFLOADER: playwright_tests_offloader
IMAGE_CALLS_OFFLOADER: mattermost/calls-offloader:v0.8.0
IMAGE_CALLS_RECORDER: mattermost/calls-recorder:v0.7.7
IMAGE_CALLS_TRANSCRIBER: mattermost/calls-transcriber:v0.5.0
IMAGE_SERVER: mattermostdevelopment/mattermost-enterprise-edition:master
IMAGE_CURL: curlimages/curl:8.7.1
CI_NODE_INDEX: ${{ matrix.run_id }}
CI_NODE_TOTAL: ${{ needs.generate-matrix.outputs.parallelism }}
WORKSPACE: ${{github.workspace}}
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.parallelism-matrix) }}
steps:
- name: e2e/checkout-mattermost-plugin-calls-repo
uses: actions/checkout@v4
- name: e2e/checkout-mattermost-repo
uses: actions/checkout@v4
with:
repository: mattermost/mattermost
path: mattermost
- name: e2e/setup-docker-buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: e2e/setup-go
uses: actions/setup-go@v5
with:
go-version-file: mattermost/server/go.mod
- name: e2e/generate-configuration
working-directory: ./mattermost/server/scripts/config_generator
env:
OUTPUT_CONFIG: ${{ github.workspace }}/config/config.json
run: |
mkdir -p ${{ github.workspace }}/config
go run main.go
- name: e2e/download-mattermost-plugin-calls-package
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
name: mattermost-plugin-calls-package
path: dist
- name: e2e/download-rtcd-image
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
name: mattermost-rtcd-image
path: ${{ github.workspace }}
- name: e2e/docker-login
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
# Do not authenticate on Forks
if: "! github.event.pull_request.head.repo.fork"
with:
username: ${{ secrets.DOCKERHUB_DEV_USERNAME }}
password: ${{ secrets.DOCKERHUB_DEV_TOKEN }}
- name: e2e/run-server
env:
DOCKER_CLIENT_TIMEOUT: 120
COMPOSE_HTTP_TIMEOUT: 120
DOCKER_COMPOSE_FILE: ${{ github.workspace }}/e2e/docker/docker-compose.yaml
MM_PLUGIN_CALLS_TEST_LICENSE: ${{ secrets.MM_PLUGIN_CALLS_TEST_LICENSE }}
RTCD_IMAGE_PATH: ${{ github.workspace }}/rtcd.tar
run: |
${{ github.workspace }}/e2e/scripts/prepare-server.sh
- name: e2e/build-e2e-image
working-directory: e2e
run: |
echo "Building playwright test image ... "
cp ${{ github.workspace }}/plugin.json plugin.json
docker build --quiet -t mm-playwright -f Playwright.Dockerfile .
- name: e2e/test
env:
WORKSPACE: ${{github.workspace}}
RUN_ID: ${{matrix.run_id}}
id: test
run: |
${{ github.workspace }}/e2e/scripts/run.sh
- name: e2e/test-core
env:
WORKSPACE: ${{github.workspace}}
RUN_ID: ${{matrix.run_id}}
id: test-core
run: |
${{ github.workspace }}/e2e/scripts/run-core.sh
- name: e2e/persist-report-results
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: e2e-playwright-results-${{ matrix.run_id }}
path: ${{ github.workspace }}/results
compression-level: 0
retention-days: 1
- name: e2e/persist-report-logs
if: ${{ (fromJson(steps.test.outputs.FAILURES) > 0) || (fromJson(steps.test-core.outputs.FAILURES) > 0) }}
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: e2e-playwright-logs-${{ matrix.run_id }}
path: ${{ github.workspace }}/logs
compression-level: 0
retention-days: 5