-
-
Notifications
You must be signed in to change notification settings - Fork 523
257 lines (225 loc) · 9.22 KB
/
windows-release-build.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
name: Windows Release Build
on:
workflow_call:
inputs:
generate-gpo:
required: true
type: boolean
default: false
build-version:
description: 'The version to build'
required: true
type: string
profile-data-path-archive:
description: 'The path to the zip archive containing the profile data'
type: string
release-branch:
description: 'The branch to build'
required: true
type: string
jobs:
windows-build:
name: Build Windows - ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.DEPLOY_KEY }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Setup pnpm
run: npm install -g pnpm
- name: Setup Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "mauro-balades"
- name: Install dependencies
run: |
pnpm install
- name: Load Surfer CI setup
run: pnpm surfer ci --brand ${{ inputs.release-branch }} --display-version ${{ inputs.build-version }}
- name: Download Firefox and dependencies
run: pnpm surfer download
- name: win-cross Cache
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
id: cache-win-cross
uses: actions/cache@v4
with:
path: ${HOME}/win-cross
key: win-cross
- name: Configure sccache
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup for Windows
if: steps.cache-win-cross.outputs.cache-hit != 'true'
run: |
set -x
mkdir -p ~/win-cross
cd engine/
echo Setup wine
aria2c "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.cache.level-1.toolchains.v3.linux64-wine.latest/artifacts/public%2Fbuild%2Fwine.tar.zst" -o wine.tar.zst
tar --zstd -xvf wine.tar.zst -C ~/win-cross
rm wine.tar.zst
echo Setup Visual Studio
sudo apt install -y msitools python3-pip
./mach python --virtualenv build taskcluster/scripts/misc/get_vs.py build/vs/vs2022.yaml ~/win-cross/vs2022
- name: Bootstrap
run: |
set -x
cd engine/
chmod -R +x "$(echo ~)/win-cross/vs2022" || true
cd ..
npm install -g pnpm
export SURFER_PLATFORM="win32"
pnpm surfer bootstrap
cd engine/
ls ~/.mozbuild/clang/lib/clang/
echo "export LIB=\"$(cd ~/.mozbuild/clang/lib/clang/* && cd lib/windows && pwd)\"" >> ../configs/common/mozconfig
cat ../configs/common/mozconfig
sudo apt-get update
sudo apt-get install dos2unix
ls ~/win-cross/wine || true
ls ~/win-cross/vs2022 || true
- name: Setup Rust
run: |
cd engine/
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.79
source $HOME/.cargo/env
if test "${{ matrix.arch }}" = "aarch64"; then
rustup target add aarch64-pc-windows-msvc
else
rustup target add x86_64-pc-windows-msvc
fi
cargo install cargo-download
cargo download -x windows=0.58.0
export CARGO_INCREMENTAL=0
echo "" >> ../configs/common/mozconfig
echo "export MOZ_WINDOWS_RS_DIR=$(pwd)/windows-0.58.0" >> ../configs/common/mozconfig
- name: Import
env:
SURFER_COMPAT: ${{ matrix.arch }}
run: pnpm surfer import --verbose
- name: Build language packs
run: sh scripts/download-language-packs.sh
- name: Download artifact (if use profdata)
uses: actions/download-artifact@v4
if: ${{ !inputs.generate-gpo && matrix.arch == 'x86_64' }}
with:
path: ~/artifact
name: windows-profdata-${{ matrix.arch == 'aarch64' && 'arm64' || matrix.arch }}
- name: Show artifact info
if: ${{ !inputs.generate-gpo && matrix.arch == 'x86_64' }}
run: |
ls ~/artifact
ls ~/artifact/en-US.log
ls ~/artifact/merged.profdata
chmod +x ~/artifact/en-US.log
chmod +x ~/artifact/merged.profdata
- name: Build
if: ${{ !(inputs.generate-gpo && matrix.arch == 'aarch64') }}
env:
SURFER_COMPAT: ${{ matrix.arch }}
run: |
set -x
dos2unix configs/windows/mozconfig
export SURFER_PLATFORM="win32"
export ZEN_CROSS_COMPILING=1
if test ${{ inputs.generate-gpo }} = true; then
export ZEN_GA_GENERATE_PROFILE=1
fi
sh .github/workflows/src/release-build.sh
- name: Package
if: ${{ !(inputs.generate-gpo && matrix.arch == 'aarch64') }}
env:
SURFER_COMPAT: ${{ matrix.arch }}
run: |
set -x
export SURFER_PLATFORM="win32"
pnpm package
mv ./dist/zen-$(pnpm surfer get version | xargs).en-US.win64${{ matrix.arch == 'aarch64' && '-aarch64' || '' }}.zip zen.win64.zip
ls ./dist
ls .
- name: Debug session
if: ${{ failure() }}
uses: WarpBuilds/[email protected]
timeout-minutes: 15
- name: Move package for PGO upload
if: ${{ inputs.generate-gpo && matrix.arch == 'x86_64' }}
run: |
set -x
mv ./zen.win64.zip ./zen.win64-pgo-stage-1.zip
- name: Rename artifacts
if: ${{ !inputs.generate-gpo }}
run: |
mv ./zen.win64.zip zen.win-${{ matrix.arch == 'aarch64' && 'arm64' || matrix.arch }}.zip
mv ./dist/output.mar windows${{ matrix.arch == 'aarch64' && '-arm64' || '' }}.mar
mv ./dist/zen.installer.exe ./zen.installer${{ matrix.arch == 'aarch64' && '-arm64' || '' }}.exe
- name: Upload artifact (PGO)
uses: actions/upload-artifact@v4
if: ${{ inputs.generate-gpo && matrix.arch == 'x86_64' }}
with:
retention-days: 5
name: ${{ matrix.arch == 'aarch64' && 'arm64' || matrix.arch }}-${{ inputs.profile-data-path-archive }}
path: ./zen.win64-pgo-stage-1.zip
- name: Remove unnecessary files from obj
if: ${{ !inputs.generate-gpo }}
run: |
set -x
if test "${{ matrix.arch }}" = "aarch64"; then
find engine/obj-aarch64-pc-windows-msvc/ -mindepth 1 -maxdepth 1 -type d -not -name 'dist' -exec rm -rf {} \;
find engine/obj-aarch64-pc-windows-msvc/ -mindepth 1 -maxdepth 1 -type f -not -name 'dist' -exec rm -f {} \;
else
find engine/obj-x86_64-pc-windows-msvc/ -mindepth 1 -maxdepth 1 -type d -not -name 'dist' -exec rm -rf {} \;
find engine/obj-x86_64-pc-windows-msvc/ -mindepth 1 -maxdepth 1 -type f -not -name 'dist' -exec rm -f {} \;
fi
- name: Upload dist object
if: ${{ !inputs.generate-gpo }}
uses: actions/upload-artifact@v4
with:
retention-days: 5
name: windows-x64-obj-${{ matrix.arch == 'aarch64' && 'arm64' || matrix.arch }}
path: engine/obj-${{ matrix.arch == 'aarch64' && 'aarch64' || 'x86_64' }}-pc-windows-msvc/
- name: Upload artifact (if Twilight branch, binary)
if: ${{ inputs.release-branch == 'twilight' && !inputs.generate-gpo }}
uses: actions/upload-artifact@v4
with:
retention-days: 5
name: zen.win-${{ matrix.arch == 'aarch64' && 'arm64' || matrix.arch }}.zip
path: ./zen.win-${{ matrix.arch == 'aarch64' && 'arm64' || matrix.arch }}.zip
- name: Upload artifact (if Twilight branch, installer)
if: ${{ inputs.release-branch == 'twilight' && !inputs.generate-gpo }}
uses: actions/upload-artifact@v4
with:
retention-days: 5
name: zen.installer${{ matrix.arch == 'aarch64' && '-arm64' || '' }}.exe
path: ./zen.installer${{ matrix.arch == 'aarch64' && '-arm64' || '' }}.exe
- name: Upload artifact (if Twilight branch, .mar)
if: ${{ inputs.release-branch == 'twilight' && !inputs.generate-gpo }}
uses: actions/upload-artifact@v4
with:
retention-days: 5
name: windows${{ matrix.arch == 'aarch64' && '-arm64' || '' }}.mar
path: ./windows${{ matrix.arch == 'aarch64' && '-arm64' || '' }}.mar
- name: Upload artifact (if Twilight branch, update manifests)
if: ${{ inputs.release-branch == 'twilight' && !inputs.generate-gpo }}
uses: actions/upload-artifact@v4
with:
retention-days: 5
name: windows_update_manifest_${{ matrix.arch == 'aarch64' && 'arm64' || matrix.arch }}
path: ./dist/update