mirror of
https://github.com/allankoechke/turso.git
synced 2026-11-30 11:12:58 +00:00
Add managed clients for the Turso Platform API and serverless SQL-over-HTTP workloads. Generate the Platform client during MSBuild from the pinned OpenAPI specification, keep generated artifacts out of version control, and use cross-platform generation paths. Include package metadata, NuGet publishing integration, and regression coverage for Platform extensions plus Serverless transaction and lifecycle behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
595 lines
22 KiB
YAML
595 lines
22 KiB
YAML
name: Dotnet Publish
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
paths:
|
|
- ".github/workflows/dotnet-publish.yml"
|
|
- "bindings/dotnet/**"
|
|
- "Cargo.toml"
|
|
- "Cargo.lock"
|
|
- "core/**"
|
|
- "sdk-kit/**"
|
|
# Manual trigger with dry-run / publish controls
|
|
workflow_dispatch:
|
|
inputs:
|
|
skip-publish:
|
|
description: Skip publishing packages to NuGet.org
|
|
required: true
|
|
type: boolean
|
|
default: false
|
|
dry-run:
|
|
description: Dry run (build/pack/upload only, no publish)
|
|
required: true
|
|
type: boolean
|
|
default: true
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
working-directory: bindings/dotnet
|
|
|
|
jobs:
|
|
# Build native libraries for each platform/architecture
|
|
build-natives:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
make-target: build-rust-linux64
|
|
artifact-name: native-linux-x64
|
|
target: x86_64-unknown-linux-gnu
|
|
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
|
|
|
|
- os: ubuntu-latest
|
|
make-target: build-rust-linuxarm64
|
|
artifact-name: native-linux-arm64
|
|
target: aarch64-unknown-linux-gnu
|
|
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
|
|
|
|
- os: ubuntu-latest
|
|
make-target: build-rust-androidarm64
|
|
artifact-name: native-android-arm64
|
|
target: aarch64-linux-android
|
|
|
|
- os: ubuntu-latest
|
|
make-target: build-rust-androidarm
|
|
artifact-name: native-android-arm
|
|
target: armv7-linux-androideabi
|
|
|
|
- os: ubuntu-latest
|
|
make-target: build-rust-androidx64
|
|
artifact-name: native-android-x64
|
|
target: x86_64-linux-android
|
|
|
|
- os: ubuntu-latest
|
|
make-target: build-rust-androidx86
|
|
artifact-name: native-android-x86
|
|
target: i686-linux-android
|
|
|
|
- os: macos-26-intel
|
|
make-target: build-rust-macos64
|
|
artifact-name: native-osx-x64
|
|
target: x86_64-apple-darwin
|
|
macos-deployment-target: "10.13"
|
|
|
|
- os: macos-26
|
|
make-target: build-rust-macosarm64
|
|
target: aarch64-apple-darwin
|
|
artifact-name: native-osx-arm64
|
|
macos-deployment-target: "11.0"
|
|
|
|
- os: macos-26
|
|
make-target: build-rust-iosarm64
|
|
target: aarch64-apple-ios
|
|
artifact-name: native-ios-arm64
|
|
ios-deployment-target: "12.2"
|
|
|
|
- os: macos-26
|
|
make-target: build-rust-iossimulatorarm64
|
|
target: aarch64-apple-ios-sim
|
|
artifact-name: native-iossimulator-arm64
|
|
ios-deployment-target: "12.2"
|
|
|
|
- os: windows-2025
|
|
make-target: build-rust-windows64
|
|
target: x86_64-pc-windows-msvc
|
|
artifact-name: native-win-x64
|
|
|
|
- os: windows-2025
|
|
make-target: build-rust-windowsarm64
|
|
target: aarch64-pc-windows-msvc
|
|
artifact-name: native-win-arm64
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 30
|
|
permissions:
|
|
contents: read
|
|
id-token: write # required for Azure OIDC login (code signing on Windows)
|
|
defaults:
|
|
run:
|
|
working-directory: ${{ env.working-directory }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Add target
|
|
run: rustup target add ${{ matrix.target }}
|
|
|
|
- name: Rust cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
prefix-key: "v1-rust-dotnet-publish"
|
|
cache-on-failure: true
|
|
|
|
- name: Set up Android SDK
|
|
if: contains(matrix.target, 'linux-android')
|
|
uses: android-actions/setup-android@v4
|
|
|
|
- name: Install Android NDK
|
|
if: contains(matrix.target, 'linux-android')
|
|
shell: bash
|
|
run: |
|
|
sdkmanager --install "ndk;27.2.12479018"
|
|
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/27.2.12479018" >> "$GITHUB_ENV"
|
|
echo "ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/27.2.12479018" >> "$GITHUB_ENV"
|
|
|
|
- name: Install cargo-ndk
|
|
if: contains(matrix.target, 'linux-android')
|
|
run: cargo install cargo-ndk --locked
|
|
|
|
- name: Build rust native library (Linux in Docker)
|
|
if: contains(matrix.target, 'unknown-linux-gnu')
|
|
shell: bash
|
|
working-directory: .
|
|
run: |
|
|
mkdir -p $HOME/.cargo/git/db $HOME/.cargo/registry/cache $HOME/.cargo/registry/index
|
|
docker run --rm --user 0:0 \
|
|
-v $HOME/.cargo/git/db:/usr/local/cargo/git/db \
|
|
-v $HOME/.cargo/registry/cache:/usr/local/cargo/registry/cache \
|
|
-v $HOME/.cargo/registry/index:/usr/local/cargo/registry/index \
|
|
-v ${{ github.workspace }}:/build \
|
|
-w /build/bindings/dotnet \
|
|
${{ matrix.docker }} \
|
|
bash -lc '
|
|
rustup target add ${{ matrix.target }}
|
|
if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then
|
|
apt-get update
|
|
apt-get install -y gcc-aarch64-linux-gnu
|
|
unset CFLAGS CXXFLAGS TARGET_CFLAGS TARGET_CXXFLAGS CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH LIBRARY_PATH
|
|
export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc
|
|
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
|
|
export CFLAGS="-DSIMSIMD_TARGET_SIERRA=0 -DSIMSIMD_TARGET_TURIN=0 -DSIMSIMD_TARGET_SAPPHIRE=0 -DSIMSIMD_TARGET_GENOA=0 -DSIMSIMD_TARGET_ICE=0 -DSIMSIMD_TARGET_SKYLAKE=0 -DSIMSIMD_TARGET_HASWELL=0"
|
|
export CFLAGS_aarch64_unknown_linux_gnu="$CFLAGS"
|
|
fi
|
|
make ${{ matrix.make-target }} RUST_RELEASE_OPT="--profile release-official"
|
|
'
|
|
|
|
- name: Build rust native library (macOS)
|
|
if: contains(matrix.target, 'apple-darwin')
|
|
env:
|
|
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos-deployment-target }}
|
|
run: make ${{ matrix.make-target }} RUST_RELEASE_OPT='--profile release-official'
|
|
|
|
- name: Build rust native library (iOS)
|
|
if: contains(matrix.target, 'apple-ios')
|
|
env:
|
|
IPHONEOS_DEPLOYMENT_TARGET: ${{ matrix.ios-deployment-target }}
|
|
run: make ${{ matrix.make-target }} RUST_RELEASE_OPT='--profile release-official'
|
|
|
|
- name: Build rust native library
|
|
if: ${{ !contains(matrix.target, 'unknown-linux-gnu') && !contains(matrix.target, 'apple-darwin') && !contains(matrix.target, 'apple-ios') }}
|
|
run: make ${{ matrix.make-target }} RUST_RELEASE_OPT='--profile release-official'
|
|
|
|
- name: Collect Windows static native dependencies
|
|
if: contains(matrix.target, 'pc-windows-msvc')
|
|
shell: pwsh
|
|
run: |
|
|
$target = '${{ matrix.target }}'
|
|
$arch = if ($target -eq 'x86_64-pc-windows-msvc') { 'x86_64' } else { 'aarch64' }
|
|
$crate = "windows_${arch}_msvc"
|
|
$destination = "rs_compiled\$target\release-official\native-static-libs"
|
|
New-Item -ItemType Directory -Force $destination | Out-Null
|
|
|
|
$versions = @()
|
|
$currentPackage = $null
|
|
foreach ($line in Get-Content "..\..\Cargo.lock") {
|
|
if ($line -match '^name = "([^"]+)"') {
|
|
$currentPackage = $Matches[1]
|
|
} elseif ($currentPackage -eq $crate -and $line -match '^version = "([^"]+)"') {
|
|
$versions += $Matches[1]
|
|
$currentPackage = $null
|
|
}
|
|
}
|
|
if (-not $versions) {
|
|
throw "No $crate package entries were found in Cargo.lock"
|
|
}
|
|
|
|
$cargoHome = if ($env:CARGO_HOME) { $env:CARGO_HOME } else { Join-Path $env:USERPROFILE ".cargo" }
|
|
$registrySrc = Join-Path $cargoHome "registry\src"
|
|
foreach ($version in ($versions | Sort-Object -Unique)) {
|
|
Get-ChildItem -Path $registrySrc -Recurse -Directory -Filter "$crate-$version" |
|
|
ForEach-Object {
|
|
Copy-Item -Path (Join-Path $_.FullName "lib\windows*.lib") -Destination $destination -Force
|
|
}
|
|
}
|
|
|
|
$collected = Get-ChildItem -Path $destination -Filter "windows*.lib"
|
|
if (-not $collected) {
|
|
throw "No windows*.lib static dependencies were collected for $target"
|
|
}
|
|
$now = [DateTime]::UtcNow
|
|
foreach ($library in $collected) {
|
|
$library.LastWriteTimeUtc = $now
|
|
}
|
|
|
|
# Code-sign the Windows native DLL with Azure Artifact Signing (formerly
|
|
# Trusted Signing). Runs only for the windows-msvc targets, only when
|
|
# the AZURE_SIGNING_ENABLED repo variable is set to "true", and only on
|
|
# main pushes or manual dispatch: the Entra federated credential matches
|
|
# the exact ref (refs/heads/main), so OIDC login fails on any other
|
|
# branch, and dev-branch artifacts don't need signing anyway. The action
|
|
# only works on Windows runners, which is why signing happens here in
|
|
# the native build job rather than in the Linux pack/publish job.
|
|
- name: Azure login (OIDC) for code signing
|
|
if: ${{ contains(matrix.target, 'pc-windows-msvc') && vars.AZURE_SIGNING_ENABLED == 'true' && (github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch') }}
|
|
uses: azure/login@v2
|
|
with:
|
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
|
|
|
- name: Code sign Windows native library
|
|
if: ${{ contains(matrix.target, 'pc-windows-msvc') && vars.AZURE_SIGNING_ENABLED == 'true' && (github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch') }}
|
|
uses: azure/trusted-signing-action@v0
|
|
with:
|
|
endpoint: ${{ vars.AZURE_SIGNING_ENDPOINT }}
|
|
trusted-signing-account-name: ${{ vars.AZURE_SIGNING_ACCOUNT }}
|
|
certificate-profile-name: ${{ vars.AZURE_SIGNING_CERT_PROFILE }}
|
|
files: ${{ github.workspace }}/bindings/dotnet/rs_compiled/${{ matrix.target }}/release-official/turso_sdk_kit.dll
|
|
file-digest: SHA256
|
|
timestamp-rfc3161: http://timestamp.acs.microsoft.com
|
|
timestamp-digest: SHA256
|
|
|
|
- name: Upload rust native library
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: ${{ matrix.artifact-name }}
|
|
path: |
|
|
${{ env.working-directory }}/rs_compiled/**/turso_sdk_kit.dll
|
|
${{ env.working-directory }}/rs_compiled/**/turso_sdk_kit.lib
|
|
${{ env.working-directory }}/rs_compiled/**/windows*.lib
|
|
${{ env.working-directory }}/rs_compiled/**/libturso_sdk_kit.so
|
|
${{ env.working-directory }}/rs_compiled/**/libturso_sdk_kit.dylib
|
|
${{ env.working-directory }}/rs_compiled/**/libturso_sdk_kit.a
|
|
|
|
retention-days: 1
|
|
|
|
package-ios-framework:
|
|
needs: build-natives
|
|
runs-on: macos-26
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: read
|
|
defaults:
|
|
run:
|
|
working-directory: ${{ env.working-directory }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Download iOS native libraries
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
pattern: native-ios*
|
|
path: ${{ env.working-directory }}/rs_compiled
|
|
merge-multiple: true
|
|
|
|
- name: Package iOS XCFramework
|
|
run: make package-rust-iosframework RUST_PROFILE_DIR=release-official
|
|
|
|
- name: Upload iOS XCFramework
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: native-ios-universal
|
|
path: ${{ env.working-directory }}/rs_compiled/**/libturso_sdk_kit.xcframework/**
|
|
retention-days: 1
|
|
|
|
# Create NuGet packages; publish is opt-in
|
|
publish:
|
|
needs: [build-natives, package-ios-framework]
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
permissions:
|
|
contents: read
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ${{ env.working-directory }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Install dotnet SDKs
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: |
|
|
8.0.x
|
|
9.0.x
|
|
10.0.x
|
|
|
|
- name: Download all native libraries
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
pattern: native-*
|
|
path: ${{ env.working-directory }}/rs_compiled
|
|
merge-multiple: true
|
|
|
|
- name: Build and pack
|
|
run:
|
|
make pack
|
|
|
|
- name: Verify NuGet native assets
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
package=$(find src/Turso.Data.Sqlite/bin/Release -maxdepth 1 -name 'Turso.Data.Sqlite.*.nupkg' | head -n 1)
|
|
if [ -z "$package" ]; then
|
|
echo "No Turso.Data.Sqlite NuGet package found"
|
|
exit 1
|
|
fi
|
|
unzip -Z1 "$package" > package-files.txt
|
|
required_files=(
|
|
"buildTransitive/Turso.Data.Sqlite.targets"
|
|
"runtimes/android-arm64/native/libturso_sdk_kit.so"
|
|
"runtimes/android-arm/native/libturso_sdk_kit.so"
|
|
"runtimes/android-x64/native/libturso_sdk_kit.so"
|
|
"runtimes/android-x86/native/libturso_sdk_kit.so"
|
|
"runtimes/ios-universal/native/libturso_sdk_kit.xcframework/Info.plist"
|
|
"runtimes/ios-universal/native/libturso_sdk_kit.xcframework/ios-arm64/libturso_sdk_kit.framework/libturso_sdk_kit"
|
|
"runtimes/ios-universal/native/libturso_sdk_kit.xcframework/ios-arm64-simulator/libturso_sdk_kit.framework/libturso_sdk_kit"
|
|
)
|
|
for required_file in "${required_files[@]}"; do
|
|
if ! grep -Fxq "$required_file" package-files.txt; then
|
|
echo "Missing $required_file in $package"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
max_package_bytes=250000000
|
|
package_size=$(stat -c%s "$package")
|
|
if [ "$package_size" -gt "$max_package_bytes" ]; then
|
|
echo "$package is $package_size bytes, which exceeds nuget.org's $max_package_bytes byte package limit"
|
|
exit 1
|
|
fi
|
|
|
|
if grep -Eq '^buildTransitive/native/(win|linux|osx)-' package-files.txt; then
|
|
echo "Static NativeAOT assets must stay in RID-specific companion packages, not $package"
|
|
exit 1
|
|
fi
|
|
|
|
static_packages=(
|
|
"win-x64:turso_sdk_kit.lib"
|
|
"win-arm64:turso_sdk_kit.lib"
|
|
"linux-x64:libturso_sdk_kit.a"
|
|
"linux-arm64:libturso_sdk_kit.a"
|
|
"osx-x64:libturso_sdk_kit.a"
|
|
"osx-arm64:libturso_sdk_kit.a"
|
|
)
|
|
for static_package_spec in "${static_packages[@]}"; do
|
|
rid="${static_package_spec%%:*}"
|
|
library="${static_package_spec#*:}"
|
|
static_package=$(find src/Turso.Data.Sqlite.NativeAot/bin/Release -maxdepth 1 -name "Turso.Data.Sqlite.NativeAot.${rid}.*.nupkg" | head -n 1)
|
|
if [ -z "$static_package" ]; then
|
|
echo "No Turso.Data.Sqlite.NativeAot.${rid} NuGet package found"
|
|
exit 1
|
|
fi
|
|
|
|
static_package_size=$(stat -c%s "$static_package")
|
|
if [ "$static_package_size" -gt "$max_package_bytes" ]; then
|
|
echo "$static_package is $static_package_size bytes, which exceeds nuget.org's $max_package_bytes byte package limit"
|
|
exit 1
|
|
fi
|
|
|
|
unzip -Z1 "$static_package" > "package-files-${rid}.txt"
|
|
required_static_files=(
|
|
"buildTransitive/Turso.Data.Sqlite.NativeAot.${rid}.targets"
|
|
"buildTransitive/native/${rid}/${library}"
|
|
)
|
|
for required_static_file in "${required_static_files[@]}"; do
|
|
if ! grep -Fxq "$required_static_file" "package-files-${rid}.txt"; then
|
|
echo "Missing $required_static_file in $static_package"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
if [[ "$rid" == win-* ]] && ! grep -Eq "^buildTransitive/native/${rid}/windows.*\\.lib$" "package-files-${rid}.txt"; then
|
|
echo "Missing Windows static dependency libraries in $static_package"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
- name: Collect NuGet packages
|
|
run: |
|
|
set -euo pipefail
|
|
shopt -s nullglob
|
|
rm -rf artifacts/nuget-packages
|
|
mkdir -p artifacts/nuget-packages
|
|
files=(
|
|
src/Turso.Data.Sqlite/bin/Release/Turso.Data.Sqlite.*.nupkg
|
|
src/Turso.Data.Sqlite.NativeAot/bin/Release/Turso.Data.Sqlite.NativeAot.*.nupkg
|
|
src/Turso.Platform.Client/bin/Release/Turso.Platform.Client.*.nupkg
|
|
src/Turso.Serverless.Client/bin/Release/Turso.Serverless.Client.*.nupkg
|
|
)
|
|
if [ ${#files[@]} -eq 0 ]; then
|
|
echo "No NuGet packages found to upload"
|
|
exit 1
|
|
fi
|
|
cp "${files[@]}" artifacts/nuget-packages/
|
|
|
|
- name: Upload NuGet packages to artifacts
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: nuget-packages
|
|
path: ${{ env.working-directory }}/artifacts/nuget-packages/*.nupkg
|
|
retention-days: 7
|
|
|
|
validate-nativeaot-static-package:
|
|
needs: publish
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: windows-2025
|
|
rid: win-x64
|
|
executable: NativeAotSample.exe
|
|
|
|
- os: windows-11-arm
|
|
rid: win-arm64
|
|
executable: NativeAotSample.exe
|
|
|
|
- os: ubuntu-latest
|
|
rid: linux-x64
|
|
executable: NativeAotSample
|
|
|
|
- os: ubuntu-24.04-arm
|
|
rid: linux-arm64
|
|
executable: NativeAotSample
|
|
|
|
- os: macos-26-intel
|
|
rid: osx-x64
|
|
executable: NativeAotSample
|
|
|
|
- os: macos-26
|
|
rid: osx-arm64
|
|
executable: NativeAotSample
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 30
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Install dotnet SDK
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: 10.0.x
|
|
|
|
- name: Verify NativeAOT prerequisites
|
|
if: startsWith(matrix.rid, 'linux-')
|
|
run: |
|
|
set -euo pipefail
|
|
clang --version
|
|
if [ ! -f /usr/include/zlib.h ]; then
|
|
echo "zlib1g-dev is required for Linux NativeAOT validation"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Download NuGet packages
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
name: nuget-packages
|
|
path: ${{ env.working-directory }}/artifacts/nuget-packages
|
|
|
|
- name: Publish NativeAOT sample from package
|
|
shell: pwsh
|
|
run: |
|
|
$ErrorActionPreference = "Stop"
|
|
$sampleProject = "${{ env.working-directory }}/samples/NativeAot/NativeAotSample.csproj"
|
|
$packageSource = Resolve-Path "${{ env.working-directory }}/artifacts/nuget-packages"
|
|
$publishDirectory = "${{ runner.temp }}/nativeaot-${{ matrix.rid }}"
|
|
$nugetConfig = "${{ env.working-directory }}/samples/NativeAot/NuGet.config"
|
|
|
|
@"
|
|
<configuration>
|
|
<packageSources>
|
|
<clear />
|
|
<add key="local" value="$packageSource" />
|
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
|
</packageSources>
|
|
<packageSourceMapping>
|
|
<packageSource key="local">
|
|
<package pattern="Turso.Data.Sqlite" />
|
|
<package pattern="Turso.Data.Sqlite.NativeAot.*" />
|
|
</packageSource>
|
|
<packageSource key="nuget.org">
|
|
<package pattern="*" />
|
|
</packageSource>
|
|
</packageSourceMapping>
|
|
</configuration>
|
|
"@ | Set-Content -Path $nugetConfig -Encoding UTF8
|
|
|
|
dotnet restore $sampleProject -r "${{ matrix.rid }}" --configfile $nugetConfig
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
dotnet publish $sampleProject -c Release -r "${{ matrix.rid }}" -o $publishDirectory --no-restore
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
$sidecars = Get-ChildItem -Path $publishDirectory -Recurse -File |
|
|
Where-Object { $_.Name -in @("turso_sdk_kit.dll", "libturso_sdk_kit.so", "libturso_sdk_kit.dylib") }
|
|
if ($sidecars) {
|
|
throw "NativeAOT publish produced a Turso dynamic sidecar: $($sidecars.FullName -join ', ')"
|
|
}
|
|
|
|
$executable = Join-Path $publishDirectory "${{ matrix.executable }}"
|
|
if (-not (Test-Path $executable)) {
|
|
throw "NativeAOT executable was not produced at $executable"
|
|
}
|
|
|
|
if (-not $IsWindows) {
|
|
chmod +x $executable
|
|
}
|
|
|
|
$output = & $executable
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
if ($output -notcontains "Rows: 3") {
|
|
throw "Unexpected NativeAOT sample output: $output"
|
|
}
|
|
|
|
publish-to-nuget:
|
|
needs: validate-nativeaot-static-package
|
|
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.skip-publish && !inputs.dry-run }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Install dotnet SDK
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: 9.0.x
|
|
|
|
- name: Download NuGet packages
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
name: nuget-packages
|
|
path: nuget-packages
|
|
|
|
# https://learn.microsoft.com/en-us/nuget/nuget-org/publish-a-package
|
|
- name: Publish to nuget
|
|
run: |
|
|
for package in nuget-packages/*.nupkg; do
|
|
dotnet nuget push "$package" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
|
done
|