Compile macos to universal binary

This commit is contained in:
Caelan Sayler
2024-06-01 23:03:07 +01:00
parent ec58b52885
commit ff55b51bab

View File

@@ -6,7 +6,7 @@ jobs:
test-rust-bins: test-rust-bins:
strategy: strategy:
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-13, macos-14, windows-latest, ubuntu-latest]
include: include:
- os: windows-latest - os: windows-latest
rust_flags: "--target i686-pc-windows-msvc --features windows" rust_flags: "--target i686-pc-windows-msvc --features windows"
@@ -14,10 +14,6 @@ jobs:
rust_flags: "--target x86_64-unknown-linux-gnu" rust_flags: "--target x86_64-unknown-linux-gnu"
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Update Rust
run: |
rustup update
rustc --version
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
@@ -29,7 +25,7 @@ jobs:
uses: taiki-e/install-action@cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov
- name: Install NBGV - name: Install NBGV
run: dotnet tool install -g nbgv run: dotnet tool install -g nbgv
if: ${{ matrix.os == 'macos-latest' }} if: startsWith(matrix.os, 'macos-')
continue-on-error: true continue-on-error: true
- name: Test Rust - name: Test Rust
working-directory: src/Rust working-directory: src/Rust
@@ -40,21 +36,60 @@ jobs:
name: coverage-rust-${{ matrix.os }} name: coverage-rust-${{ matrix.os }}
path: ./test/*.xml path: ./test/*.xml
build-rust-bins: build-rust-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2
with:
key: "rust-build-windows"
workspaces: "src/Rust -> target"
- name: Build Rust
working-directory: src/Rust
run: cargo bw86 --release
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-windows-latest
path: |
src/Rust/target/i686-pc-windows-msvc/release/*.exe
src/Rust/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: Swatinem/rust-cache@v2
with:
key: "rust-build-linux"
workspaces: "src/Rust -> target"
- name: Build Rust
working-directory: src/Rust
run: |
cargo build --release --target x86_64-unknown-linux-gnu
cp ./target/x86_64-unknown-linux-gnu/release/update ./target/release/UpdateNix
- name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-ubuntu-latest
path: src/Rust/target/release/UpdateNix
- name: Cancel workflow if failed
uses: andymckay/cancel-action@0.4
if: ${{ failure() }}
build-rust-macos:
strategy: strategy:
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-13, macos-14]
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 }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Update Rust
run: |
rustup update
rustc --version
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
@@ -64,34 +99,49 @@ jobs:
workspaces: "src/Rust -> target" workspaces: "src/Rust -> target"
- name: Install NBGV - name: Install NBGV
run: dotnet tool install -g nbgv run: dotnet tool install -g nbgv
if: ${{ matrix.os == 'macos-latest' }}
continue-on-error: true continue-on-error: true
- name: Build Rust - name: Build Rust
working-directory: src/Rust working-directory: src/Rust
run: cargo build --release ${{ matrix.rust_flags }}
- name: Collect Rust Binaries (Windows)
working-directory: src/Rust/target
run: | run: |
copy i686-pc-windows-msvc\release\*.exe release cargo build --release
copy i686-pc-windows-msvc\release\*.pdb release cp ./target/release/update ./target/release/UpdateMac
if: ${{ matrix.os == 'windows-latest' }}
- name: Collect Rust Binaries (Linux)
working-directory: src/Rust/target
run: cp ./x86_64-unknown-linux-gnu/release/update ./release/UpdateNix
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Collect Rust Binaries (OSX)
working-directory: src/Rust/target/release
run: cp update UpdateMac
if: ${{ matrix.os == 'macos-latest' }}
- name: Upload Rust Build Artifacts - name: Upload Rust Build Artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: rust-${{ matrix.os }} name: rust-${{ matrix.os }}
path: | path: src/Rust/target/release/UpdateMac
src/Rust/target/release/UpdateNix - name: Cancel workflow if failed
src/Rust/target/release/UpdateMac uses: andymckay/cancel-action@0.4
src/Rust/target/release/*.exe if: ${{ failure() }}
src/Rust/target/release/*.pdb
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
- 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: test-dotnet:
strategy: strategy:
@@ -162,12 +212,6 @@ jobs:
path: src/Rust/target/release path: src/Rust/target/release
- name: Test .NET - name: Test .NET
run: dotnet test --no-build -c Release -l "console;verbosity=detailed;consoleLoggerParameters=ErrorsOnly" -l GithubActions -- RunConfiguration.CollectSourceInformation=true run: dotnet test --no-build -c Release -l "console;verbosity=detailed;consoleLoggerParameters=ErrorsOnly" -l GithubActions -- RunConfiguration.CollectSourceInformation=true
# - name: Test .NET Velopack.Tests
# run: dotnet test --no-build -c Release test/Velopack.Tests/Velopack.Tests.csproj
# - name: Test .NET Velopack.Packaging.Tests
# run: dotnet test --no-build -c Release -l "console;verbosity=detailed;consoleLoggerParameters=ErrorsOnly" test/Velopack.Packaging.Tests/Velopack.Packaging.Tests.csproj
# - name: Test .NET Velopack.CommandLine.Tests
# run: dotnet test --no-build -c Release -l "console;verbosity=detailed;consoleLoggerParameters=ErrorsOnly" test/Velopack.CommandLine.Tests/Velopack.CommandLine.Tests.csproj
- name: Upload Coverage Artifacts - name: Upload Coverage Artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@@ -176,7 +220,7 @@ jobs:
package: package:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build-rust-bins] needs: [build-rust-windows, build-rust-linux, build-mac-universal]
steps: steps:
- name: Print dotnet version - name: Print dotnet version
run: dotnet --info run: dotnet --info