-
Notifications
You must be signed in to change notification settings - Fork 57
200 lines (197 loc) · 7.96 KB
/
~reusable_e2e_by_OS.yaml
File metadata and controls
200 lines (197 loc) · 7.96 KB
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
on:
workflow_call:
inputs:
BRANCH:
description: 'A branch passed from the caller workflow to run the test on.'
required: true
type: string
PACKAGE_VERSION:
description: 'A package-version of cli passed from the caller workflow. Which will be used to create and release plugins.'
required: true
type: string
FLEX_UI_VERSION:
description: 'A flex-ui version passed from the caller workflow. It decides the version of FLEX UI on tests will run on.'
required: true
type: string
NODE_VERSION:
description: 'A node-version passed from the caller workflow. It decides the version of node on which tests will run.'
required: false
type: string
default: '22'
NPM_IGNORE_PREFIX:
description: 'A npm-ignore-prefix passed from the caller workflow.'
required: true
type: string
OS:
description: 'Operating system passed from the caller workflow, it decides the OS on which the tests will run.'
required: true
type: string
SEND_NOTIFICATION:
description: 'A flag passed from the caller workflow, it decides whether to send slack notification or not.'
required: true
type: boolean
SLACK_TITLE:
description: 'A title passed from the caller workflow, it will be used in slack notification.'
required: false
type: string
default: 'Flex Plugins CLI - E2E'
SLACK_MESSAGE:
description: 'A message passed from the caller workflow, it will be used in slack notification.'
required: false
type: string
default: 'E2E tests'
secrets:
CONSOLE_EMAIL:
required: true
CONSOLE_PASSWORD:
required: true
CONSOLE_EMAIL_linux:
description: 'An email passed from the caller workflow, it will be used for login in linux environment.'
required: true
TWILIO_ACCOUNT_SID_linux:
description: 'An account-sid passed from the caller workflow, it will be used for authentication of APIs in linux environment.'
required: true
TWILIO_AUTH_TOKEN_linux:
description: 'An account-token passed from the caller workflow, it will be used for authentication of APIs in linux environment.'
required: true
CONSOLE_EMAIL_win32:
description: 'An email passed from the caller workflow, it will be used for login in windows environment.'
required: true
TWILIO_ACCOUNT_SID_win32:
description: 'An account-sid passed from the caller workflow, it will be used for authentication of APIs in windows environment.'
required: true
TWILIO_AUTH_TOKEN_win32:
description: 'An account-token passed from the caller workflow, it will be used for authentication of APIs in windows environment.'
required: true
CONSOLE_EMAIL_darwin:
description: 'An email passed from the caller workflow, it will be used for login in mac environment.'
required: true
TWILIO_ACCOUNT_SID_darwin:
description: 'An account-sid passed from the caller workflow, it will be used for authentication of APIs in mac environment.'
required: true
TWILIO_AUTH_TOKEN_darwin:
description: 'An account-token passed from the caller workflow, it will be used for authentication of APIs in mac environment.'
required: true
SLACK_WEB_HOOK:
description: 'A slack-web-hook passed from the caller workflow, it will be used for sending notifications.'
required: true
env:
BRANCH: ${{ inputs.BRANCH }}
NPM_IGNORE_PREFIX: ${{ inputs.NPM_IGNORE_PREFIX }}
PACKAGE_VERSION: ${{ inputs.PACKAGE_VERSION }}
FLEX_UI_VERSION: ${{ inputs.FLEX_UI_VERSION }}
CONSOLE_EMAIL: ${{ secrets.CONSOLE_EMAIL }}
CONSOLE_PASSWORD: ${{ secrets.CONSOLE_PASSWORD }}
CONSOLE_EMAIL_linux: ${{ secrets.CONSOLE_EMAIL_linux }}
TWILIO_ACCOUNT_SID_linux: ${{ secrets.TWILIO_ACCOUNT_SID_linux }}
TWILIO_AUTH_TOKEN_linux: ${{ secrets.TWILIO_AUTH_TOKEN_linux }}
CONSOLE_EMAIL_win32: ${{ secrets.CONSOLE_EMAIL_win32 }}
TWILIO_ACCOUNT_SID_win32: ${{ secrets.TWILIO_ACCOUNT_SID_win32 }}
TWILIO_AUTH_TOKEN_win32: ${{ secrets.TWILIO_AUTH_TOKEN_win32 }}
CONSOLE_EMAIL_darwin: ${{ secrets.CONSOLE_EMAIL_darwin }}
TWILIO_ACCOUNT_SID_darwin: ${{ secrets.TWILIO_ACCOUNT_SID_darwin }}
TWILIO_AUTH_TOKEN_darwin: ${{ secrets.TWILIO_AUTH_TOKEN_darwin }}
NODE_OPTIONS: --max-old-space-size=8192
jobs:
node:
runs-on: ${{ inputs.OS }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
- name: Override localhost to IPv4 in Linux for Node 18
run: |
sudo sed -i '/localhost/s/::1/#::1/' /etc/hosts
if: ${{ inputs.OS == 'ubuntu-22.04' && inputs.NODE_VERSION == '18' }}
- name: Install project dependencies (Linux)
if: ${{ inputs.OS == 'ubuntu-22.04' }}
run: |
echo "Starting npm ci with a 10-minute timeout"
for i in 1 2 3; do # Retry logic, retry 3 times
timeout 10m npm ci --verbose && break || echo "npm ci failed, retrying ($i/3)..."
done
- name: Install project dependencies (Macos)
if: ${{ inputs.OS == 'macos-latest' }}
run: |
echo "Starting npm ci with a 10-minute timeout"
brew install coreutils
for i in 1 2 3; do # Retry logic, retry 3 times
gtimeout 10m npm ci --verbose && break || echo "npm ci failed, retrying ($i/3)..."
done
- name: Install project dependencies (Windows)
if: ${{ inputs.OS == 'windows-latest' }}
run: |
npm ci --verbose
shell: pwsh
- name: Build packages
run: |
npm run build
- name: Run e2e tests - JS (Linux)
if: ${{ inputs.OS == 'ubuntu-22.04' }}
env:
TS: 0
run: |
cd packages/flex-plugin-e2e-tests
npm run start
- name: Run e2e tests - JS (Macos)
if: ${{ inputs.OS == 'macos-latest' }}
env:
TS: 0
run: |
cd packages/flex-plugin-e2e-tests
npm run start
- name: Run e2e tests - JS (Windows)
if: ${{ inputs.OS == 'windows-latest' }}
env:
TS: 0
run: |
cd packages/flex-plugin-e2e-tests
npm run start
- name: Kill node for Windows os
if: ${{ inputs.OS == 'windows-latest' }}
run: |
echo "os is: ${{ inputs.OS }} ${{ runner.os }}"
taskkill /f /im node.exe
- name: Run e2e tests - TS (Linux)
if: ${{ inputs.OS == 'ubuntu-22.04' }}
env:
TS: 1
run: |
cd packages/flex-plugin-e2e-tests
npm run start
- name: Run e2e tests - TS (Macos)
if: ${{ inputs.OS == 'macos-latest' }}
env:
TS: 1
run: |
cd packages/flex-plugin-e2e-tests
npm run start
- name: Run e2e tests - TS (Windows)
if: ${{ inputs.OS == 'windows-latest' }}
env:
TS: 1
run: |
cd packages/flex-plugin-e2e-tests
npm run start
- name: Upload Screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ inputs.OS }}-screenshots
path: packages/flex-plugin-e2e-tests/screenshots
notify-failure:
runs-on: ubuntu-22.04
needs: node
if: ${{ always() && inputs.SEND_NOTIFICATION }}
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEB_HOOK }}
SLACK_COLOR: ${{ needs.node.result }}
SLACK_USERNAME: Github Actions
SLACK_ICON_EMOJI: ':ship:'
SLACK_TITLE: '${{ inputs.SLACK_TITLE }} - ${{ inputs.OS }} - ${{ inputs.NODE_VERSION }}'
SLACK_MESSAGE: '${{ github.repository }}/${{ github.ref }} - ${{ inputs.SLACK_MESSAGE }} ${{ needs.node.result }} for ${{ inputs.OS }}.'
MSG_MINIMAL: actions url