forked from velopack/velopack
-
Notifications
You must be signed in to change notification settings - Fork 0
462 lines (444 loc) · 18.3 KB
/
Copy pathbuild.yml
File metadata and controls
462 lines (444 loc) · 18.3 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
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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
name: Build
on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
workflow_dispatch:
permissions:
id-token: write
actions: write
contents: read
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
build-rust-windows:
runs-on: windows-latest
env:
RUSTFLAGS: -C target-feature=+crt-static
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2
with:
key: "rust-build-windows"
- name: Install Dependencies
run: |
rustup toolchain install 1.75.0-x86_64-pc-windows-msvc
rustup target add i686-pc-windows-msvc --toolchain 1.75.0-x86_64-pc-windows-msvc
rustup target add aarch64-pc-windows-msvc --toolchain 1.75.0-x86_64-pc-windows-msvc
- name: Update Version
shell: pwsh
run: .\set-nbgv-version.ps1
- name: Build Rust Binaries
run: cargo +1.75.0-x86_64-pc-windows-msvc build --target i686-pc-windows-msvc --features windows --release -p velopack_bins
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-windows-latest
path: |
target\i686-pc-windows-msvc\release\*.exe
target\i686-pc-windows-msvc\release\*.pdb
- name: Build Rust (x86)
run: cargo +1.75.0-x86_64-pc-windows-msvc build --target i686-pc-windows-msvc --release -p velopack_nodeffi -p velopack_libc
- name: Build Rust (x64)
run: cargo +1.75.0-x86_64-pc-windows-msvc build --target x86_64-pc-windows-msvc --release -p velopack_nodeffi -p velopack_libc
- name: Build Rust (arm64)
run: cargo +1.75.0-x86_64-pc-windows-msvc build --target aarch64-pc-windows-msvc --release -p velopack_nodeffi -p velopack_libc
- name: Collect Artifacts
run: |
move target\i686-pc-windows-msvc\release\velopack_nodeffi.dll target\velopack_nodeffi_win_x86_msvc.node
move target\x86_64-pc-windows-msvc\release\velopack_nodeffi.dll target\velopack_nodeffi_win_x64_msvc.node
move target\aarch64-pc-windows-msvc\release\velopack_nodeffi.dll target\velopack_nodeffi_win_arm64_msvc.node
move target\i686-pc-windows-msvc\release\velopack_libc.dll target\velopack_libc_win_x86_msvc.dll
move target\x86_64-pc-windows-msvc\release\velopack_libc.dll target\velopack_libc_win_x64_msvc.dll
move target\aarch64-pc-windows-msvc\release\velopack_libc.dll target\velopack_libc_win_arm64_msvc.dll
move target\i686-pc-windows-msvc\release\velopack_libc.dll.lib target\velopack_libc_win_x86_msvc.dll.lib
move target\x86_64-pc-windows-msvc\release\velopack_libc.dll.lib target\velopack_libc_win_x64_msvc.dll.lib
move target\aarch64-pc-windows-msvc\release\velopack_libc.dll.lib target\velopack_libc_win_arm64_msvc.dll.lib
move target\i686-pc-windows-msvc\release\velopack_libc.lib target\velopack_libc_win_x86_msvc.lib
move target\x86_64-pc-windows-msvc\release\velopack_libc.lib target\velopack_libc_win_x64_msvc.lib
move target\aarch64-pc-windows-msvc\release\velopack_libc.lib target\velopack_libc_win_arm64_msvc.lib
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-windows-latest-libs
path: |
target\*.node
target\*.dll
target\*.lib
- name: Cancel workflow if failed
uses: andymckay/cancel-action@0.5
if: ${{ failure() }}
build-rust-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2
with:
key: "rust-build-linux"
- name: Install Dependencies
run: |
rustup target add aarch64-unknown-linux-gnu
sudo apt update
sudo apt install -y g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
- name: Update Version
shell: pwsh
run: ./set-nbgv-version.ps1
- name: Build Rust (x64)
run: |
cargo build --release --target x86_64-unknown-linux-gnu
ldd ./target/x86_64-unknown-linux-gnu/release/update || true
cp ./target/x86_64-unknown-linux-gnu/release/update ./target/UpdateNix_x64
cp ./target/x86_64-unknown-linux-gnu/release/libvelopack_nodeffi.so ./target/velopack_nodeffi_linux_x64_gnu.node
cp ./target/x86_64-unknown-linux-gnu/release/libvelopack_libc.so ./target/velopack_libc_linux_x64_gnu.so
cp ./target/x86_64-unknown-linux-gnu/release/libvelopack_libc.a ./target/velopack_libc_linux_x64_gnu.a
- name: Build Rust (arm64)
run: |
cargo build --release --target aarch64-unknown-linux-gnu
ldd ./target/aarch64-unknown-linux-gnu/release/update || true
cp ./target/aarch64-unknown-linux-gnu/release/update ./target/UpdateNix_arm64
cp ./target/aarch64-unknown-linux-gnu/release/libvelopack_nodeffi.so ./target/velopack_nodeffi_linux_arm64_gnu.node
cp ./target/aarch64-unknown-linux-gnu/release/libvelopack_libc.so ./target/velopack_libc_linux_arm64_gnu.so
cp ./target/aarch64-unknown-linux-gnu/release/libvelopack_libc.a ./target/velopack_libc_linux_arm64_gnu.a
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-ubuntu-latest
path: |
target/UpdateNix*
target/*.so
target/*.node
target/*.a
- name: Cancel workflow if failed
uses: andymckay/cancel-action@0.5
if: ${{ failure() }}
build-rust-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2
with:
key: "rust-build-macos"
- name: Install Dependencies
run: |
rustup target add x86_64-apple-darwin
dotnet tool update -g nbgv
- name: Update Version
shell: pwsh
run: ./set-nbgv-version.ps1
- name: Build Rust (x64)
run: |
cargo build --release --target x86_64-apple-darwin
otool -L ./target/x86_64-apple-darwin/release/update
- name: Build Rust (arm64)
run: |
cargo build --release --target aarch64-apple-darwin
otool -L ./target/aarch64-apple-darwin/release/update
- name: Create Universal Binary
run: |
lipo -create -output ./target/UpdateMac ./target/x86_64-apple-darwin/release/update ./target/aarch64-apple-darwin/release/update
file ./target/UpdateMac
lipo -create -output ./target/velopack_nodeffi_osx.node ./target/x86_64-apple-darwin/release/libvelopack_nodeffi.dylib ./target/aarch64-apple-darwin/release/libvelopack_nodeffi.dylib
file ./target/velopack_nodeffi_osx.node
lipo -create -output ./target/velopack_libc_osx.dylib ./target/x86_64-apple-darwin/release/libvelopack_libc.dylib ./target/aarch64-apple-darwin/release/libvelopack_libc.dylib
file ./target/velopack_libc_osx.dylib
cp ./target/x86_64-apple-darwin/release/libvelopack_libc.a ./target/velopack_libc_osx_x64_gnu.a
cp ./target/aarch64-apple-darwin/release/libvelopack_libc.a ./target/velopack_libc_osx_arm64_gnu.a
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-macos-latest
path: |
target/UpdateMac
target/*.dylib
target/*.node
target/*.a
- name: Cancel workflow if failed
uses: andymckay/cancel-action@0.5
if: ${{ failure() }}
test-bins:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
rust_flags: "--features windows"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2
with:
key: "rust-test-${{ matrix.os }}"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Check lib-rust
run: cargo check -p velopack -F async,delta
- name: Check lib-nodejs
working-directory: src/lib-nodejs
run: |
npm install
npm run build
npm run test
- name: Test Rust
run: cargo llvm-cov ${{ matrix.rust_flags }} --cobertura --output-path ./test/coverage.rust.${{ matrix.os }}.xml
- name: Upload Coverage
uses: codecov/codecov-action@v5
with:
files: ./test/coverage.rust.${{ matrix.os }}.xml
test-vpk:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
VELOPACK_GITHUB_TEST_TOKEN: ${{ secrets.VELOPACK_GITHUB_TEST_TOKEN }}
VELOPACK_B2_TEST_TOKEN: ${{ secrets.VELOPACK_B2_TEST_TOKEN }}
VELOPACK_AZ_TEST_TOKEN: ${{ secrets.VELOPACK_AZ_TEST_TOKEN }}
steps:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Print dotnet version
run: dotnet --info
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install FUSE
run: |
sudo add-apt-repository universe
sudo apt update
sudo apt install libfuse2
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Install squashfs-tools
run: brew install squashfs
if: ${{ matrix.os == 'macos-latest' }}
- name: Install dotnet-coverage
run: dotnet tool install -g dotnet-coverage
- name: Build .NET
run: dotnet build -c Release
- uses: caesay/wait-artifact-action@494939e840383463b1686ce3624a8aab059c2c8b
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_wait_seconds: 900
artifacts: rust-macos-latest,rust-windows-latest,rust-ubuntu-latest
verbose: true
- name: Download Rust Artifacts
uses: actions/download-artifact@v4
with:
path: target/release
pattern: rust-*
merge-multiple: true
- name: Azure login
uses: azure/login@v2
if: github.repository == 'velopack/velopack'
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Test Velopack.Tests
run: dotnet test test/Velopack.Tests/Velopack.Tests.csproj --no-build -c Release -l "console;verbosity=detailed;consoleLoggerParameters=ErrorsOnly" -l GithubActions -- RunConfiguration.CollectSourceInformation=true
- name: Test Velopack.Packaging.Tests
run: dotnet test test/Velopack.Packaging.Tests/Velopack.Packaging.Tests.csproj --no-build -c Release -l "console;verbosity=detailed;consoleLoggerParameters=ErrorsOnly" -l GithubActions -- RunConfiguration.CollectSourceInformation=true
- name: Test Velopack.CommandLine.Tests
run: dotnet test test/Velopack.CommandLine.Tests/Velopack.CommandLine.Tests.csproj --no-build -c Release -l "console;verbosity=detailed;consoleLoggerParameters=ErrorsOnly" -l GithubActions -- RunConfiguration.CollectSourceInformation=true
- name: Upload Cross-Compile Artifacts
uses: actions/upload-artifact@v4
with:
name: cross-${{ matrix.os }}
path: test/artifacts/*
- name: Upload Coverage
uses: codecov/codecov-action@v5
with:
directory: ./test
- uses: caesay/wait-artifact-action@494939e840383463b1686ce3624a8aab059c2c8b
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_wait_seconds: 900
artifacts: cross-macos-latest,cross-ubuntu-latest,cross-windows-latest
verbose: true
- name: Download Cross Artifacts
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' }}
uses: actions/download-artifact@v4
with:
path: test/artifacts
pattern: cross-*
merge-multiple: true
- name: Test Cross-Compiled Apps
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' }}
env:
VELOPACK_CROSS_ARTIFACTS: true
run: dotnet test test/Velopack.Packaging.Tests/Velopack.Packaging.Tests.csproj --no-build -c Release --filter "FullyQualifiedName~RunCrossApp" -l "console;verbosity=detailed;consoleLoggerParameters=ErrorsOnly" -l GithubActions -- RunConfiguration.CollectSourceInformation=true
package:
runs-on: ubuntu-latest
needs: [build-rust-windows, build-rust-linux, build-rust-macos]
steps:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Print dotnet version
run: dotnet --info
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Update Version
shell: pwsh
run: ./set-nbgv-version.ps1
- name: Download Rust Artifacts
uses: actions/download-artifact@v4
with:
path: target/release
pattern: rust-*
merge-multiple: true
- name: Build .NET
run: dotnet build -c Release /p:PackRustAssets=true /p:ContinuousIntegrationBuild=true
- name: Build lib-nodejs
working-directory: src/lib-nodejs
run: |
npm install
npm run build
- name: Write Version File
run: echo $NBGV_NuGetPackageVersion > version.txt
- name: Upload version file as artifact
uses: actions/upload-artifact@v4
with:
name: build-version
path: version.txt
- name: Upload Package Artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: build/Release/*nupkg
- name: Rearrange Artifacts
run: |
mkdir src/lib-nodejs/lib/native
mv target/release/*.node src/lib-nodejs/lib/native/
mkdir lib-c
mkdir lib-c/lib
mkdir lib-c/lib-static
mkdir lib-c/include
mv target/release/*.so lib-c/lib/
mv target/release/*.dylib lib-c/lib/
mv target/release/*.dll lib-c/lib/
mv target/release/*.dll.lib lib-c/lib/
mv target/release/*.a lib-c/lib-static/
mv target/release/*.lib lib-c/lib-static/
cp src/lib-cpp/include/* lib-c/include/
mkdir bin-core
mv target/release/* bin-core/
- name: Upload Core Bins
uses: actions/upload-artifact@v4
with:
name: bin-core
path: bin-core/*
- name: Upload lib-c
uses: actions/upload-artifact@v4
with:
name: lib-c
path: lib-c/*
- name: Pack lib-nodejs
working-directory: src/lib-nodejs
run: npm pack
- name: Pack lib-rust
run: cargo package -p velopack --allow-dirty
- name: Upload lib-nodejs package
uses: actions/upload-artifact@v4
with:
name: lib-nodejs
path: src/lib-nodejs/velopack-*.tgz
- name: Upload lib-rust package
uses: actions/upload-artifact@v4
with:
name: lib-rust
path: target/package/velopack-*.crate
samples:
strategy:
fail-fast: false
matrix:
sample: [CPlusPlusWidgets, CPlusPlusWin32, CSharpAvalonia, CSharpWpf, NodeJSElectron, RustIced]
os: [windows-latest, ubuntu-latest, macos-latest]
exclude:
- os: ubuntu-latest
sample: CPlusPlusWin32
- os: macos-latest
sample: CPlusPlusWin32
- os: ubuntu-latest
sample: CSharpWpf
- os: macos-latest
sample: CSharpWpf
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install wxWidgets (Windows)
working-directory: samples/${{ matrix.sample }}
run: |
curl -L -o wxWidgets-3.2.6-headers.7z https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.6/wxWidgets-3.2.6-headers.7z
curl -L -o wxMSW-3.2.6_vc14x_x64_Dev.7z https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.6/wxMSW-3.2.6_vc14x_x64_Dev.7z
curl -L -o wxMSW-3.2.6_vc14x_x64_ReleaseDLL.7z https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.6/wxMSW-3.2.6_vc14x_x64_ReleaseDLL.7z
7z x wxWidgets-3.2.6-headers.7z -o".\wxWidgets" -y
7z x wxMSW-3.2.6_vc14x_x64_Dev.7z -o".\wxWidgets" -y
7z x wxMSW-3.2.6_vc14x_x64_ReleaseDLL.7z -o".\wxWidgets" -y
dir wxWidgets
if: ${{ matrix.sample == 'CPlusPlusWidgets' && matrix.os == 'windows-latest' }}
- name: Install wxWidgets (MacOS)
run: brew install wxwidgets
if: ${{ matrix.sample == 'CPlusPlusWidgets' && matrix.os == 'macos-latest' }}
- name: Install wxWidgets (Linux)
run: |
sudo apt update
sudo apt-cache search libwxgt*
sudo apt-cache search libgtk*
sudo apt install -y libwxgtk3.2-dev libgtk-3-dev
if: ${{ matrix.sample == 'CPlusPlusWidgets' && matrix.os == 'ubuntu-latest' }}
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Install VPK
run: dotnet tool install -g vpk
- name: Pack Sample (Windows)
working-directory: samples/${{ matrix.sample }}
run: .\build.bat 1.0.0
if: ${{ matrix.os == 'windows-latest' }}
- name: Pack Sample (Unix)
working-directory: samples/${{ matrix.sample }}
run: |
chmod 755 ./build.sh
./build.sh 1.0.0
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' }}
release:
runs-on: ubuntu-latest
needs: [package, test-vpk, test-bins, samples]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Invoke Release Workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: release.yml
inputs: '{ "workflow_run_id": "${{ github.run_id }}" }'