-
Notifications
You must be signed in to change notification settings - Fork 108
131 lines (128 loc) · 4.42 KB
/
csharp-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: C#
on:
workflow_dispatch:
inputs:
version:
description: "Binding version override"
push:
branches:
- main
pull_request:
branches:
- main
env:
binding_build_number_based_version: 2.0.1.${{ github.run_number }}
jobs:
build-ckzg:
name: Build ckzg
runs-on: ${{ matrix.target.host }}
strategy:
matrix:
target:
- 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
reqs: sudo apt update && sudo apt install -y clang binutils-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross crossbuild-essential-arm64
- arch: arm64-apple-macos11
location: osx-arm64
host: macos-latest
ext: .dylib
reqs:
- arch: x86_64-darwin
location: osx-x64
host: macos-latest
ext: .dylib
reqs:
- arch:
location: win-x64
host: windows-latest
ext: .dll
reqs:
steps:
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/checkout@v3
with:
submodules: recursive
- 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}}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ckzg-library-wrapper-${{ matrix.target.location }}
path: bindings/csharp/Ckzg.Bindings/runtimes/${{ matrix.target.location }}/native
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-arm64
- 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
build-ckzg-dotnet:
name: Build .NET wrapper
runs-on: ubuntu-latest
needs: test-ckzg-dotnet
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ckzg-library-wrapper-linux-x64
path: bindings/csharp/Ckzg.Bindings/runtimes/linux-x64/native
- uses: actions/download-artifact@v3
with:
name: ckzg-library-wrapper-osx-x64
path: bindings/csharp/Ckzg.Bindings/runtimes/osx-x64/native
- uses: actions/download-artifact@v3
with:
name: ckzg-library-wrapper-win-x64
path: bindings/csharp/Ckzg.Bindings/runtimes/win-x64/native
- uses: actions/download-artifact@v3
with:
name: ckzg-library-wrapper-osx-arm64
path: bindings/csharp/Ckzg.Bindings/runtimes/osx-arm64/native
- uses: actions/download-artifact@v3
with:
name: ckzg-library-wrapper-linux-arm64
path: bindings/csharp/Ckzg.Bindings/runtimes/linux-arm64/native
- name: Set up .NET
uses: actions/setup-dotnet@v3
- name: Install dependencies
run: cd bindings/csharp && dotnet restore
- name: Build
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
- name: Upload package
uses: actions/upload-artifact@v3
with:
name: Ckzg.Bindings-${{ inputs.version || env.binding_build_number_based_version }}
path: bindings/csharp/nupkgs/Ckzg.Bindings.*.nupkg
- name: Publish .NET package
if: github.ref == 'refs/heads/main'
run: dotnet nuget push bindings/csharp/nupkgs/*.nupkg -k ${{ secrets.CSHARP_NUGET_APIKEY }} -s https://api.nuget.org/v3/index.json