Skip to content

Commit 53b6382

Browse files
authored
CI/CD script for librdkafka v2.11.0-gr (#6)
1 parent 32963c7 commit 53b6382

File tree

2 files changed

+87
-1
lines changed

2 files changed

+87
-1
lines changed

.github/workflows/build.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: 'confluent-kafka-dotnet build pipeline'
2+
3+
env:
4+
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
5+
6+
on:
7+
push:
8+
pull_request:
9+
10+
jobs:
11+
12+
build-test:
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-13] # macos-13 for x86_x64 arch
16+
runs-on: ${{ matrix.os }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v4
21+
with:
22+
dotnet-version: |
23+
6.0.x
24+
8.0.x
25+
- name: Build and test
26+
run: |
27+
dotnet nuget add source --username user --password ${{ github.token }} --store-password-in-clear-text --name github https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
28+
dotnet restore
29+
dotnet test -c Release test/Confluent.Kafka.UnitTests/Confluent.Kafka.UnitTests.csproj
30+
31+
package:
32+
needs: [build-test]
33+
runs-on: windows-latest
34+
steps:
35+
36+
- name: Show default environment variables
37+
run: |
38+
echo "The job_id is: $GITHUB_JOB" # reference the default environment variables
39+
echo "The id of this action is: $GITHUB_ACTION" # reference the default environment variables
40+
echo "The run id is: $GITHUB_RUN_ID"
41+
echo "The GitHub Actor's username is: $GITHUB_ACTOR"
42+
echo "GitHub SHA: $GITHUB_SHA"
43+
- uses: actions/checkout@v4
44+
- name: Setup .NET
45+
uses: actions/setup-dotnet@v4
46+
with:
47+
dotnet-version: |
48+
6.0.x
49+
8.0.x
50+
- name: Build and create packages
51+
run: |
52+
dotnet nuget add source --username user --password ${{ github.token }} --store-password-in-clear-text --name github https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
53+
dotnet restore
54+
dotnet build Confluent.Kafka.sln -c Release
55+
56+
# Different packaging for tagged vs untagged builds
57+
if ($env:GITHUB_REF -match '^refs/tags/') {
58+
$suffix = "gr"
59+
} else {
60+
$suffix = "ci-$env:GITHUB_RUN_ID"
61+
}
62+
63+
dotnet pack src/Confluent.Kafka/Confluent.Kafka.csproj --output dist -c Release --version-suffix $suffix
64+
65+
- name: Upload artifacts
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: build-artifacts
69+
path: dist/
70+
71+
# Publish NuGet packages when a tag is pushed.
72+
# Tests need to succeed for all components and on all platforms first,
73+
# including having a tag name that matches the version number.
74+
publish-release:
75+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
76+
needs: package
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Download NuGet package artifacts
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: build-artifacts
83+
path: dist
84+
- name: Publish to NuGet
85+
run: |
86+
dotnet nuget push "dist/Confluent.Kafka*.nupkg" --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ github.token }}

src/Confluent.Kafka/Confluent.Kafka.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</PropertyGroup>
2626

2727
<ItemGroup>
28-
<PackageReference Include="librdkafka.redist" Version="2.11.0">
28+
<PackageReference Include="librdkafka.redist" Version="2.11.0-gr">
2929
<PrivateAssets Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">None</PrivateAssets>
3030
</PackageReference>
3131
</ItemGroup>

0 commit comments

Comments
 (0)