Skip to content

Update sysroot variables #63

Update sysroot variables

Update sysroot variables #63

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
inputs:
push-packages:
description: 'Push nuget packages'
required: true
default: false
type: boolean
use-auto-generated-version:
description: 'Use auto-generated version'
required: true
default: true
type: boolean
nuget-registry:
description: 'NuGet registry'
required: true
default: 'GitHub'
type: choice
options:
- GitHub
- NuGet
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
packages: write
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Set Version Suffix
shell: bash
run: |
if [ '${{ github.event.inputs.use-auto-generated-version }}' != 'false' ]; then
echo "BuildVersionSuffix=build.$(git rev-list --count HEAD)" >> $GITHUB_ENV
fi
- name: Set IOS SDK Variables
if: matrix.os == 'macos-latest'
shell: bash
run: |
echo "IOS_SDK_SYSROOT=$(xcrun --sdk iphoneos --show-sdk-path)" >> $GITHUB_ENV
echo "IOS_SIMULATOR_SDK_SYSROOT=$(xcrun --sdk iphonesimulator --show-sdk-path)" >> $GITHUB_ENV
- name: Set Android NDK Variables
if: matrix.os == 'macos-latest'
shell: bash
run: |
echo "ANDROID_NDK=$(find "$ANDROID_SDK_ROOT/ndk/" -mindepth 1 -maxdepth 1 -type d | sort | head -n 1)" >> $GITHUB_ENV
echo "ANDROID_NDK_SYSROOT=$ANDROID_NDK/toolchains/llvm/prebuilt/darwin-x86_64/sysroot" >> $GITHUB_ENV
- name: Restore Dependencies
shell: bash
run: dotnet restore
- name: Generate Bindings
shell: bash
run: dotnet run --project Box2D.NET.Bindgen
- name: Build Projects
shell: bash
run: |
dotnet build -c Debug
dotnet build -c Release
- name: Build Natives
shell: bash
if: matrix.os == 'macos-latest'
working-directory: Box2D.NET.Native
run: |
dotnet build -c Debug -r linux-x64
dotnet build -c Debug -r linux-x86
dotnet build -c Debug -r linux-arm64
dotnet build -c Debug -r osx-x64
dotnet build -c Debug -r osx-arm64
dotnet build -c Debug -r win-x64
dotnet build -c Debug -r win-x86
dotnet build -c Debug -r win-arm64
# dotnet build -c Debug -r browser-wasm
# dotnet build -c Debug -r iossimulator-x64
# dotnet build -c Debug -r iossimulator-arm64
# dotnet build -c Debug -r ios-arm64
dotnet build -c Debug -r android-arm64
dotnet build -c Debug -r android-x64
dotnet build -c Release -r linux-x64
dotnet build -c Release -r linux-x86
dotnet build -c Release -r linux-arm64
dotnet build -c Release -r osx-x64
dotnet build -c Release -r osx-arm64
dotnet build -c Release -r win-x64
dotnet build -c Release -r win-x86
dotnet build -c Release -r win-arm64
# dotnet build -c Release -r browser-wasm
# dotnet build -c Release -r iossimulator-x64
# dotnet build -c Release -r iossimulator-arm64
# dotnet build -c Release -r ios-arm64
dotnet build -c Release -r android-arm64
dotnet build -c Release -r android-x64
- name: Run Tests
shell: bash
run: dotnet test -p:SkipNatives=true
- name: Pack Nuget Packages
shell: bash
run: |
dotnet pack --property:VersionSuffix=$BuildVersionSuffix -p:SkipNatives=true -p:BuildSelectorPackage=true
if [ '${{ github.event.inputs.nuget-registry }}' == 'NuGet' ]; then
dotnet pack --property:VersionSuffix=$BuildVersionSuffix -p:SkipNatives=true -c Debug
dotnet pack --property:VersionSuffix=$BuildVersionSuffix -p:SkipNatives=true -c Release
else
dotnet pack --property:VersionSuffix=$BuildVersionSuffix --property:PackPdb=true -p:SkipNatives=true -c Debug
dotnet pack --property:VersionSuffix=$BuildVersionSuffix --property:PackPdb=true -p:SkipNatives=true -c Release
fi
- name: Upload Artifacts
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: Nuget Packages
path: |
**/Box2D.NET.*.nupkg
**/Box2D.NET.*.snupkg
- name: Push NuGet Packages
if: >
matrix.os == 'macos-latest' &&
github.repository_owner == 'BeanCheeseBurrito' &&
(
(github.event_name == 'workflow_dispatch' && github.event.inputs.push-packages == 'true') ||
(github.event_name == 'push' && github.ref == 'refs/heads/main')
)
shell: bash
run: |
if [ '${{ github.event_name }}' == 'workflow_dispatch' ]; then
if [ '${{ github.event.inputs.nuget-registry }}' == 'NuGet' ]; then
dotnet nuget push **/Box2D.NET.*.nupkg --skip-duplicate --api-key '${{ secrets.NUGET_ACCESS_TOKEN }}' --source 'https://api.nuget.org/v3/index.json'
elif [ '${{ github.event.inputs.nuget-registry }}' == 'GitHub' ]; then
dotnet nuget push **/Box2D.NET.*.nupkg --skip-duplicate --api-key '${{ secrets.GITHUB_TOKEN }}' --source 'https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json'
fi
elif [ '${{ github.ref }}' == 'refs/heads/main' ]; then
dotnet nuget push **/Box2D.NET.*.nupkg --skip-duplicate --api-key '${{ secrets.GITHUB_TOKEN }}' --source 'https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json'
fi