Skip to content

Commit 5f9b5c7

Browse files
authored
chore: update release-please workflow to use the new csharp release workflow (#128)
* use new csharp release workflow * update release-please workflow
1 parent 1728c8b commit 5f9b5c7

File tree

3 files changed

+107
-192
lines changed

3 files changed

+107
-192
lines changed

.github/workflows/release-csharp-bindings-new.yml

-139
This file was deleted.

.github/workflows/release-csharp-bindings.yml

+106-52
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,138 @@
1-
name: Publish C# bindings
1+
name: C# Bindings
22

33
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
48
workflow_dispatch:
59
inputs:
610
ref:
7-
description: The reference (branch/tag/commit) to checkout
8-
required: true
11+
description: 'The reference (branch/tag/commit) to checkout'
12+
required: false
13+
release-type:
14+
type: choice
15+
required: false
16+
default: 'none'
17+
description: 'Indicates whether we want to make a release and if which one'
18+
options:
19+
- release
20+
- none
921

10-
concurrency:
11-
group: ${{ github.workflow }}-${{ github.ref }}
12-
cancel-in-progress: true
22+
env:
23+
CARGO_TERM_COLOR: always
1324

1425
jobs:
15-
publish:
16-
name: Publish C# bindings
17-
runs-on: macos-latest
26+
build:
27+
name: Build - ${{ matrix.target }}
28+
runs-on: ${{ matrix.os }}
29+
strategy:
30+
matrix:
31+
include:
32+
- target: x86_64-unknown-linux-gnu
33+
os: ubuntu-latest
34+
- target: aarch64-unknown-linux-gnu
35+
os: ubuntu-latest
36+
- target: aarch64-apple-darwin
37+
os: ubuntu-latest
38+
- target: x86_64-apple-darwin
39+
os: ubuntu-latest
40+
- target: x86_64-pc-windows-gnu
41+
os: windows-latest
1842
steps:
19-
- name: Checkout sources
20-
uses: actions/checkout@v4
43+
- uses: actions/checkout@v4
2144
with:
22-
ref: master
23-
45+
ref: ${{ inputs.ref || github.ref }}
2446
- name: Install Rust
25-
uses: dtolnay/rust-toolchain@master
47+
uses: actions-rs/toolchain@v1
2648
with:
2749
toolchain: stable
28-
29-
- name: Install all of the relevant targets
50+
target: ${{ matrix.target }}
51+
override: true
52+
- name: Install cargo-binstall
53+
uses: taiki-e/install-action@cargo-binstall
54+
- name: Install Zig
55+
uses: goto-bus-stop/setup-zig@v2
56+
with:
57+
version: 0.10.1
58+
- name: Install cargo-zigbuild
59+
run: cargo binstall --no-confirm cargo-zigbuild
60+
- name: Run compile script
3061
run: |
31-
chmod +x .github/scripts/install_all_targets.sh
32-
.github/scripts/install_all_targets.sh
62+
chmod +x .github/scripts/compile_all_targets_c_sharp_new.sh
63+
.github/scripts/compile_all_targets_c_sharp_new.sh ${{ matrix.target }}
64+
shell: bash
65+
- name: Upload dynamic libs
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: ${{ matrix.target }}
69+
path: bindings/csharp/csharp_code/EthKZG.bindings/runtimes/${{ matrix.target }}
3370

34-
- name: Install .NET SDK
35-
uses: actions/setup-dotnet@v3
71+
test:
72+
name: Test - ${{ matrix.target }}
73+
needs: build
74+
strategy:
75+
matrix:
76+
include:
77+
- target: x86_64-unknown-linux-gnu
78+
os: ubuntu-latest
79+
- target: aarch64-unknown-linux-gnu
80+
os: linux-arm64
81+
- target: x86_64-apple-darwin
82+
os: macos-13
83+
- target: aarch64-apple-darwin
84+
os: macos-14
85+
- target: x86_64-pc-windows-gnu
86+
os: windows-latest
87+
runs-on: ${{ matrix.os }}
88+
steps:
89+
- uses: actions/checkout@v4
3690
with:
37-
dotnet-version: '8.x'
38-
39-
- name: Setup Python
40-
uses: actions/setup-python@v4
91+
ref: ${{ inputs.ref || github.ref }}
92+
- name: Download artifacts
93+
uses: actions/download-artifact@v4
4194
with:
42-
python-version: '3.x'
95+
name: ${{ matrix.target }}
96+
path: bindings/csharp/csharp_code/EthKZG.bindings/runtimes/${{ matrix.target }}
97+
- name: Set up .NET
98+
uses: actions/setup-dotnet@v3
99+
with:
100+
dotnet-version: '8.0.x'
43101

44-
- name: Install Homebrew
45-
run: |
46-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
102+
- name: Restore .NET dependencies
103+
run: dotnet restore
104+
working-directory: bindings/csharp/csharp_code
47105

48-
- name: Install mingw-w64 for Windows cross-compilation
49-
run: |
50-
brew install mingw-w64
51-
52-
- name: Install linker for x86_64-unknown-linux-gnu
53-
run: |
54-
brew install SergioBenitez/osxct/x86_64-unknown-linux-gnu
55-
56-
- name: Install linker for aarch64-unknown-linux-gnu
57-
run: |
58-
brew tap messense/homebrew-macos-cross-toolchains
59-
brew install aarch64-unknown-linux-gnu
106+
- name: Build .NET project
107+
run: dotnet build --no-restore
108+
working-directory: bindings/csharp/csharp_code
60109

61-
- name: Rename cross.toml file so cargo uses the correct linkers
62-
run: |
63-
mv .cargo/config.cross.toml .cargo/config.toml
110+
- name: Run .NET tests
111+
run: dotnet test --no-build --verbosity normal
112+
working-directory: bindings/csharp/csharp_code
64113

65-
- name: Strip leading v from tagged version
66-
# Strip the leading v from the tag name. It should be of the form v0.1.2
67-
# dotnet requires it to be of the form 0.1.2
68-
run: echo "VERSION=$(echo "${{ inputs.ref }}" | sed 's/^v//')" >> $GITHUB_ENV
114+
publish:
115+
name: Publish
116+
if: ${{ inputs.release-type != 'none' && github.event_name == 'workflow_dispatch' }}
117+
needs: [build, test]
118+
runs-on: ubuntu-latest
119+
steps:
120+
- uses: actions/checkout@v4
121+
with:
122+
ref: ${{ inputs.ref || github.ref }}
69123

70-
- name: Run compile script
71-
run: |
72-
chmod +x .github/scripts/compile_all_targets_c_sharp.sh
73-
.github/scripts/compile_all_targets_c_sharp.sh
124+
- name: Download all artifacts
125+
uses: actions/download-artifact@v4
126+
with:
127+
path: bindings/csharp/csharp_code/EthKZG.bindings/runtimes
74128

75129
- name: Restore NuGet packages
76130
working-directory: bindings/csharp/csharp_code/EthKZG.bindings
77131
run: dotnet restore
78132

79133
- name: Package with dotnet pack
80134
working-directory: bindings/csharp/csharp_code/EthKZG.bindings
81-
run: dotnet pack -c release --no-restore -o nupkgs -p:Version=${{ env.VERSION }} -p:ContinuousIntegrationBuild=true
135+
run: dotnet pack -c release --no-restore -o nupkgs -p:ContinuousIntegrationBuild=true
82136

83137
- name: Publish to Nuget
84138
working-directory: bindings/csharp/csharp_code/EthKZG.bindings

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
with:
8383
workflow: release-csharp-bindings.yml
8484
ref: master
85-
inputs: '{ "ref": "${{ needs.release-please.outputs.tag-name }}" }'
85+
inputs: '{ "ref": "${{ needs.release-please.outputs.tag-name }}", "release-type": "release" }'
8686
token: ${{ secrets.RELEASE_TOKEN }}
8787

8888
publish-nim-bindings:

0 commit comments

Comments
 (0)