Skip to content

Merge pull request #29 from filipw/microsoft.extensions.ai #70

Merge pull request #29 from filipw/microsoft.extensions.ai

Merge pull request #29 from filipw/microsoft.extensions.ai #70

Workflow file for this run

name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Install uniffi-bindgen-cs
if: matrix.os == 'ubuntu-latest'
run: cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0
- name: Build default target
run: |
cd strathweb-phi-engine
cargo build --release
- name: Upload default artifacts
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: native-library-${{ matrix.os }}
path: |
strathweb-phi-engine/target/release/*.so
strathweb-phi-engine/target/release/*.dylib
strathweb-phi-engine/target/release/*.dll
- name: Upload bindings
if: matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: language-bindings
path: |
strathweb-phi-engine/bindings/**
build-swift:
runs-on: macos-15
steps:
- uses: actions/checkout@v3
- name: Install Rust targets
run: |
rustup target add aarch64-apple-ios
rustup target add aarch64-apple-ios-sim
rustup target add aarch64-apple-darwin
- name: Build Swift Package
run: ./build-swift.sh
- name: Clean temporary build files from Swift Package
if: github.event_name != 'pull_request'
run: rm -rf packages/swift/Strathweb.Phi.Engine/.build
- name: Upload artifact
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: Strathweb.Phi.Engine-SwiftPackage
path: packages/swift/Strathweb.Phi.Engine
build-nuget:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
needs: [build]
steps:
- uses: actions/checkout@v3
- name: Download Linux artifacts
uses: actions/download-artifact@v3
with:
name: native-library-ubuntu-latest
path: artifacts/linux
- name: Download macOS artifacts
uses: actions/download-artifact@v3
with:
name: native-library-macos-14
path: artifacts/macos
- name: Download Windows artifacts
uses: actions/download-artifact@v3
with:
name: native-library-windows-latest
path: artifacts/windows
- name: Download bindings
uses: actions/download-artifact@v3
with:
name: language-bindings
path: artifacts/bindings
- name: Copy artifacts and bindings to package
run: |
mkdir -p packages/csharp/Strathweb.Phi.Engine/runtimes/linux-x64/native
mkdir -p packages/csharp/Strathweb.Phi.Engine/runtimes/osx-arm64/native
mkdir -p packages/csharp/Strathweb.Phi.Engine/runtimes/win-x64/native
cp artifacts/linux/*.so packages/csharp/Strathweb.Phi.Engine/runtimes/linux-x64/native/
cp artifacts/macos/*.dylib packages/csharp/Strathweb.Phi.Engine/runtimes/osx-arm64/native/
cp artifacts/windows/*.dll packages/csharp/Strathweb.Phi.Engine/runtimes/win-x64/native/
cp artifacts/bindings/*.cs packages/csharp/Strathweb.Phi.Engine/
- name: Build NuGet packages
run: |
cd packages/csharp
dotnet build -c Release
dotnet pack -c Release
- name: Upload NuGet package (Strathweb.Phi.Engine)
uses: actions/upload-artifact@v3
with:
name: Strathweb.Phi.Engine
path: packages/csharp/Strathweb.Phi.Engine/bin/Release/*.nupkg
- name: Upload NuGet package (Strathweb.Phi.Engine.AutoGen)
uses: actions/upload-artifact@v3
with:
name: Strathweb.Phi.Engine.AutoGen
path: packages/csharp/Strathweb.Phi.Engine.AutoGen/bin/Release/*.nupkg
- name: Upload NuGet package (Strathweb.Phi.Engine.Microsoft.Extensions.AI)
uses: actions/upload-artifact@v3
with:
name: Strathweb.Phi.Engine.Microsoft.Extensions.AI
path: packages/csharp/Strathweb.Phi.Engine.Microsoft.Extensions.AI/bin/Release/*.nupkg