Build #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [master, develop] | |
pull_request: | |
branches: [master, develop] | |
workflow_dispatch: | |
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 Bins (x86) | |
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: Build velopack_nodeffi (x64) | |
run: cargo +1.75.0-x86_64-pc-windows-msvc build --target x86_64-pc-windows-msvc --release --package velopack_nodeffi | |
- name: Build velopack_nodeffi (arm64) | |
run: cargo +1.75.0-x86_64-pc-windows-msvc build --target aarch64-pc-windows-msvc --release --package velopack_nodeffi | |
- 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 | |
- name: Upload Rust Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rust-windows-latest-libs | |
path: | | |
target\*.node | |
- 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: Swatinem/rust-cache@v2 | |
with: | |
key: "rust-build-linux" | |
- name: Install Dependencies | |
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 | |
- name: Update Version | |
shell: pwsh | |
run: ./set-nbgv-version.ps1 | |
- name: Build Rust (x64) | |
run: | | |
cross 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 | |
- name: Build Rust (arm64) | |
run: | | |
cross 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 | |
- name: Upload Rust Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rust-ubuntu-latest | |
path: | | |
target/UpdateNix* | |
target/*.so | |
target/*.node | |
- name: Cancel workflow if failed | |
uses: andymckay/cancel-action@0.4 | |
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-${{ matrix.os }}" | |
- 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 | |
- name: Upload Rust Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rust-macos-latest | |
path: | | |
target/UpdateMac | |
target/*.dylib | |
target/*.node | |
- name: Cancel workflow if failed | |
uses: andymckay/cancel-action@0.4 | |
if: ${{ failure() }} | |
test-bins: | |
strategy: | |
matrix: | |
os: [macos-latest, 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: 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 | |
test-libs: | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check lib-nodejs | |
working-directory: src/lib-nodejs | |
run: | | |
npm install | |
npm run build | |
- name: Check lib-rust | |
run: cargo check -p velopack -F async,delta | |
- name: Check RustIced Sample | |
working-directory: samples/RustIced | |
run: cargo check | |
- uses: caesay/wait-artifact-action@494939e840383463b1686ce3624a8aab059c2c8b | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
max_wait_seconds: 900 | |
artifacts: rust-${{ matrix.os }} | |
verbose: true | |
- name: Download Rust Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: target/release | |
pattern: rust-${{ matrix.os }} | |
merge-multiple: true | |
- name: Test lib-nodejs | |
working-directory: src/lib-nodejs | |
run: npm run test | |
test-vpk: | |
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: | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.0.x | |
8.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 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-rust-macos] | |
steps: | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.0.x | |
8.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 bin-core | |
mkdir bin-nodejs | |
mkdir src/lib-nodejs/lib/native | |
mv target/release/*.node bin-nodejs/ | |
mv target/release/* bin-core/ | |
cp bin-nodejs/*.node src/lib-nodejs/lib/native/ | |
- name: Upload Core Bins | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bin-core | |
path: bin-core/* | |
- name: Upload Node Bins | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bin-nodejs | |
path: bin-nodejs/* | |
- 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 | |
release: | |
runs-on: ubuntu-latest | |
needs: [package, test-vpk, test-bins, test-libs] | |
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 }}" }' |