-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
214 lines (188 loc) · 7.45 KB
/
test.yaml
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
name: Test
on:
push:
branches:
master
pull_request:
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
inputs:
rebuild-docker-images:
description: 'Rebuild all Docker images'
default: false
type: 'boolean'
workflow_call: # Allow this workflow to be called from other workflows
inputs:
rebuild-docker-images-call:
description: 'Rebuild all Docker images'
required: true
type: boolean
permissions:
contents: read
env:
TEST_IMAGE_NODE_MAJOR_VERSION: 22
jobs:
check-if-docker-build:
runs-on: ubuntu-22.04
outputs:
force-docker-build: ${{ steps.changed-files-specific.outputs.any_changed }}
steps:
- name: Checkout code repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- name: Determine if Dockerfiles changed
id: changed-files-specific
uses: tj-actions/changed-files@c65cd883420fd2eb864698a825fc4162dd94482c # v44
with:
files: docker/**/*
- name: Output all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
run: |
echo "One or more test file(s) has changed."
echo "List all the files that have changed: $ALL_CHANGED_FILES"
run-docker-build:
needs: check-if-docker-build
if: |
always() &&
(needs.check-if-docker-build.outputs.force-docker-build == 'true' ||
inputs.rebuild-docker-images == 'true' || inputs.rebuild-docker-images == true ||
inputs.rebuild-docker-images-call == 'true' || inputs.rebuild-docker-images-call == true)
uses: ./.github/workflows/docker-build.yml
test-linux:
runs-on: ubuntu-22.04
needs: [check-if-docker-build, run-docker-build]
# Wonky if-conditional to allow this step to run AFTER docker images are rebuilt OR if the build stage skipped and we want to use dockerhub registry for images
if: |
always() &&
needs.check-if-docker-build.result == 'success' &&
(needs.run-docker-build.result == 'success' || needs.run-docker-build.result == 'skipped')
strategy:
fail-fast: false
matrix:
testFiles:
- ArtifactPublisherTest,BuildTest,ExtraBuildTest,RepoSlugTest,binDownloadTest,configurationValidationTest,filenameUtilTest,filesTest,globTest,ignoreTest,macroExpanderTest,mainEntryTest,urlUtilTest,extraMetadataTest,linuxArchiveTest,linuxPackagerTest,HoistedNodeModuleTest,MemoLazyTest
- snapTest,debTest,fpmTest,protonTest
- winPackagerTest,installerTest,BuildTest,winCodeSignTest
steps:
- name: Checkout code repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 2
- name: Setup Tests
uses: ./.github/actions/pretest
with:
cache-path: ~/.cache/electron
cache-key: v-23.3.10-linux-electron
- name: Download test-runner if exists
if: needs.run-docker-build.result == 'success'
id: download-test-runner-image
uses: actions/download-artifact@v4
with:
name: electron-builder-all-${{ env.TEST_IMAGE_NODE_MAJOR_VERSION }}
path: ${{ runner.temp }}
- name: Load test runner image if needed
if: needs.run-docker-build.result == 'success'
run: |
docker image load --input ${{ runner.temp }}/electron-builder-all-${{ env.TEST_IMAGE_NODE_MAJOR_VERSION }}.tar
docker image ls -a
- name: Lint
run: pnpm pretest
- name: Run tests in docker image
run: |
echo $TEST_RUNNER_IMAGE_TAG
pnpm test-linux
env:
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
TEST_FILES: ${{ matrix.testFiles }}
FORCE_COLOR: 1
TEST_RUNNER_IMAGE_TAG: electronuserland/builder:${{ env.TEST_IMAGE_NODE_MAJOR_VERSION }}-wine-mono
# Need to separate from other tests because logic is specific to when TOKEN env vars are set
test-updater:
runs-on: ubuntu-22.04
needs: [check-if-docker-build, run-docker-build]
# Wonky if-conditional to allow this step to run AFTER docker images are rebuilt OR if the build stage skipped and we want to use dockerhub registry for images
if: |
always() &&
needs.check-if-docker-build.result == 'success' &&
(needs.run-docker-build.result == 'success' || needs.run-docker-build.result == 'skipped')
steps:
- name: Checkout code repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup Tests
uses: ./.github/actions/pretest
with:
cache-path: ~/.cache/electron
cache-key: v-23.3.10-update-electron
- name: Download test-runner if exists
if: needs.run-docker-build.result == 'success'
uses: actions/download-artifact@v4
with:
name: electron-builder-all-${{ env.TEST_IMAGE_NODE_MAJOR_VERSION }}
path: ${{ runner.temp }}
- name: Load test runner image if needed
if: needs.run-docker-build.result == 'success'
run: |
docker image load --input ${{ runner.temp }}/electron-builder-all-${{ env.TEST_IMAGE_NODE_MAJOR_VERSION }}.tar
docker image ls -a
- name: Test
run: |
echo $TEST_RUNNER_IMAGE_TAG
pnpm test-linux
env:
TEST_FILES: nsisUpdaterTest,linuxUpdaterTest,PublishManagerTest,differentialUpdateTest
KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
BITBUCKET_TOKEN: ${{ secrets.BITBUCKET_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
FORCE_COLOR: 1
TEST_RUNNER_IMAGE_TAG: electronuserland/builder:${{ env.TEST_IMAGE_NODE_MAJOR_VERSION }}-wine-mono
- name: Verify Docs Generation
run: pnpm generate-all
test-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
testFiles:
- winCodeSignTest,differentialUpdateTest
- appxTest,msiTest,portableTest,assistedInstallerTest,protonTest
- BuildTest,oneClickInstallerTest,winPackagerTest,nsisUpdaterTest,webInstallerTest
steps:
- name: Checkout code repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup Tests
uses: ./.github/actions/pretest
with:
cache-key: v-23.3.10-windows-electron
cache-path: ~\AppData\Local\electron\Cache
- name: Test
run: pnpm ci:test
env:
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
TEST_FILES: ${{ matrix.testFiles }}
FORCE_COLOR: 1
test-mac:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
testFiles:
- winPackagerTest,installerTest,winCodeSignTest
- masTest,dmgTest,filesTest,macPackagerTest,differentialUpdateTest
steps:
- name: Checkout code repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup Tests
uses: ./.github/actions/pretest
with:
cache-path: ~/Library/Caches/electron
cache-key: v-23.3.10-macos-electron
- name: Install pwsh and wine via brew
run: |
brew install powershell/tap/powershell
brew install --cask wine-stable
- name: Test
run: pnpm ci:test
env:
TEST_FILES: ${{ matrix.testFiles }}
FORCE_COLOR: 1