-
Notifications
You must be signed in to change notification settings - Fork 14
279 lines (271 loc) · 9.16 KB
/
build-electron-app.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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
name: Build release
run-name: 'Release version: Commit ${{ github.sha }}'
permissions:
contents: write
on:
push:
branches:
- master
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: false
isAutoUpdateDisabled:
description: 'Is auto-update disabled (true / 1)?'
required: false
isBfxApiStaging:
description: 'Is it necessary to use BFX API Staging? (true / 1)?'
required: false
isNotarizeDisabled:
description: 'Is notarize disabled (true / 1)?'
required: false
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
jobs:
linux-win-docker-builder:
timeout-minutes: 90
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set repo owner
run: |
sed -i -e \
"s/owner: '.*'/owner: '${{ github.repository_owner }}'/g" \
"./electron-builder-config.js"
- if: github.event.inputs.version != ''
name: Set release version
run: |
sed -i -e \
"s/\"version\": \".*\"/\"version\": \"${{ github.event.inputs.version }}\"/g" \
"./package.json"
- if: contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isAutoUpdateDisabled)
name: Turn off auto-update
run: |
echo "IS_AUTO_UPDATE_DISABLED=1" >> $GITHUB_ENV
- if: contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isBfxApiStaging)
name: Use BFX API Staging for queries
run: |
echo "IS_BFX_API_STAGING=1" >> $GITHUB_ENV
- name: Cache Electron binaries
id: electron-cache
uses: actions/cache@v3
env:
cache-name: electron-cache-v1
with:
path: |
~/.cache/electron
~/.cache/electron-builder
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Build release
id: release-builder
uses: nick-fields/retry@v2
continue-on-error: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
timeout_minutes: 20
retry_wait_seconds: 10
max_attempts: 3
retry_on: any
command: ./scripts/launch.sh -lwp
- name: Zip Linux Unpacked build
run: zip -r dist/linux-unpacked.zip dist/linux-unpacked
- name: Upload Linux Unpacked build
uses: actions/upload-artifact@v3
with:
name: linux-unpacked
path: dist/linux-unpacked.zip
- name: Zip Win Unpacked build
run: zip -r dist/win-unpacked.zip dist/win-unpacked
- name: Upload Win Unpacked build
uses: actions/upload-artifact@v3
with:
name: win-unpacked
path: dist/win-unpacked.zip
- name: Prepare cache folders
run: |
sudo chown -R $(id -u):$(id -g) ~/.cache/electron
sudo chown -R $(id -u):$(id -g) ~/.cache/electron-builder
mac-builder:
timeout-minutes: 150
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Replace macOS’s sed with GNU’s sed
run: |
brew install gnu-sed
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
- name: Set repo owner
run: |
sed -i -e \
"s/owner: '.*'/owner: '${{ github.repository_owner }}'/g" \
"./electron-builder-config.js"
- if: github.event.inputs.version != ''
name: Set release version
run: |
sed -i -e \
"s/\"version\": \".*\"/\"version\": \"${{ github.event.inputs.version }}\"/g" \
"./package.json"
- if: contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isAutoUpdateDisabled)
name: Turn off auto-update
run: |
echo "IS_AUTO_UPDATE_DISABLED=1" >> $GITHUB_ENV
- if: ${{ !contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isNotarizeDisabled) }}
name: Turn on notarize
run: |
echo "NOTARIZE=1" >> $GITHUB_ENV
- if: contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isBfxApiStaging)
name: Use BFX API Staging for queries
run: |
echo "IS_BFX_API_STAGING=1" >> $GITHUB_ENV
- uses: actions/setup-node@v3
with:
node-version: 18.17.1
- name: Cache Electron binaries
id: electron-cache
uses: actions/cache@v3
env:
cache-name: electron-cache-v1
with:
path: |
${{ runner.temp }}/.cache/electron
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Build release
id: release-builder
uses: nick-fields/retry@v2
continue-on-error: false
env:
APPLE_TEAM_ID: ${{ secrets.BFX_APPLE_TEAM_ID }}
APPLE_ID: ${{ secrets.BFX_APPLE_ID_USERNAME }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.BFX_APPLE_ID_REPORT_PASSWORD }}
CSC_LINK: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_B64 }}
CSC_KEY_PASSWORD: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ELECTRON_CACHE: ${{ runner.temp }}/.cache/electron
with:
timeout_minutes: 40
retry_wait_seconds: 10
max_attempts: 3
retry_on: any
command: |
if [[ -z "${APPLE_TEAM_ID}" || "${NOTARIZE:-}" != "1" ]]; then unset NOTARIZE; fi
if [[ -z "${APPLE_TEAM_ID}" || "${NOTARIZE:-}" != "1" ]]; then unset APPLE_TEAM_ID; fi
if [[ -z "${APPLE_ID}" || "${NOTARIZE:-}" != "1" ]]; then unset APPLE_ID; fi
if [[ -z "${APPLE_APP_SPECIFIC_PASSWORD}" || "${NOTARIZE:-}" != "1" ]]; then unset APPLE_APP_SPECIFIC_PASSWORD; fi
if [[ -z "${CSC_LINK}" || "${NOTARIZE:-}" != "1" ]]; then unset CSC_LINK; fi
if [[ -z "${CSC_KEY_PASSWORD}" || "${NOTARIZE:-}" != "1" ]]; then unset CSC_KEY_PASSWORD; fi
./scripts/build-release.sh -mp
- name: Zip Mac Unpacked build
run: zip -r dist/mac.zip dist/mac
- name: Upload Mac Unpacked build
uses: actions/upload-artifact@v3
with:
name: mac-unpacked
path: dist/mac.zip
linux-e2e-test-runner:
name: Linux E2E Test Runner
timeout-minutes: 30
runs-on: ubuntu-22.04
needs: [linux-win-docker-builder]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18.17.1
- name: Install main dev deps
run: npm i --development --no-audit --progress=false --force
- name: Download Linux Unpacked build
uses: actions/download-artifact@v3
with:
name: linux-unpacked
path: dist
- name: Unzip Linux Unpacked build
run: unzip dist/linux-unpacked.zip
- name: Run tests
uses: coactions/setup-xvfb@v1.0.1
with:
run: npm run e2e
- name: Normalize E2E test report
run: node ./scripts/node/normalize-e2e-test-report e2e-test-report.xml
- name: Upload Linux E2E test results
uses: actions/upload-artifact@v3
with:
name: linux-e2e-test-results
path: e2e-test-report.xml
win-e2e-test-runner:
name: Win E2E Test Runner
timeout-minutes: 30
runs-on: windows-2022
needs: [linux-win-docker-builder]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18.17.1
- name: Install main dev deps
run: npm i --development --no-audit --progress=false --force
- name: Download Linux Unpacked build
uses: actions/download-artifact@v3
with:
name: win-unpacked
path: dist
- name: Unzip Win Unpacked build
run: 7z -y x dist/win-unpacked.zip
- name: Run tests
uses: coactions/setup-xvfb@v1.0.1
with:
run: npm run e2e
- name: Normalize E2E test report
run: node ./scripts/node/normalize-e2e-test-report e2e-test-report.xml
- name: Upload Win E2E test results
uses: actions/upload-artifact@v3
with:
name: win-e2e-test-results
path: e2e-test-report.xml
mac-e2e-test-runner:
name: Mac E2E Test Runner
timeout-minutes: 30
runs-on: macos-12
needs: [mac-builder]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare Mac runner
uses: ./.github/actions/prepare-mac-runner
- uses: actions/setup-node@v3
with:
node-version: 18.17.1
- name: Install main dev deps
run: npm i --development --no-audit --progress=false --force
- name: Download Mac Unpacked build
uses: actions/download-artifact@v3
with:
name: mac-unpacked
path: dist
- name: Unzip Mac Unpacked build
run: unzip dist/mac.zip
- name: Run tests
uses: coactions/setup-xvfb@v1.0.1
with:
run: npm run e2e
- name: Normalize E2E test report
run: node ./scripts/node/normalize-e2e-test-report e2e-test-report.xml
- name: Upload Mac E2E test results
uses: actions/upload-artifact@v3
with:
name: mac-e2e-test-results
path: e2e-test-report.xml