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