2023-03-13 10:42:12 +00:00
|
|
|
name: C#
|
2022-11-03 13:08:17 +00:00
|
|
|
on:
|
2023-03-06 21:46:00 +00:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
version:
|
|
|
|
description: "Binding version override"
|
2022-11-03 13:08:17 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
2023-03-06 21:46:00 +00:00
|
|
|
env:
|
2023-08-21 13:29:28 +00:00
|
|
|
binding_build_number_based_version: 0.3.1.${{ github.run_number }}
|
2022-11-03 13:08:17 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-ckzg:
|
2023-04-26 17:55:52 +00:00
|
|
|
name: Build ckzg
|
2022-11-03 13:08:17 +00:00
|
|
|
runs-on: ${{ matrix.target.host }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target:
|
2023-03-06 21:46:00 +00:00
|
|
|
- arch: x86_64-linux-gnu
|
|
|
|
location: linux-x64
|
|
|
|
host: ubuntu-22.04
|
|
|
|
ext: .so
|
|
|
|
reqs:
|
|
|
|
- arch: aarch64-linux-gnu
|
|
|
|
location: linux-arm64
|
|
|
|
host: ubuntu-22.04
|
|
|
|
ext: .so
|
2023-05-25 11:40:21 +00:00
|
|
|
reqs: sudo apt update && sudo apt install -y clang binutils-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross crossbuild-essential-arm64
|
2023-10-04 12:03:37 +00:00
|
|
|
- arch: arm64-apple-macos11
|
2023-03-06 21:46:00 +00:00
|
|
|
location: osx-arm64
|
2022-11-09 19:29:25 +00:00
|
|
|
host: macos-latest
|
2023-10-04 12:03:37 +00:00
|
|
|
ext: .dylib
|
2023-03-06 21:46:00 +00:00
|
|
|
reqs:
|
|
|
|
- arch: x86_64-darwin
|
|
|
|
location: osx-x64
|
2022-11-03 13:08:17 +00:00
|
|
|
host: macos-latest
|
2023-10-04 12:03:37 +00:00
|
|
|
ext: .dylib
|
2023-03-06 21:46:00 +00:00
|
|
|
reqs:
|
|
|
|
- arch:
|
|
|
|
location: win-x64
|
2022-11-03 13:08:17 +00:00
|
|
|
host: windows-latest
|
2023-03-06 21:46:00 +00:00
|
|
|
ext: .dll
|
|
|
|
reqs:
|
2022-11-03 13:08:17 +00:00
|
|
|
steps:
|
2022-11-07 16:50:32 +00:00
|
|
|
- uses: ilammy/msvc-dev-cmd@v1
|
2022-11-03 13:08:17 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
2023-03-06 21:46:00 +00:00
|
|
|
- name: Install requirements
|
|
|
|
if: ${{ matrix.target.reqs }}
|
|
|
|
run: ${{ matrix.target.reqs }}
|
|
|
|
- name: Build native library for ${{ matrix.target.location }} using native capabilities
|
|
|
|
run: make ckzg -C bindings/csharp CC=clang EXTENSION=${{matrix.target.ext}} LOCATION=${{matrix.target.location}} ARCH=${{matrix.target.arch}}
|
2022-11-03 13:08:17 +00:00
|
|
|
- name: Upload artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2023-03-06 21:46:00 +00:00
|
|
|
name: ckzg-library-wrapper-${{ matrix.target.location }}
|
|
|
|
path: bindings/csharp/Ckzg.Bindings/runtimes/${{ matrix.target.location }}/native
|
|
|
|
|
2023-04-26 17:55:52 +00:00
|
|
|
test-ckzg-dotnet:
|
|
|
|
name: Test .NET wrapper
|
|
|
|
runs-on: ${{ matrix.target.host }}
|
|
|
|
needs: build-ckzg
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target:
|
|
|
|
- host: ubuntu-22.04
|
|
|
|
location: linux-x64
|
|
|
|
- host: macos-latest
|
|
|
|
location: osx-x64
|
|
|
|
- host: windows-latest
|
|
|
|
location: win-x64
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
- name: Set up .NET
|
|
|
|
uses: actions/setup-dotnet@v3
|
|
|
|
- name: Install dependencies
|
|
|
|
run: cd bindings/csharp && dotnet restore
|
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: ckzg-library-wrapper-${{ matrix.target.location }}
|
|
|
|
path: bindings/csharp/Ckzg.Bindings/runtimes/${{ matrix.target.location }}/native
|
|
|
|
- name: Test
|
|
|
|
run: dotnet test -c release bindings/csharp/Ckzg.sln
|
|
|
|
|
2022-11-03 13:08:17 +00:00
|
|
|
build-ckzg-dotnet:
|
2023-04-26 17:55:52 +00:00
|
|
|
name: Build .NET wrapper
|
2022-11-03 13:08:17 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-04-26 17:55:52 +00:00
|
|
|
needs: test-ckzg-dotnet
|
2022-11-03 13:08:17 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
2023-03-06 21:46:00 +00:00
|
|
|
name: ckzg-library-wrapper-linux-x64
|
2022-11-07 16:50:32 +00:00
|
|
|
path: bindings/csharp/Ckzg.Bindings/runtimes/linux-x64/native
|
2022-11-03 13:08:17 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
2023-03-06 21:46:00 +00:00
|
|
|
name: ckzg-library-wrapper-osx-x64
|
2022-11-07 16:50:32 +00:00
|
|
|
path: bindings/csharp/Ckzg.Bindings/runtimes/osx-x64/native
|
2022-11-03 13:08:17 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
2023-03-06 21:46:00 +00:00
|
|
|
name: ckzg-library-wrapper-win-x64
|
2022-11-07 16:50:32 +00:00
|
|
|
path: bindings/csharp/Ckzg.Bindings/runtimes/win-x64/native
|
2022-11-10 16:33:36 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
2023-03-06 21:46:00 +00:00
|
|
|
name: ckzg-library-wrapper-osx-arm64
|
2022-11-10 16:33:36 +00:00
|
|
|
path: bindings/csharp/Ckzg.Bindings/runtimes/osx-arm64/native
|
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
2023-03-06 21:46:00 +00:00
|
|
|
name: ckzg-library-wrapper-linux-arm64
|
2022-11-10 16:33:36 +00:00
|
|
|
path: bindings/csharp/Ckzg.Bindings/runtimes/linux-arm64/native
|
2023-03-17 15:59:32 +00:00
|
|
|
- name: Set up .NET
|
2022-11-03 13:08:17 +00:00
|
|
|
uses: actions/setup-dotnet@v3
|
|
|
|
- name: Install dependencies
|
|
|
|
run: cd bindings/csharp && dotnet restore
|
|
|
|
- name: Build
|
2023-03-17 15:59:32 +00:00
|
|
|
run: cd bindings/csharp && dotnet pack -c release --no-restore -o nupkgs -p:Version=${{ inputs.version || env.binding_build_number_based_version }} -p:ContinuousIntegrationBuild=true
|
2022-11-03 13:08:17 +00:00
|
|
|
- name: Upload package
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2023-03-06 21:46:00 +00:00
|
|
|
name: Ckzg.Bindings-${{ inputs.version || env.binding_build_number_based_version }}
|
2023-03-16 17:59:48 +00:00
|
|
|
path: bindings/csharp/nupkgs/Ckzg.Bindings.*.nupkg
|
2023-04-26 17:55:52 +00:00
|
|
|
- name: Publish .NET package
|
2023-03-16 17:59:48 +00:00
|
|
|
if: github.ref == 'refs/heads/main'
|
2023-03-17 15:59:32 +00:00
|
|
|
run: dotnet nuget push bindings/csharp/nupkgs/*.nupkg -k ${{ secrets.CSHARP_NUGET_APIKEY }} -s https://api.nuget.org/v3/index.json
|