-
Notifications
You must be signed in to change notification settings - Fork 11
404 lines (390 loc) · 17.2 KB
/
ci.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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
name: CI
run-name: CI Build
on: [ push ]
jobs:
build-linux:
environment: PROD_2028
runs-on: ubuntu-latest
env:
CROSS_NO_WARNINGS: 0
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Docker Buildx
id: buildx
# Use the action from the master, as we've seen some inconsistencies with @v1
# Issue: https://github.com/docker/build-push-action/issues/286
uses: docker/setup-buildx-action@master
with:
install: true
- name: Build cross builder image for x86_64
uses: docker/build-push-action@v6
with:
context: ./cross/
builder: ${{ steps.buildx.outputs.name }}
file: cross/Dockerfile.linux_x86_64
push: false
tags: browsers.software/x86_64-unknown-linux-gnu-gtk:local
cache-from: type=gha,scope=x86_64
cache-to: type=gha,scope=x86_64,mode=max
load: true # load the created image into docker, so cross can find it
- name: Build cross builder image for aarch64
uses: docker/build-push-action@v6
with:
context: ./cross/
builder: ${{ steps.buildx.outputs.name }}
file: cross/Dockerfile.linux_aarch64
push: false
tags: browsers.software/aarch64-unknown-linux-gnu-gtk:local
cache-from: type=gha,scope=aarch64
cache-to: type=gha,scope=aarch64,mode=max
load: true # load the created image into docker, so cross can find it
- name: Build cross builder image for armv7
uses: docker/build-push-action@v6
with:
context: ./cross/
builder: ${{ steps.buildx.outputs.name }}
file: cross/Dockerfile.linux_armv7
push: false
tags: browsers.software/armv7-unknown-linux-gnueabihf-gtk:local
cache-from: type=gha,scope=armv7
cache-to: type=gha,scope=armv7,mode=max
load: true # load the created image into docker, so cross can find it
# even though we build inside a docker container via `cross`, then `cross` mounts
# target/
- name: Download cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
target/
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-
- name: Install signify
run: cargo install signify --target-dir ./target/signify
- name: Install cross
# cargo install does check if dependency already exists,
# but there's some conflict with github cache about it, so checking manually
run: cargo install --list --target-dir ./target/cross | grep cross || cargo install --force cross --git https://github.com/cross-rs/cross --target-dir ./target/cross
- name: Test x86_64 binary
run: |
CROSS_BUILD_OPTS="--builder ${{ steps.buildx.outputs.name }} --cache-from type=gha,scope=x86_64 --cache-to type=gha,scope=x86_64,mode=max" cross build --target x86_64-unknown-linux-gnu --release
- name: Test aarch64 binaries
run: |
CROSS_BUILD_OPTS="--builder ${{ steps.buildx.outputs.name }} --cache-from type=gha,scope=aarch64 --cache-to type=gha,scope=aarch64,mode=max" cross build --target aarch64-unknown-linux-gnu --release
- name: Test armv7 binaries
run: |
CROSS_BUILD_OPTS="--builder ${{ steps.buildx.outputs.name }} --cache-from type=gha,scope=armv7 --cache-to type=gha,scope=armv7,mode=max" cross build --target armv7-unknown-linux-gnueabihf --release
- name: Build binaries and package
env:
APPCAST_SECRET_KEY_BASE64: ${{ secrets.APPCAST_SECRET_KEY_BASE64 }}
run: |
mkdir -p secrets
echo $APPCAST_SECRET_KEY_BASE64 | base64 --decode > secrets/appcast_seckey
export APPCAST_SECRET_KEY_FILE="${GITHUB_WORKSPACE}/secrets/appcast_seckey"
./build-linux.sh
shell: bash
- name: Test installer
run: |
# desktop-file-utils is required for running install.sh (desktop-file-install and update-desktop-database)
sudo apt-get install -y --no-install-recommends desktop-file-utils
target_dir='target/universal-unknown-linux-gnu/release'
cd "$target_dir"
set -x
./install.sh
shell: bash
- name: End-to-end test - run Browsers
run: |
install_dir="$HOME/.local/bin"
cd "$install_dir"
#set -x
command_output="$(./browsers --no-gui https://browsers.software)"
echo "$command_output"
if echo "$command_output" | grep -q 'Firefox Web Browser'; then
echo "matched Firefox Web Browser"
fi
if echo "$command_output" | grep -q 'Google Chrome'; then
echo "matched Google Chrome"
fi
if echo "$command_output" | grep -q 'Microsoft Edge'; then
echo "matched Microsoft Edge"
fi
shell: bash
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: browsers-linux-artifacts
path: |
target/universal-unknown-linux-gnu/release/browsers_linux.tar.gz
target/universal-unknown-linux-gnu/release/browsers_linux.tar.gz.sha256
target/universal-unknown-linux-gnu/release/browsers_linux.tar.gz.sig
target/universal-unknown-linux-gnu/release/browsers_linux.tar.xz
target/universal-unknown-linux-gnu/release/browsers_linux.tar.xz.sha256
target/universal-unknown-linux-gnu/release/browsers_linux.tar.xz.sig
target/universal-unknown-linux-gnu/release/x86_64/browsers_amd64.deb
target/universal-unknown-linux-gnu/release/aarch64/browsers_arm64.deb
target/universal-unknown-linux-gnu/release/armv7l/browsers_armhf.deb
target/universal-unknown-linux-gnu/release/x86_64/browsers.x86_64.rpm
target/universal-unknown-linux-gnu/release/aarch64/browsers.aarch64.rpm
target/universal-unknown-linux-gnu/release/armv7l/browsers.armhfp.rpm
build-macos:
environment: PROD_2028
runs-on: macos-14
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
show-progress: false
- name: Download cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
target/
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-
- name: Install signify
run: cargo install signify --target-dir ./target/signify
- name: Install apple-codesign
run: cargo install apple-codesign --target-dir ./target/apple-codesign
- name: Add Rust targets
run: |
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
- name: Test x86_64 binary
run: |
export MACOSX_DEPLOYMENT_TARGET=10.7
cargo build --target x86_64-apple-darwin --release
shell: bash
- name: Test aarch64 binaries
run: |
export MACOSX_DEPLOYMENT_TARGET=10.7
cargo build --target aarch64-apple-darwin --release
shell: bash
- name: Build Universal Binary
run: |
rm -rf target/universal-apple-darwin/release/
mkdir -p target/universal-apple-darwin/release/
lipo -create -output target/universal-apple-darwin/release/Browsers target/x86_64-apple-darwin/release/browsers target/aarch64-apple-darwin/release/browsers
- name: Build with signing
env:
APPLE_DEVELOPER_ID_APP_P12_BASE64: ${{ secrets.APPLE_DEVELOPER_ID_APP_P12 }}
P12_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_APP_P12_PASSWORD }}
APP_STORE_CONNECT_JSON: ${{ secrets.APP_STORE_CONNECT_JSON }}
APPCAST_SECRET_KEY_BASE64: ${{ secrets.APPCAST_SECRET_KEY_BASE64 }}
run: |
mkdir -p secrets
echo $APPLE_DEVELOPER_ID_APP_P12_BASE64 | base64 --decode > secrets/DeveloperIDApplication.p12
export P12_FILE="${GITHUB_WORKSPACE}/secrets/DeveloperIDApplication.p12"
echo $APPCAST_SECRET_KEY_BASE64 | base64 --decode > secrets/appcast_seckey
export APPCAST_SECRET_KEY_FILE="${GITHUB_WORKSPACE}/secrets/appcast_seckey"
echo $APP_STORE_CONNECT_JSON > secrets/app_store_connect.json
export NOTARY_API_KEY_JSON_FILE="${GITHUB_WORKSPACE}/secrets/app_store_connect.json"
echo "1. P12_FILE=$P12_FILE"
./build-mac.sh
shell: bash
- name: Test app dir
run: |
target_dir='target/universal-apple-darwin/release'
cd "$target_dir"
cd "./Browsers.app/"
set -x
ls -altrh .
ls -altrh ./Contents/Resources/
shell: bash
- name: End-to-end test - run Browsers
run: |
target_dir='target/universal-apple-darwin/release'
cd "$target_dir"
#set -x
touch ./output_file
open ./Browsers.app -W --stdout output_file --stderr output_file --args --no-gui https://browsers.software
command_output=`cat ./output_file`
echo "$command_output"
if echo "$command_output" | grep -q 'Safari'; then
echo "matched Safari"
fi
if echo "$command_output" | grep -q 'Chrome'; then
echo "matched Chrome"
fi
if echo "$command_output" | grep -q 'Google Chrome for Testing'; then
echo "matched Google Chrome for Testing"
fi
# special shell script to make tty working
shell: 'script -q /dev/null bash -e {0}'
- name: Upload mac artifacts
uses: actions/upload-artifact@v4
with:
name: browsers-mac-artifacts
path: |
target/universal-apple-darwin/release/Browsers.dmg
target/universal-apple-darwin/release/browsers_mac.tar.gz
target/universal-apple-darwin/release/browsers_mac.tar.gz.sha256
target/universal-apple-darwin/release/browsers_mac.tar.gz.sig
target/universal-apple-darwin/release/browsers_mac.tar.xz
target/universal-apple-darwin/release/browsers_mac.tar.xz.sha256
target/universal-apple-darwin/release/browsers_mac.tar.xz.sig
build-windows:
environment: PROD_2028
runs-on: windows-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
show-progress: false
- name: Download cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
target/
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-
- name: Install signify
run: cargo install signify --target-dir ./target/signify
- name: Add Rust targets
run: |
rustup target add x86_64-pc-windows-msvc
rustup target add aarch64-pc-windows-msvc
- name: Test x86_64 binary
run: |
cargo build --target x86_64-pc-windows-msvc --release
shell: bash
- name: Test aarch64 binary
run: |
cargo build --target aarch64-pc-windows-msvc --release
shell: bash
- name: Install tools
run: |
curl https://raw.githubusercontent.com/Browsers-software/ci-utils/main/zip/bzip2.dll -o bzip2.dll
curl https://raw.githubusercontent.com/Browsers-software/ci-utils/main/zip/zip.exe -o zip.exe
cp bzip2.dll "C:\Program Files\Git\mingw64\bin"
cp zip.exe "C:\Program Files\Git\mingw64\bin"
shell: bash
- name: Build binaries and package
env:
APPCAST_SECRET_KEY_BASE64: ${{ secrets.APPCAST_SECRET_KEY_BASE64 }}
run: |
mkdir -p secrets
echo $APPCAST_SECRET_KEY_BASE64 | base64 --decode > secrets/appcast_seckey
export APPCAST_SECRET_KEY_FILE="${GITHUB_WORKSPACE}/secrets/appcast_seckey"
./build-windows.sh
shell: bash
- name: Test installer
run: |
target_dir='target/universal-pc-windows-msvc/release'
cd "$target_dir"
set -x
./install.bat --silent
shell: bash
- name: End-to-end test - run Browsers
run: |
install_dir="$PROGRAMFILES/software.Browsers"
cd "$install_dir"
#set -x
command_output="$(./browsers.exe --no-gui https://browsers.software)"
echo "$command_output"
if echo "$command_output" | grep -q 'Mozilla Firefox'; then
echo "matched Mozilla Firefox"
fi
if echo "$command_output" | grep -q 'Google Chrome'; then
echo "matched Google Chrome"
fi
if echo "$command_output" | grep -q 'Internet Explorer'; then
echo "matched Internet Explorer"
fi
if echo "$command_output" | grep -q ' Microsoft Edge (Profile 1)'; then
echo "matched Microsoft Edge (Profile 1)"
fi
shell: bash
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: browsers-windows-artifacts
path: |
target/universal-pc-windows-msvc/release/Browsers_windows.zip
target/universal-pc-windows-msvc/release/browsers_windows.tar.gz
target/universal-pc-windows-msvc/release/browsers_windows.tar.gz.sha256
target/universal-pc-windows-msvc/release/browsers_windows.tar.gz.sig
target/universal-pc-windows-msvc/release/browsers_windows.tar.xz
target/universal-pc-windows-msvc/release/browsers_windows.tar.xz.sha256
target/universal-pc-windows-msvc/release/browsers_windows.tar.xz.sig
release:
needs: [ build-linux, build-macos, build-windows ]
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
show-progress: false
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
pattern: browsers-*-artifacts
- name: Verify directories exist
run: |
[ -e "browsers-linux-artifacts" ]
[ -e "browsers-mac-artifacts" ]
[ -e "browsers-windows-artifacts" ]
shell: bash
- name: Generate Changelog
if: startsWith(github.ref, 'refs/tags/')
# Search from CHANGELOG.md for the changelog of the version (tag name)
run: ./tools/extract_release_notes.sh ${{ github.ref_name }} < CHANGELOG.md > ${{ github.workspace }}-RELEASE_NOTES.md
shell: bash
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ${{ github.workspace }}-RELEASE_NOTES.md
fail_on_unmatched_files: true
files: |
browsers-linux-artifacts/browsers_linux.tar.gz
browsers-linux-artifacts/browsers_linux.tar.gz.sha256
browsers-linux-artifacts/browsers_linux.tar.gz.sig
browsers-linux-artifacts/browsers_linux.tar.xz
browsers-linux-artifacts/browsers_linux.tar.xz.sha256
browsers-linux-artifacts/browsers_linux.tar.xz.sig
browsers-linux-artifacts/x86_64/browsers_amd64.deb
browsers-linux-artifacts/aarch64/browsers_arm64.deb
browsers-linux-artifacts/armv7l/browsers_armhf.deb
browsers-linux-artifacts/x86_64/browsers.x86_64.rpm
browsers-linux-artifacts/aarch64/browsers.aarch64.rpm
browsers-linux-artifacts/armv7l/browsers.armhfp.rpm
browsers-mac-artifacts/Browsers.dmg
browsers-mac-artifacts/browsers_mac.tar.gz
browsers-mac-artifacts/browsers_mac.tar.gz.sha256
browsers-mac-artifacts/browsers_mac.tar.gz.sig
browsers-mac-artifacts/browsers_mac.tar.xz
browsers-mac-artifacts/browsers_mac.tar.xz.sha256
browsers-mac-artifacts/browsers_mac.tar.xz.sig
browsers-windows-artifacts/Browsers_windows.zip
browsers-windows-artifacts/browsers_windows.tar.gz
browsers-windows-artifacts/browsers_windows.tar.gz.sha256
browsers-windows-artifacts/browsers_windows.tar.gz.sig
browsers-windows-artifacts/browsers_windows.tar.xz
browsers-windows-artifacts/browsers_windows.tar.xz.sha256
browsers-windows-artifacts/browsers_windows.tar.xz.sig