Skip to content

Commit d8cbef2

Browse files
ci: add csharp build job
1 parent a7b5300 commit d8cbef2

1 file changed

Lines changed: 50 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
type: boolean
1212
required: true
1313
default: false
14-
description: 'Push the release to all channels (GitHub, PyPI)'
14+
description: 'Push the release to all channels (GitHub, NuGet, PyPI)'
1515

1616
jobs:
1717
c_cpp_build:
@@ -61,6 +61,54 @@ jobs:
6161
dist/sourcepp_*c.dylib
6262
lang/c/include/
6363
64+
csharp_build:
65+
name: '[C#] Build'
66+
needs:
67+
- c_cpp_build
68+
runs-on: ubuntu-latest
69+
defaults:
70+
run:
71+
working-directory: '${{github.workspace}}/lang/csharp'
72+
steps:
73+
- name: Checkout Repository
74+
uses: actions/checkout@v6
75+
76+
- name: Setup .NET Core
77+
uses: actions/setup-dotnet@v5
78+
with:
79+
dotnet-version: '10'
80+
81+
- name: Configure CMake
82+
working-directory: '${{github.workspace}}'
83+
run: cmake -G "Ninja" -B build -DCMAKE_BUILD_TYPE=Release -DSOURCEPP_BUILD_CSHARP_WRAPPERS=ON -DSOURCEPP_VERSION="${{inputs.version}}"
84+
85+
- name: Download C DLLs
86+
uses: actions/download-artifact@v8
87+
with:
88+
pattern: 'c-dist-*'
89+
path: '${{github.workspace}}/out'
90+
merge-multiple: true
91+
92+
- name: Copy C DLLs
93+
working-directory: '${{github.workspace}}'
94+
run: cp -a "${{github.workspace}}/out/dist/." "${{github.workspace}}/lang/csharp/src/"
95+
96+
- name: Build Package
97+
run: |
98+
dotnet build --configuration Release --no-restore
99+
dotnet pack --configuration Release
100+
101+
- name: Upload Artifact
102+
uses: actions/upload-artifact@v7
103+
with:
104+
name: csharp-dist
105+
path: |
106+
lang/csharp/src/bin/Release/sourcepp.*.nupkg
107+
108+
- name: Upload to NuGet
109+
if: inputs.release
110+
run: echo "Hello World"
111+
64112
python_build_sdist:
65113
name: '[Python] Build SDist'
66114
runs-on: ubuntu-latest
@@ -151,6 +199,7 @@ jobs:
151199
if: inputs.release
152200
needs:
153201
- c_cpp_build
202+
- csharp_build
154203
- python_build_sdist
155204
- python_build_bdist
156205
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)