-
Notifications
You must be signed in to change notification settings - Fork 829
201 lines (179 loc) · 8.5 KB
/
e2e-functional.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
name: Electron Playwright Tests
on:
push:
branches:
- master
pull_request:
types:
- labeled
env:
AWS_S3_BUCKET: "mattermost-cypress-report"
BRANCH: ${{ github.ref }}
BUILD_SUFFIX: 'desktop-pr'
JIRA_PROJECT_KEY: 'MM'
MM_TEST_SERVER_URL: "https://mattermost-pr-23996.test.mattermost.cloud/"
PULL_REQUEST_BASE_URL: "https://github.com/mattermost/desktop/pull/"
TYPE: ${{ github.event_name == 'pull_request' && 'PR' || '' }}
ZEPHYR_ENVIRONMENT_NAME: 'Desktop app'
ZEPHYR_FOLDER_ID: "3256491"
TEST_CYCLE_LINK_PREFIX: ${{ secrets.MM_DESKTOP_E2E_TEST_CYCLE_LINK_PREFIX }}
AWS_ACCESS_KEY_ID: ${{ secrets.MM_DESKTOP_E2E_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.MM_DESKTOP_E2E_AWS_SECRET_ACCESS_KEY }}
WEBHOOK_URL: ${{ secrets.MM_DESKTOP_E2E_WEBHOOK_URL }}
ZEPHYR_API_KEY: ${{ secrets.MM_DESKTOP_E2E_ZEPHYR_API_KEY }}
jobs:
e2e-linux:
if: ${{ github.event.label.name == 'Run Desktop E2E Tests' }}
runs-on: ubuntu-latest
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: Install dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 0
run: |
wget -qO - https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_22.04/Release.key | sudo apt-key add -
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.20.1/yq_linux_amd64 && chmod a+x /usr/local/bin/yq
sudo apt-get update || true && sudo apt-get install -y ca-certificates libxtst-dev libpng++-dev gcc-aarch64-linux-gnu g++-aarch64-linux-gnu jq icnsutils graphicsmagick tzdata
npm ci
- name: Set Environment Variables
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-pr" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "release" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-release" >> $GITHUB_ENV
echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "schedule" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-nightly" >> $GITHUB_ENV
fi
echo "BUILD_ID=${{ github.run_id }}-${BUILD_SUFFIX}-${{ runner.os }}" >> $GITHUB_ENV
echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "PULL_REQUEST=${PULL_REQUEST_BASE_URL}${{ github.event.pull_request.number }}" >> $GITHUB_ENV
if [ -n "${ZEPHYR_ENABLE}" ]; then
echo "ZEPHYR_ENABLE=${ZEPHYR_ENABLE}" >> $GITHUB_ENV
fi
- name: Run Playwright tests (Ubuntu OS)
run: |
export DISPLAY=:99
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
npm run test:e2e || true # making job pass even if the tests fail due to flakyness
npm run test:e2e:send-report
- name: Remove "Run Desktop E2E Tests" label
if: always()
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: |
Run Desktop E2E Tests
e2e-macos:
if: ${{ github.event.label.name == 'Run Desktop E2E Tests' }}
runs-on: macos-12
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: Setup Go environment
uses: actions/[email protected]
with:
go-version: '1.20'
- name: ci/install-dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
brew install yq
jq '.mac.target=["zip"]' electron-builder.json | jq '.mac.gatekeeperAssess=false' > /tmp/electron-builder.json && cp /tmp/electron-builder.json .
npm ci
- name: Set Environment Variables
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-pr" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "release" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-release" >> $GITHUB_ENV
echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "schedule" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-nightly" >> $GITHUB_ENV
fi
echo "BUILD_ID=${{ github.run_id }}-${BUILD_SUFFIX}-${{ runner.os }}" >> $GITHUB_ENV
echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "PULL_REQUEST=${PULL_REQUEST_BASE_URL}${{ github.event.pull_request.number }}" >> $GITHUB_ENV
if [ -n "${ZEPHYR_ENABLE}" ]; then
echo "ZEPHYR_ENABLE=${ZEPHYR_ENABLE}" >> $GITHUB_ENV
fi
- name: Run Playwright tests (macOS)
run: |
npm run test:e2e || true # making job pass even if the tests fail due to flakyness
npm run test:e2e:send-report
e2e-windows:
if: ${{ github.event.label.name == 'Run Desktop E2E Tests' }}
runs-on: windows-latest
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: ci/cache-node-modules
id: cache-node-modules
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: node_modules
key: ${{ runner.os }}-build-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-node-modules
${{ runner.os }}-build-
${{ runner.os }}-
- name: ci/install-node-gyp
if: steps.cache-node-modules.outputs.cache-hit != 'true'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
choco install yq --version 4.15.1 -y
npm i -g node-gyp
node-gyp install
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers" --arch arm64
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers" --arch ia32
- name: Set Environment Variables
shell: bash
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-pr" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "release" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-release" >> $GITHUB_ENV
echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "schedule" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-nightly" >> $GITHUB_ENV
fi
echo "BUILD_ID=${{ github.run_id }}-${BUILD_SUFFIX}-${{ runner.os }}" >> $GITHUB_ENV
echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "PULL_REQUEST=${PULL_REQUEST_BASE_URL}${{ github.event.pull_request.number }}" >> $GITHUB_ENV
if [ -n "${ZEPHYR_ENABLE}" ]; then
echo "ZEPHYR_ENABLE=${ZEPHYR_ENABLE}" >> $GITHUB_ENV
fi
- name: Run Playwright tests (Windows OS)
run: |
npm run test:e2e || true
npm run test:e2e:send-report
shell: bash