1
+ name : ' confluent-kafka-dotnet build pipeline'
2
+
3
+ env :
4
+ CONFIGURATION : Release
5
+ DOTNET_CLI_TELEMETRY_OPTOUT : ' true'
6
+
7
+ on :
8
+ push :
9
+ pull_request :
10
+
11
+ jobs :
12
+
13
+ linux-build :
14
+ runs-on : ubuntu-24.04
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+ - name : Setup .NET
18
+ uses : actions/setup-dotnet@v4
19
+ with :
20
+ dotnet-version : |
21
+ 6.0.x
22
+ 8.0.x
23
+ osx-build :
24
+ runs-on : macos-13
25
+ steps :
26
+ - uses : actions/checkout@v4
27
+ - name : Setup .NET
28
+ uses : actions/setup-dotnet@v4
29
+ with :
30
+ dotnet-version : |
31
+ 6.0.x
32
+ 8.0.x
33
+ - name : Set ulimit
34
+ run : ulimit -n 1024
35
+ - name : Build and test
36
+ run : |
37
+ dotnet restore
38
+ make build
39
+ make test
40
+
41
+ windows-build :
42
+ runs-on : windows-latest
43
+ steps :
44
+ - uses : actions/checkout@v4
45
+ - name : Setup .NET
46
+ uses : actions/setup-dotnet@v4
47
+ with :
48
+ dotnet-version : |
49
+ 6.0.x
50
+ 8.0.x
51
+ - name : Build and test
52
+ run : |
53
+ dotnet restore
54
+ dotnet test -c $env:CONFIGURATION test/Confluent.Kafka.UnitTests/Confluent.Kafka.UnitTests.csproj
55
+
56
+ package :
57
+ needs : [windows-build, osx-build, linux-build]
58
+ runs-on : windows-latest
59
+ steps :
60
+
61
+ - name : Show default environment variables
62
+ run : |
63
+ echo "The job_id is: $GITHUB_JOB" # reference the default environment variables
64
+ echo "The id of this action is: $GITHUB_ACTION" # reference the default environment variables
65
+ echo "The run id is: $GITHUB_RUN_ID"
66
+ echo "The GitHub Actor's username is: $GITHUB_ACTOR"
67
+ echo "GitHub SHA: $GITHUB_SHA"
68
+ - uses : actions/checkout@v4
69
+ - name : Setup .NET
70
+ uses : actions/setup-dotnet@v4
71
+ with :
72
+ dotnet-version : |
73
+ 6.0.x
74
+ 8.0.x
75
+ - name : Build and create packages
76
+ run : |
77
+ dotnet restore
78
+ dotnet build Confluent.Kafka.sln -c $env:CONFIGURATION
79
+
80
+ # Different packaging for tagged vs untagged builds
81
+ if ($env:GITHUB_REF -match '^refs/tags/') {
82
+ $suffix = "gr"
83
+ $vsuffix = "--version-suffix"
84
+ } else {
85
+ $suffix = "ci-$env:GITHUB_RUN_ID"
86
+ $vsuffix = "--version-suffix"
87
+ }
88
+
89
+ dotnet pack src/Confluent.Kafka/Confluent.Kafka.csproj --output dist -c $env:CONFIGURATION $vsuffix $suffix
90
+
91
+ - name : Upload artifacts
92
+ uses : actions/upload-artifact@v4
93
+ with :
94
+ name : build-artifacts
95
+ path : dist/
96
+
97
+ # Publish NuGet packages when a tag is pushed.
98
+ # Tests need to succeed for all components and on all platforms first,
99
+ # including having a tag name that matches the version number.
100
+ publish-release :
101
+ if : ${{ startsWith(github.ref, 'refs/tags/v') }}
102
+ needs : package
103
+ runs-on : ubuntu-latest
104
+ steps :
105
+ - name : Download NuGet package artifacts
106
+ uses : actions/download-artifact@v4
107
+ with :
108
+ name : build-artifacts
109
+ path : dist
110
+ - name : Publish to NuGet
111
+ run : |
112
+ dotnet nuget push "dist/Confluent.Kafka*.nupkg" --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${GITHUB_TOKEN}
113
+ env :
114
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments