forked from velopack/velopack
-
Notifications
You must be signed in to change notification settings - Fork 0
282 lines (272 loc) · 10.2 KB
/
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
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
name: Build
on: [ push, pull_request ]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
test-rust:
strategy:
matrix:
os: [macos-13, macos-14, windows-latest, ubuntu-latest]
include:
- os: windows-latest
rust_flags: "--target i686-pc-windows-msvc --features windows"
- os: ubuntu-latest
rust_flags: "--target x86_64-unknown-linux-gnu"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dotnet/nbgv@master
with:
setAllVars: true
- 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: 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@v4
with:
file: ./test/coverage.rust.${{ matrix.os }}.xml
build-rust-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dotnet/nbgv@master
with:
setAllVars: true
- uses: Swatinem/rust-cache@v2
with:
key: "rust-build-windows"
- name: Install Windows7 Rust Toolchain
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
- name: Build Rust
run: cargo +1.75.0-x86_64-pc-windows-msvc build --target i686-pc-windows-msvc --features windows --release
- 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: Cancel workflow if failed
uses: andymckay/cancel-action@0.4
if: ${{ failure() }}
build-rust-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dotnet/nbgv@master
id: nbgv
with:
setAllVars: true
- uses: Swatinem/rust-cache@v2
with:
key: "rust-build-linux"
- name: Build Rust (x64)
run: |
cargo build --release --target x86_64-unknown-linux-gnu
cp ./target/x86_64-unknown-linux-gnu/release/update ./target/release/UpdateNix_x64
- name: Build Rust (arm64)
env:
CROSS_NuGetPackageVersion: ${{ steps.nbgv.outputs.NuGetPackageVersion }}
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall cross --no-confirm --force
cross build --release --target aarch64-unknown-linux-gnu
cp ./target/aarch64-unknown-linux-gnu/release/update ./target/release/UpdateNix_arm64
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-ubuntu-latest
path: target/release/UpdateNix*
- name: Cancel workflow if failed
uses: andymckay/cancel-action@0.4
if: ${{ failure() }}
build-rust-macos:
strategy:
matrix:
os: [macos-13, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dotnet/nbgv@master
with:
setAllVars: true
- uses: Swatinem/rust-cache@v2
with:
key: "rust-build-${{ matrix.os }}"
- name: Build Rust
run: |
cargo build --release
cp ./target/release/update ./target/release/UpdateMac
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-${{ matrix.os }}
path: target/release/UpdateMac
- name: Cancel workflow if failed
uses: andymckay/cancel-action@0.4
if: ${{ failure() }}
build-mac-universal:
runs-on: macos-latest
needs: [build-rust-macos]
steps:
- name: Download x64
uses: actions/download-artifact@v4
with:
name: rust-macos-13
path: macos-x64
- name: Download arm64
uses: actions/download-artifact@v4
with:
name: rust-macos-14
path: macos-arm64
- name: Create Universal Binary
run: |
mkdir -p macos-universal
lipo -create -output macos-universal/UpdateMac macos-x64/UpdateMac macos-arm64/UpdateMac
file macos-universal/UpdateMac
lipo -archs macos-universal/UpdateMac
- uses: geekyeggo/delete-artifact@v5
with:
name: rust-macos-*
- name: Upload Universal Binary
uses: actions/upload-artifact@v4
with:
name: rust-macos-latest
path: macos-universal/UpdateMac
- name: Cancel workflow if failed
uses: andymckay/cancel-action@0.4
if: ${{ failure() }}
test-dotnet:
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-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:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# - uses: actions/cache@v4
# with:
# path: ${{ github.workspace }}/.nuget/packages
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
# restore-keys: |
# ${{ runner.os }}-nuget-
- name: Install FUSE
run: |
sudo add-apt-repository universe
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: 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@v4
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-mac-universal]
steps:
- name: Print dotnet version
run: dotnet --info
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dotnet/nbgv@master
with:
setAllVars: true
- 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: 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
release:
runs-on: ubuntu-latest
needs: [package, test-dotnet, test-rust]
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 }}" }'