|
| 1 | +name: librdkafka build and release artifact pipeline |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + osx-arm64: |
| 9 | + runs-on: macos-14 |
| 10 | + env: |
| 11 | + ARTIFACT_KEY: p-librdkafka__plat-osx__arch-arm64__lnk-all |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - name: Build |
| 15 | + run: | |
| 16 | + mkdir artifacts dest |
| 17 | + ./configure --install-deps --source-deps-only --enable-static --disable-lz4-ext --enable-strip |
| 18 | + make -j all examples check |
| 19 | + examples/rdkafka_example -X builtin.features |
| 20 | + otool -L src/librdkafka.dylib |
| 21 | + otool -L src-cpp/librdkafka++.dylib |
| 22 | + make -j -C tests build |
| 23 | + make -C tests run_local_quick |
| 24 | + DESTDIR="$PWD/dest" make install |
| 25 | + (cd dest && tar cvzf ../artifacts/librdkafka.tgz .) |
| 26 | + - name: Upload artifacts |
| 27 | + uses: actions/upload-artifact@v4 |
| 28 | + with: |
| 29 | + name: ${{ env.ARTIFACT_KEY }} |
| 30 | + path: artifacts/ |
| 31 | + |
| 32 | + osx-x64: |
| 33 | + runs-on: macos-13 |
| 34 | + env: |
| 35 | + ARTIFACT_KEY: p-librdkafka__plat-osx__arch-x64__lnk-all |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + - name: Build |
| 39 | + run: | |
| 40 | + mkdir artifacts dest |
| 41 | + ./configure --install-deps --source-deps-only --enable-static --disable-lz4-ext --enable-strip |
| 42 | + make -j all examples check |
| 43 | + examples/rdkafka_example -X builtin.features |
| 44 | + otool -L src/librdkafka.dylib |
| 45 | + otool -L src-cpp/librdkafka++.dylib |
| 46 | + make -j -C tests build |
| 47 | + make -C tests run_local_quick |
| 48 | + DESTDIR="$PWD/dest" make install |
| 49 | + (cd dest && tar cvzf ../artifacts/librdkafka.tgz .) |
| 50 | + - name: Upload artifacts |
| 51 | + uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: ${{ env.ARTIFACT_KEY }} |
| 54 | + path: artifacts/ |
| 55 | + |
| 56 | + style-check: |
| 57 | + runs-on: ubuntu-20.04 |
| 58 | + if: "!startsWith(github.ref, 'refs/tags/v')" |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + - name: Install dependencies |
| 62 | + run: | |
| 63 | + sudo apt update |
| 64 | + sudo apt install -y clang-format-10 python3 python3-pip python3-setuptools |
| 65 | + python3 -m pip install -r packaging/tools/requirements.txt |
| 66 | + - name: Style check |
| 67 | + run: CLANG_FORMAT=clang-format-10 make style-check |
| 68 | + |
| 69 | + documentation: |
| 70 | + runs-on: ubuntu-22.04 |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v4 |
| 73 | + - name: Install dependencies |
| 74 | + run: sudo apt install -y doxygen graphviz |
| 75 | + - name: Generate documentation |
| 76 | + run: | |
| 77 | + mkdir artifacts |
| 78 | + make docs |
| 79 | + (cd staging-docs && tar cvzf ../artifacts/librdkafka-docs.tgz .) |
| 80 | + - name: Upload documentation |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: librdkafka-docs |
| 84 | + path: artifacts/librdkafka-docs.tgz |
| 85 | + |
| 86 | + linux-ubuntu-source: |
| 87 | + runs-on: ubuntu-22.04 |
| 88 | + env: |
| 89 | + CFLAGS: -std=gnu90 |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v4 |
| 92 | + - name: Build configuration checks |
| 93 | + run: | |
| 94 | + sudo apt install -y rapidjson-dev |
| 95 | + python3 -m pip install -U pip |
| 96 | + ./packaging/tools/build-configurations-checks.sh |
| 97 | + - name: Build and test |
| 98 | + run: | |
| 99 | + python3 -m pip -V |
| 100 | + (cd tests && python3 -m pip install -r requirements.txt) |
| 101 | + ./configure --install-deps |
| 102 | + ./packaging/tools/rdutcoverage.sh |
| 103 | + make copyright-check |
| 104 | + make -j all examples check |
| 105 | + echo "Verifying that CONFIGURATION.md does not have manual changes" |
| 106 | + git diff --exit-code CONFIGURATION.md |
| 107 | + examples/rdkafka_example -X builtin.features |
| 108 | + ldd src/librdkafka.so.1 |
| 109 | + ldd src-cpp/librdkafka++.so.1 |
| 110 | + make -j -C tests build |
| 111 | + make -C tests run_local_quick |
| 112 | + DESTDIR="$PWD/dest" make install |
| 113 | + (cd tests && python3 -m trivup.clusters.KafkaCluster --version 3.4.0 --cmd "PATH=\"$PATH\" make quick") |
| 114 | +
|
| 115 | + linux-x64-release: |
| 116 | + runs-on: ubuntu-22.04 |
| 117 | + strategy: |
| 118 | + matrix: |
| 119 | + include: |
| 120 | + - name: "centos8 glibc +gssapi" |
| 121 | + artifact_key: p-librdkafka__plat-linux__dist-centos8__arch-x64__lnk-std__extra-gssapi |
| 122 | + image: quay.io/pypa/manylinux_2_28_x86_64:2024.07.01-1 |
| 123 | + extra_args: "" |
| 124 | + - name: "centos8 glibc" |
| 125 | + artifact_key: p-librdkafka__plat-linux__dist-centos8__arch-x64__lnk-all |
| 126 | + image: quay.io/pypa/manylinux_2_28_x86_64:2024.07.01-1 |
| 127 | + extra_args: "--disable-gssapi" |
| 128 | + - name: "alpine musl +gssapi" |
| 129 | + artifact_key: p-librdkafka__plat-linux__dist-alpine__arch-x64__lnk-std__extra-gssapi |
| 130 | + image: alpine:3.16.9 |
| 131 | + extra_args: "" |
| 132 | + - name: "alpine musl" |
| 133 | + artifact_key: p-librdkafka__plat-linux__dist-alpine__arch-x64__lnk-all |
| 134 | + image: alpine:3.16.9 |
| 135 | + extra_args: "--disable-gssapi" |
| 136 | + steps: |
| 137 | + - uses: actions/checkout@v4 |
| 138 | + - name: Build |
| 139 | + run: | |
| 140 | + mkdir artifacts |
| 141 | + packaging/tools/build-release-artifacts.sh ${{ matrix.extra_args }} ${{ matrix.image }} artifacts/librdkafka.tgz |
| 142 | + - name: Upload artifacts |
| 143 | + uses: actions/upload-artifact@v4 |
| 144 | + with: |
| 145 | + name: ${{ matrix.artifact_key }} |
| 146 | + path: artifacts/ |
| 147 | + |
| 148 | + linux-arm64-release: |
| 149 | + runs-on: ubuntu-22.04 |
| 150 | + strategy: |
| 151 | + matrix: |
| 152 | + include: |
| 153 | + - name: "centos8 glibc +gssapi" |
| 154 | + artifact_key: p-librdkafka__plat-linux__dist-centos8__arch-arm64__lnk-std__extra-gssapi |
| 155 | + image: quay.io/pypa/manylinux_2_28_aarch64:2024.07.01-1 |
| 156 | + extra_args: "" |
| 157 | + - name: "centos8 glibc" |
| 158 | + artifact_key: p-librdkafka__plat-linux__dist-centos8__arch-arm64__lnk-all |
| 159 | + image: quay.io/pypa/manylinux_2_28_aarch64:2024.07.01-1 |
| 160 | + extra_args: "--disable-gssapi" |
| 161 | + - name: "alpine musl +gssapi" |
| 162 | + artifact_key: p-librdkafka__plat-linux__dist-alpine__arch-arm64__lnk-all__extra-gssapi |
| 163 | + image: alpine:3.16.9 |
| 164 | + extra_args: "" |
| 165 | + - name: "alpine musl" |
| 166 | + artifact_key: p-librdkafka__plat-linux__dist-alpine__arch-arm64__lnk-all |
| 167 | + image: alpine:3.16.9 |
| 168 | + extra_args: "--disable-gssapi" |
| 169 | + steps: |
| 170 | + - uses: actions/checkout@v4 |
| 171 | + - name: Set up QEMU |
| 172 | + uses: docker/setup-qemu-action@v3 |
| 173 | + - name: Build |
| 174 | + run: | |
| 175 | + mkdir artifacts |
| 176 | + packaging/tools/build-release-artifacts.sh ${{ matrix.extra_args }} ${{ matrix.image }} artifacts/librdkafka.tgz |
| 177 | + - name: Upload artifacts |
| 178 | + uses: actions/upload-artifact@v4 |
| 179 | + with: |
| 180 | + name: ${{ matrix.artifact_key }} |
| 181 | + path: artifacts/ |
| 182 | + |
| 183 | + windows-mingw: |
| 184 | + runs-on: windows-latest |
| 185 | + strategy: |
| 186 | + matrix: |
| 187 | + include: |
| 188 | + - name: "MinGW-w64 Dynamic" |
| 189 | + artifact_key: p-librdkafka__plat-windows__dist-mingw__arch-x64__lnk-std |
| 190 | + extra_args: "" |
| 191 | + - name: "MinGW-w64 Static" |
| 192 | + artifact_key: p-librdkafka__plat-windows__dist-mingw__arch-x64__lnk-static |
| 193 | + extra_args: "--static" |
| 194 | + env: |
| 195 | + CHERE_INVOKING: yes |
| 196 | + MSYSTEM: UCRT64 |
| 197 | + steps: |
| 198 | + - uses: actions/checkout@v4 |
| 199 | + - name: Setup MSYS2 |
| 200 | + uses: msys2/setup-msys2@v2 |
| 201 | + with: |
| 202 | + msystem: UCRT64 |
| 203 | + update: true |
| 204 | + - name: Build |
| 205 | + shell: msys2 {0} |
| 206 | + run: | |
| 207 | + mkdir artifacts |
| 208 | + ./packaging/mingw-w64/semaphoreci-build.sh ${{ matrix.extra_args }} ./artifacts/librdkafka.tgz |
| 209 | + - name: Upload artifacts |
| 210 | + uses: actions/upload-artifact@v4 |
| 211 | + with: |
| 212 | + name: ${{ matrix.artifact_key }} |
| 213 | + path: artifacts/ |
| 214 | + |
| 215 | + windows-msvc: |
| 216 | + runs-on: windows-latest |
| 217 | + strategy: |
| 218 | + matrix: |
| 219 | + include: |
| 220 | + - platform: x64 |
| 221 | + triplet: x64-windows |
| 222 | + artifact_key: p-librdkafka__plat-windows__dist-msvc__arch-x64__lnk-std |
| 223 | + - platform: Win32 |
| 224 | + triplet: x86-windows |
| 225 | + artifact_key: p-librdkafka__plat-windows__dist-msvc__arch-x86__lnk-std |
| 226 | + env: |
| 227 | + VCPKG_DISABLE_METRICS: yes |
| 228 | + steps: |
| 229 | + - uses: actions/checkout@v4 |
| 230 | + - name: Setup vcpkg |
| 231 | + run: | |
| 232 | + cd .. |
| 233 | + & .\librdkafka\win32\setup-vcpkg.ps1 |
| 234 | + cd librdkafka |
| 235 | + ..\vcpkg\vcpkg integrate install |
| 236 | + ..\vcpkg\vcpkg --feature-flags=versions install --triplet ${{ matrix.triplet }} |
| 237 | + - name: Build |
| 238 | + run: | |
| 239 | + & .\win32\msbuild.ps1 -platform ${{ matrix.platform }} |
| 240 | + & .\win32\package-zip.ps1 -platform ${{ matrix.platform }} |
| 241 | + - name: List artifacts |
| 242 | + run: | |
| 243 | + Get-ChildItem . -include *.dll -recurse |
| 244 | + Get-ChildItem . -include *.lib -recurse |
| 245 | + - name: Upload artifacts |
| 246 | + uses: actions/upload-artifact@v4 |
| 247 | + with: |
| 248 | + name: ${{ matrix.artifact_key }} |
| 249 | + path: artifacts/ |
| 250 | + |
| 251 | + packaging: |
| 252 | + needs: [documentation, osx-arm64, osx-x64, linux-x64-release, linux-arm64-release, windows-mingw, windows-msvc] |
| 253 | + runs-on: ubuntu-22.04 |
| 254 | + steps: |
| 255 | + - uses: actions/checkout@v4 |
| 256 | + - name: Download all artifacts |
| 257 | + uses: actions/download-artifact@v4 |
| 258 | + with: |
| 259 | + path: artifacts |
| 260 | + - name: Build packages |
| 261 | + shell: pwsh |
| 262 | + run: | |
| 263 | + # Different packaging for tagged vs untagged builds |
| 264 | + $vstring = "2.8.0-" |
| 265 | + if ($env:GITHUB_REF -match '^refs/tags/') { |
| 266 | + $vstring += "gr" |
| 267 | + } else { |
| 268 | + $vstring += "ci-$env:GITHUB_RUN_ID" |
| 269 | + } |
| 270 | +
|
| 271 | + mkdir packages |
| 272 | + cd packaging/nuget |
| 273 | + python3 -m pip install -U -r requirements.txt |
| 274 | + ./release.py --directory ../../artifacts --ignore-tag --class NugetPackage $vstring --nuget-version $vstring |
| 275 | + cp -v librdkafka.redist.*.nupkg ../../packages |
| 276 | + ./release.py --directory ../../artifacts --ignore-tag --class StaticPackage $vstring |
| 277 | + cp -v librdkafka-static-bundle*.tgz ../../packages |
| 278 | + cd ../../ |
| 279 | + cp -v artifacts/librdkafka-docs/librdkafka-docs.tgz packages/ |
| 280 | + cd packages |
| 281 | + ls -la |
| 282 | + sha256sum * |
| 283 | + - name: Upload packages |
| 284 | + uses: actions/upload-artifact@v4 |
| 285 | + with: |
| 286 | + name: librdkafka-artifacts |
| 287 | + path: packages/ |
| 288 | + |
| 289 | + # Publish NuGet packages when a tag is pushed. |
| 290 | + # Tests need to succeed for all components and on all platforms first, |
| 291 | + # including having a tag name that matches the version number. |
| 292 | + publish-release: |
| 293 | + if: ${{ startsWith(github.ref, 'refs/tags/v') }} |
| 294 | + needs: packaging |
| 295 | + runs-on: ubuntu-latest |
| 296 | + steps: |
| 297 | + - name: Download NuGet package artifacts |
| 298 | + uses: actions/download-artifact@v4 |
| 299 | + with: |
| 300 | + name: librdkafka-artifacts |
| 301 | + path: dist |
| 302 | + - name: Publish to NuGet |
| 303 | + run: | |
| 304 | + ls -al dist |
| 305 | + dotnet nuget push "dist/librdkafka*.nupkg" --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${GITHUB_TOKEN} |
| 306 | + env: |
| 307 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments