This commit is contained in:
Caelan Sayler
2025-06-14 15:09:24 +01:00
committed by Caelan
parent 314d544cd5
commit dacdfe37f8
8 changed files with 763 additions and 456 deletions

27
.github/actions/job-setup/action.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: "Setup Job Environment"
description: "Installs dependencies like dotnet, rust, etc."
runs:
using: "composite"
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
shell: pwsh
run: dotnet --info
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install NBGV CLI
shell: pwsh
run: dotnet tool update -g nbgv
- uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Update Project Version
shell: pwsh
run: ./.github/set-nbgv-version.ps1

View File

@@ -0,0 +1,90 @@
name: "Wait for Artifacts"
description: "Wait for artifacts to be available before continuing"
inputs:
artifacts:
description: "A list of artifact names to wait for"
required: true
token:
description: "GitHub token"
required: true
max_wait_seconds:
description: "Maximum number of seconds to wait for the artifact"
required: false
default: "300"
repository:
description: "The GitHub repository (e.g., owner/repo)"
required: false
default: ${{ github.repository }}
workflow_run_id:
description: "The workflow run ID"
required: false
default: ${{ github.run_id }}
verbose:
description: "Enable verbose logging"
required: false
default: "false"
runs:
using: "composite"
steps:
- name: Wait for artifacts
shell: pwsh
env:
GH_TOKEN: ${{ inputs.token }}
run: |
# Parse the artifacts input
$artifactInput = '${{ inputs.artifacts }}'
$artifactNames = $artifactInput -split ',|;|`n'
$artifactNames = $artifactNames | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne '' }
# Get other inputs
$maxWaitSeconds = [int]"${{ inputs.max_wait_seconds }}"
$maxAttempts = [math]::Round($maxWaitSeconds / 10)
$sleepSeconds = 10
$attempt = 0
$workflowRunId = "${{ inputs.workflow_run_id }}"
$repository = "${{ inputs.repository }}"
$verbose = [bool]"${{ inputs.verbose }}"
$artifactsAvailable = @{}
foreach ($artifactName in $artifactNames) {
$artifactsAvailable[$artifactName.Trim()] = $false
}
# Verbose logging
if ($verbose) {
Write-Host "Parameters:"
Write-Host " Artifacts: $artifactInput"
Write-Host " Parsed Artifacts: $($artifactNames -join ', ')"
Write-Host " Max Wait Seconds: $maxWaitSeconds"
Write-Host " Max Attempts: $maxAttempts"
Write-Host " Sleep Seconds: $sleepSeconds"
Write-Host " Workflow Run ID: $workflowRunId"
Write-Host " Repository: $repository"
Write-Host " Verbose: $verbose"
}
Write-Host "Waiting for artifacts '$($artifactNames -join ', ')' to become available in workflow run $workflowRunId..."
while ($attempt -lt $maxAttempts -and $artifactsAvailable.Values -contains $false) {
$artifactsJson = gh api repos/$repository/actions/runs/$workflowRunId/artifacts
$artifacts = $artifactsJson | ConvertFrom-Json
foreach ($artifactName in $artifactNames) {
if ($artifacts.artifacts | Where-Object { $_.name -eq $artifactName.Trim() }) {
$artifactsAvailable[$artifactName.Trim()] = $true
}
}
$waitingFor = $artifactsAvailable.GetEnumerator() | Where-Object { $_.Value -eq $false } | ForEach-Object { $_.Key }
if ($waitingFor.Count -gt 0) {
Write-Host "Still waiting for: $($waitingFor -join ', '). Attempt $($attempt + 1)/$maxAttempts"
Start-Sleep -Seconds $sleepSeconds
$attempt++
}
}
if ($artifactsAvailable.Values -contains $false) {
Write-Host "Error: Not all artifacts became available in time."
exit 1
} else {
Write-Host "All artifacts are available, continuing..."
}

97
.github/workflows/build-packages.yml vendored Normal file
View File

@@ -0,0 +1,97 @@
name: Build Packages
on:
workflow_call:
jobs:
package:
runs-on: ubuntu-latest
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: ./.github/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

173
.github/workflows/build-python.yml vendored Normal file
View File

@@ -0,0 +1,173 @@
name: Build Python
on:
workflow_call:
jobs:
build-python-linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-22.04
target: armv7
- runner: ubuntu-22.04
target: s390x
- runner: ubuntu-22.04
target: ppc64le
steps:
- uses: ./.github/actions/job-setup
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: src/lib-python
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: auto
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
working-directory: src/lib-python
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: src/lib-python/dist
build-python-musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-22.04
target: armv7
steps:
- uses: ./.github/actions/job-setup
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: src/lib-python
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: musllinux_1_2
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
working-directory: src/lib-python
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: src/lib-python/dist
build-python-windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: ./.github/actions/job-setup
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: src/lib-python
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
working-directory: src/lib-python
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: src/lib-python/dist
build-python-macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-13
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: ./.github/actions/job-setup
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: src/lib-python
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
working-directory: src/lib-python
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: src/lib-python/dist
build-python-sdist:
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/job-setup
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
working-directory: src/lib-python
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: src/lib-python/dist

161
.github/workflows/build-rust.yml vendored Normal file
View File

@@ -0,0 +1,161 @@
name: Build Rust
on:
workflow_call:
jobs:
build-rust-windows:
runs-on: windows-latest
env:
RUSTFLAGS: -C target-feature=+crt-static
steps:
- uses: ./.github/actions/job-setup
- uses: Swatinem/rust-cache@v2
with:
key: "rust-build-windows"
- name: Install Dependencies
run: |
rustup target add aarch64-pc-windows-msvc --toolchain nightly-x86_64-pc-windows-msvc
rustup component add rust-src --toolchain nightly-x86_64-pc-windows-msvc
- name: Build Rust Binaries (x86)
run: cargo +nightly build --target i686-win7-windows-msvc -Z build-std="core,alloc,std,panic_abort" --features windows --release -p velopack_bins
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-windows-latest
path: |
target\i686-win7-windows-msvc\release\*.exe
target\i686-win7-windows-msvc\release\*.pdb
- name: Build Rust (x86)
run: cargo +nightly build --target i686-win7-windows-msvc -Z build-std="core,alloc,std,panic_abort" --release -p velopack_nodeffi -p velopack_libc
- name: Build Rust (x64)
run: cargo +nightly build --target x86_64-win7-windows-msvc -Z build-std="core,alloc,std,panic_abort" --release -p velopack_nodeffi -p velopack_libc
- name: Build Rust (arm64)
run: cargo +nightly build --target aarch64-pc-windows-msvc --release -p velopack_nodeffi -p velopack_libc
- name: Collect Artifacts
run: |
move target\i686-win7-windows-msvc\release\velopack_nodeffi.dll target\velopack_nodeffi_win_x86_msvc.node
move target\x86_64-win7-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-win7-windows-msvc\release\velopack_libc.dll target\velopack_libc_win_x86_msvc.dll
move target\x86_64-win7-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-win7-windows-msvc\release\velopack_libc.dll.lib target\velopack_libc_win_x86_msvc.dll.lib
move target\x86_64-win7-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-win7-windows-msvc\release\velopack_libc.lib target\velopack_libc_win_x86_msvc.lib
move target\x86_64-win7-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: ./.github/actions/job-setup
- 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
rustup target add aarch64-unknown-linux-gnu
sudo apt update
sudo apt install -y g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
mkdir ./artifacts
# rustup target add x86_64-unknown-linux-musl
# rustup target add aarch64-unknown-linux-musl
# sudo apt install -y g++-aarch64-linux-gnu gcc-aarch64-linux-gnu musl-tools musl:arm64
- name: Build Rust Binaries (x64)
run: |
cargo clean
cross build --release --target x86_64-unknown-linux-musl -p velopack_bins
ldd ./target/x86_64-unknown-linux-musl/release/update || true
cp ./target/x86_64-unknown-linux-musl/release/update ./artifacts/UpdateNix_x64
- name: Build Rust Binaries (arm64)
run: |
cargo clean
cross build --release --target aarch64-unknown-linux-musl -p velopack_bins
ldd ./target/aarch64-unknown-linux-musl/release/update || true
cp ./target/aarch64-unknown-linux-musl/release/update ./artifacts/UpdateNix_arm64
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-ubuntu-latest
path: |
artifacts/UpdateNix*
- name: Build Rust (x64)
run: |
cargo clean
cargo build --release --target x86_64-unknown-linux-gnu -p velopack_nodeffi -p velopack_libc
cp ./target/x86_64-unknown-linux-gnu/release/libvelopack_nodeffi.so ./artifacts/velopack_nodeffi_linux_x64_gnu.node
cp ./target/x86_64-unknown-linux-gnu/release/libvelopack_libc.so ./artifacts/velopack_libc_linux_x64_gnu.so
cp ./target/x86_64-unknown-linux-gnu/release/libvelopack_libc.a ./artifacts/velopack_libc_linux_x64_gnu.a
- name: Build Rust (arm64)
run: |
cargo clean
cargo build --release --target aarch64-unknown-linux-gnu -p velopack_nodeffi -p velopack_libc
cp ./target/aarch64-unknown-linux-gnu/release/libvelopack_nodeffi.so ./artifacts/velopack_nodeffi_linux_arm64_gnu.node
cp ./target/aarch64-unknown-linux-gnu/release/libvelopack_libc.so ./artifacts/velopack_libc_linux_arm64_gnu.so
cp ./target/aarch64-unknown-linux-gnu/release/libvelopack_libc.a ./artifacts/velopack_libc_linux_arm64_gnu.a
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-ubuntu-latest-libs
path: |
artifacts/*.so
artifacts/*.node
artifacts/*.a
- name: Cancel workflow if failed
uses: andymckay/cancel-action@0.5
if: ${{ failure() }}
build-rust-macos:
runs-on: macos-latest
steps:
- uses: ./.github/actions/job-setup
- uses: Swatinem/rust-cache@v2
with:
key: "rust-build-macos"
- name: Install Dependencies
run: |
rustup target add x86_64-apple-darwin
- 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() }}

65
.github/workflows/build-samples.yml vendored Normal file
View File

@@ -0,0 +1,65 @@
name: Build Samples
on:
workflow_call:
jobs:
samples:
strategy:
fail-fast: false
matrix:
sample: [CPlusPlusWidgets, CPlusPlusWin32, CSharpAvalonia, CSharpUno, 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' }}

136
.github/workflows/build-tests.yml vendored Normal file
View File

@@ -0,0 +1,136 @@
name: Build Tests
on:
workflow_call:
permissions:
id-token: write
actions: write
contents: read
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
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
- 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.event.pull_request.head.repo.full_name == github.repository
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

View File

@@ -7,469 +7,27 @@ on:
branches: [master, develop] branches: [master, develop]
workflow_dispatch: workflow_dispatch:
permissions:
id-token: write
actions: write
contents: read
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs: jobs:
build-rust-windows: build-python:
runs-on: windows-latest uses: ./.github/workflows/build-python.yml
env:
RUSTFLAGS: -C target-feature=+crt-static build-rust:
steps: uses: ./.github/workflows/build-rust.yml
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2
with:
key: "rust-build-windows"
- name: Install Dependencies
run: |
rustup target add aarch64-pc-windows-msvc --toolchain nightly-x86_64-pc-windows-msvc
rustup component add rust-src --toolchain nightly-x86_64-pc-windows-msvc
- name: Update Version
shell: pwsh
run: ./.github/set-nbgv-version.ps1
- name: Build Rust Binaries (x86)
run: cargo +nightly build --target i686-win7-windows-msvc -Z build-std="core,alloc,std,panic_abort" --features windows --release -p velopack_bins
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-windows-latest
path: |
target\i686-win7-windows-msvc\release\*.exe
target\i686-win7-windows-msvc\release\*.pdb
- name: Build Rust (x86)
run: cargo +nightly build --target i686-win7-windows-msvc -Z build-std="core,alloc,std,panic_abort" --release -p velopack_nodeffi -p velopack_libc
- name: Build Rust (x64)
run: cargo +nightly build --target x86_64-win7-windows-msvc -Z build-std="core,alloc,std,panic_abort" --release -p velopack_nodeffi -p velopack_libc
- name: Build Rust (arm64)
run: cargo +nightly build --target aarch64-pc-windows-msvc --release -p velopack_nodeffi -p velopack_libc
- name: Collect Artifacts
run: |
move target\i686-win7-windows-msvc\release\velopack_nodeffi.dll target\velopack_nodeffi_win_x86_msvc.node
move target\x86_64-win7-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-win7-windows-msvc\release\velopack_libc.dll target\velopack_libc_win_x86_msvc.dll build-tests:
move target\x86_64-win7-windows-msvc\release\velopack_libc.dll target\velopack_libc_win_x64_msvc.dll uses: ./.github/workflows/build-tests.yml
move target\aarch64-pc-windows-msvc\release\velopack_libc.dll target\velopack_libc_win_arm64_msvc.dll secrets: inherit # tests need secrets to run
move target\i686-win7-windows-msvc\release\velopack_libc.dll.lib target\velopack_libc_win_x86_msvc.dll.lib build-samples:
move target\x86_64-win7-windows-msvc\release\velopack_libc.dll.lib target\velopack_libc_win_x64_msvc.dll.lib uses: ./.github/workflows/build-samples.yml
move target\aarch64-pc-windows-msvc\release\velopack_libc.dll.lib target\velopack_libc_win_arm64_msvc.dll.lib
move target\i686-win7-windows-msvc\release\velopack_libc.lib target\velopack_libc_win_x86_msvc.lib build-packages:
move target\x86_64-win7-windows-msvc\release\velopack_libc.lib target\velopack_libc_win_x64_msvc.lib needs: [build-python, build-rust]
move target\aarch64-pc-windows-msvc\release\velopack_libc.lib target\velopack_libc_win_arm64_msvc.lib uses: ./.github/workflows/build-packages.yml
- 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
- 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
rustup target add aarch64-unknown-linux-gnu
sudo apt update
sudo apt install -y g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
mkdir ./artifacts
# rustup target add x86_64-unknown-linux-musl
# rustup target add aarch64-unknown-linux-musl
# sudo apt install -y g++-aarch64-linux-gnu gcc-aarch64-linux-gnu musl-tools musl:arm64
- name: Update Version
shell: pwsh
run: ./.github/set-nbgv-version.ps1
- name: Build Rust Binaries (x64)
run: |
cargo clean
cross build --release --target x86_64-unknown-linux-musl -p velopack_bins
ldd ./target/x86_64-unknown-linux-musl/release/update || true
cp ./target/x86_64-unknown-linux-musl/release/update ./artifacts/UpdateNix_x64
- name: Build Rust Binaries (arm64)
run: |
cargo clean
cross build --release --target aarch64-unknown-linux-musl -p velopack_bins
ldd ./target/aarch64-unknown-linux-musl/release/update || true
cp ./target/aarch64-unknown-linux-musl/release/update ./artifacts/UpdateNix_arm64
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-ubuntu-latest
path: |
artifacts/UpdateNix*
- name: Build Rust (x64)
run: |
cargo clean
cargo build --release --target x86_64-unknown-linux-gnu -p velopack_nodeffi -p velopack_libc
cp ./target/x86_64-unknown-linux-gnu/release/libvelopack_nodeffi.so ./artifacts/velopack_nodeffi_linux_x64_gnu.node
cp ./target/x86_64-unknown-linux-gnu/release/libvelopack_libc.so ./artifacts/velopack_libc_linux_x64_gnu.so
cp ./target/x86_64-unknown-linux-gnu/release/libvelopack_libc.a ./artifacts/velopack_libc_linux_x64_gnu.a
- name: Build Rust (arm64)
run: |
cargo clean
cargo build --release --target aarch64-unknown-linux-gnu -p velopack_nodeffi -p velopack_libc
cp ./target/aarch64-unknown-linux-gnu/release/libvelopack_nodeffi.so ./artifacts/velopack_nodeffi_linux_arm64_gnu.node
cp ./target/aarch64-unknown-linux-gnu/release/libvelopack_libc.so ./artifacts/velopack_libc_linux_arm64_gnu.so
cp ./target/aarch64-unknown-linux-gnu/release/libvelopack_libc.a ./artifacts/velopack_libc_linux_arm64_gnu.a
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-ubuntu-latest-libs
path: |
artifacts/*.so
artifacts/*.node
artifacts/*.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: ./.github/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
- 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.event.pull_request.head.repo.full_name == github.repository
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: ./.github/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, CSharpUno, 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: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [package, test-vpk, test-bins, samples] needs: [build-packages, build-tests, build-samples]
if: github.event_name == 'push' && github.ref == 'refs/heads/master' if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps: steps:
- name: Invoke Release Workflow - name: Invoke Release Workflow