Skip to content

Commit 7600801

Browse files
CI/CD script for librdkafka v2.10.0-gr (#3)
1 parent e31a0aa commit 7600801

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed

.github/workflows/build.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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 restore
53+
dotnet build Confluent.Kafka.sln -c Release
54+
55+
# Different packaging for tagged vs untagged builds
56+
if ($env:GITHUB_REF -match '^refs/tags/') {
57+
$suffix = "gr"
58+
} else {
59+
$suffix = "ci-$env:GITHUB_RUN_ID"
60+
}
61+
62+
dotnet pack src/Confluent.Kafka/Confluent.Kafka.csproj --output dist -c Release --version-suffix $suffix
63+
64+
- name: Upload artifacts
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: build-artifacts
68+
path: dist/
69+
70+
# Publish NuGet packages when a tag is pushed.
71+
# Tests need to succeed for all components and on all platforms first,
72+
# including having a tag name that matches the version number.
73+
publish-release:
74+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
75+
needs: package
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: Download NuGet package artifacts
79+
uses: actions/download-artifact@v4
80+
with:
81+
name: build-artifacts
82+
path: dist
83+
- name: Publish to NuGet
84+
run: |
85+
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.10.0">
28+
<PackageReference Include="librdkafka.redist" Version="2.10.0-gr">
2929
<PrivateAssets Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">None</PrivateAssets>
3030
</PackageReference>
3131
</ItemGroup>

0 commit comments

Comments
 (0)