This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar-client-cpp.git

commit a6716404a120f606a9ba6e81db80ddfcad2272b0
Author: Matteo Merli <[email protected]>
AuthorDate: Wed Oct 12 19:30:35 2022 -0700

    Use parametrized job to build packages (#36)
    
    Consolidated all the RPM/DEB/APK jobs into a single matrix
---
 .github/workflows/ci-build-binary-artifacts.yaml | 213 +++--------------------
 .github/workflows/ci-pr-validation.yaml          |  89 +++-------
 2 files changed, 45 insertions(+), 257 deletions(-)

diff --git a/.github/workflows/ci-build-binary-artifacts.yaml 
b/.github/workflows/ci-build-binary-artifacts.yaml
index 46a9cf7..21e13db 100644
--- a/.github/workflows/ci-build-binary-artifacts.yaml
+++ b/.github/workflows/ci-build-binary-artifacts.yaml
@@ -29,188 +29,21 @@ concurrency:
 
 jobs:
 
-  deb-packaging-x86_64:
-    name: Build Debian Package - x86_64
-    runs-on: ubuntu-20.04
-    timeout-minutes: 300
-
-    steps:
-      - name: checkout
-        uses: actions/checkout@v2
-
-      - name: Package Pulsar source
-        run: build-support/generate-source-archive.sh
-
-      - uses: docker/setup-buildx-action@v2
-      - run: build-support/copy-deps-versionfile.sh
-
-      - name: Build dependencies Docker image
-        uses: docker/build-push-action@v3
-        with:
-          context: ./pkg/deb
-          load: true
-          tags: build-deb-x86_64:latest
-          build-args: PLATFORM=x86_64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
-
-      - name: Build Debian packages
-        run: pkg/deb/docker-build-deb-x86_64.sh build-deb-x86_64:latest
-
-      - name: Upload artifacts
-        uses: actions/upload-artifact@v3
-        with:
-          name: deb-x86_64
-          path: pkg/deb/BUILD/DEB
-
-  deb-packaging-arm64:
-    name: Build Debian Package - Arm64
-    runs-on: ubuntu-20.04
-    timeout-minutes: 300
-
-    steps:
-      - name: checkout
-        uses: actions/checkout@v2
-
-      - name: Set up QEMU
-        uses: docker/setup-qemu-action@v1
-
-      - name: Package Pulsar source
-        run: build-support/generate-source-archive.sh
-
-      - uses: docker/setup-buildx-action@v2
-      - run: build-support/copy-deps-versionfile.sh
-
-      - name: Build dependencies Docker image
-        uses: docker/build-push-action@v3
-        with:
-          context: ./pkg/deb
-          load: true
-          tags: build-deb-arm64:latest
-          build-args: PLATFORM=aarch64
-          platforms: linux/arm64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
-
-      - name: Build Debian packages
-        run: pkg/deb/docker-build-deb-arm64.sh build-deb-arm64:latest
-
-      - name: Upload artifacts
-        uses: actions/upload-artifact@v3
-        with:
-          name: deb-arm64
-          path: pkg/deb/BUILD/DEB
-
-  rpm-packaging-x86_64:
-    name: Build RPM Package - x86_64
-    runs-on: ubuntu-20.04
-    timeout-minutes: 300
-
-    steps:
-      - name: checkout
-        uses: actions/checkout@v2
-
-      - name: Package Pulsar source
-        run: build-support/generate-source-archive.sh
-
-      - uses: docker/setup-buildx-action@v2
-      - run: build-support/copy-deps-versionfile.sh
-
-      - name: Build dependencies Docker image
-        uses: docker/build-push-action@v3
-        with:
-          context: ./pkg/rpm
-          load: true
-          tags: build-rpm-x86_64:latest
-          build-args: PLATFORM=x86_64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
-
-      - name: Build RPM packages
-        run: pkg/rpm/docker-build-rpm-x86_64.sh build-rpm-x86_64:latest
-
-      - name: Upload artifacts
-        uses: actions/upload-artifact@v3
-        with:
-          name: rpm-x86_64
-          path: pkg/rpm/RPMS
-
-  rpm-packaging-arm64:
-    name: Build RPM Package - arm64
-    runs-on: ubuntu-20.04
-    timeout-minutes: 300
-
-    steps:
-      - name: checkout
-        uses: actions/checkout@v2
-
-      - name: Set up QEMU
-        uses: docker/setup-qemu-action@v1
-
-      - name: Package Pulsar source
-        run: build-support/generate-source-archive.sh
-
-      - uses: docker/setup-buildx-action@v2
-      - run: build-support/copy-deps-versionfile.sh
-
-      - name: Build dependencies Docker image
-        uses: docker/build-push-action@v3
-        with:
-          context: ./pkg/rpm
-          load: true
-          tags: build-rpm-arm64:latest
-          build-args: PLATFORM=aarch64
-          platforms: linux/arm64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
-
-      - name: Build RPM packages
-        run: pkg/rpm/docker-build-rpm-arm64.sh build-rpm-arm64:latest
-
-      - name: Upload artifacts
-        uses: actions/upload-artifact@v3
-        with:
-          name: rpm-arm64
-          path: pkg/rpm/RPMS
-
-  apk-packaging-x86_64:
-    name: Build Alpine Linux APK Package - x86_64
-    runs-on: ubuntu-20.04
-    timeout-minutes: 300
-
-    steps:
-      - name: checkout
-        uses: actions/checkout@v2
-
-      - name: Package Pulsar source
-        run: build-support/generate-source-archive.sh
-
-      - uses: docker/setup-buildx-action@v2
-      - run: build-support/copy-deps-versionfile.sh
-
-      - name: Build dependencies Docker image
-        uses: docker/build-push-action@v3
-        with:
-          context: ./pkg/apk
-          load: true
-          tags: build-apk-x86_64:latest
-          build-args: PLATFORM=x86_64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
-
-      - name: Build APK packages
-        run: pkg/apk/docker-build-apk-x86_64.sh build-apk-x86_64:latest
-
-      - name: Upload artifacts
-        uses: actions/upload-artifact@v3
-        with:
-          name: apk-x86_64
-          path: pkg/apk/build/x86_64
-
-  apk-packaging-arm64:
-    name: Build Alpine Linux APK Package - arm64
-    runs-on: ubuntu-20.04
-    timeout-minutes: 300
+  package:
+    name: Build ${{matrix.pkg.name}} ${{matrix.cpu.platform}}
+    runs-on: ubuntu-22.04
+    timeout-minutes: 500
+
+    strategy:
+      fail-fast: false
+      matrix:
+        pkg:
+          - { name: 'RPM', type: 'rpm', path: 'pkg/rpm/RPMS' }
+          - { name: 'Deb', type: 'deb', path: 'pkg/deb/BUILD/DEB' }
+          - { name: 'Alpine', type: 'apk', path: 'pkg/apk/build' }
+        cpu:
+          - { arch: 'x86_64', platform: 'x86_64' }
+          - { arch: 'aarch64', platform: 'arm64' }
 
     steps:
       - name: checkout
@@ -228,19 +61,19 @@ jobs:
       - name: Build dependencies Docker image
         uses: docker/build-push-action@v3
         with:
-          context: ./pkg/apk
+          context: ./pkg/${{matrix.pkg.type}}
           load: true
-          tags: build-apk-arm64:latest
-          build-args: PLATFORM=aarch64
-          platforms: linux/arm64
+          tags: build:latest
+          platforms: linux/${{matrix.cpu.platform}}
+          build-args: PLATFORM=${{matrix.cpu.arch}}
           cache-from: type=gha
           cache-to: type=gha,mode=max
 
-      - name: Build APK packages
-        run: pkg/apk/docker-build-apk-arm64.sh build-apk-arm64:latest
+      - name: Build packages
+        run: 
pkg/${{matrix.pkg.type}}/docker-build-${{matrix.pkg.type}}-${{matrix.cpu.platform}}.sh
 build:latest
 
       - name: Upload artifacts
         uses: actions/upload-artifact@v3
         with:
-          name: apk-arm64
-          path: pkg/apk/build/aarch64
+          name: ${{matrix.pkg.type}}-${{matrix.pkg.platform}}
+          path: ${{matrix.pkg.path}}
diff --git a/.github/workflows/ci-pr-validation.yaml 
b/.github/workflows/ci-pr-validation.yaml
index 229e6fa..b4b9655 100644
--- a/.github/workflows/ci-pr-validation.yaml
+++ b/.github/workflows/ci-pr-validation.yaml
@@ -176,75 +176,28 @@ jobs:
             cmake --build ./build-1 --parallel --config Release
           fi
 
-  deb-packaging:
-    name: Build Debian Package
-    runs-on: ubuntu-20.04
+  package:
+    name: Build ${{matrix.pkg.name}} ${{matrix.cpu.platform}}
+    runs-on: ubuntu-22.04
     needs: unit-tests
-    timeout-minutes: 120
-
-    steps:
-      - name: checkout
-        uses: actions/checkout@v2
-
-      - name: Package Pulsar source
-        run: build-support/generate-source-archive.sh
-
-      - uses: docker/setup-buildx-action@v2
-      - run: build-support/copy-deps-versionfile.sh
+    timeout-minutes: 500
 
-      - name: Build dependencies Docker image
-        uses: docker/build-push-action@v3
-        with:
-          context: ./pkg/deb
-          load: true
-          tags: build-deb-x86_64:latest
-          build-args: PLATFORM=x86_64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
-
-      - name: Build Debian packages
-        run: pkg/deb/docker-build-deb-x86_64.sh build-deb-x86_64:latest
-
-
-  rpm-packaging:
-    name: Build RPM Package
-    runs-on: ubuntu-20.04
-    needs: unit-tests
-    timeout-minutes: 120
+    strategy:
+      fail-fast: true
+      matrix:
+        pkg:
+          - { name: 'RPM', type: 'rpm', path: 'pkg/rpm/RPMS' }
+          - { name: 'Deb', type: 'deb', path: 'pkg/deb/BUILD/DEB' }
+          - { name: 'Alpine', type: 'apk', path: 'pkg/apk/build' }
+        cpu:
+          - { arch: 'x86_64', platform: 'x86_64' }
 
     steps:
       - name: checkout
         uses: actions/checkout@v2
 
-      - name: Package Pulsar source
-        run: build-support/generate-source-archive.sh
-
-      - uses: docker/setup-buildx-action@v2
-      - run: build-support/copy-deps-versionfile.sh
-
-      - name: Build dependencies Docker image
-        uses: docker/build-push-action@v3
-        with:
-          context: ./pkg/rpm
-          load: true
-          tags: build-rpm-x86_64:latest
-          build-args: PLATFORM=x86_64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
-
-      - name: Build RPM packages
-        run: pkg/rpm/docker-build-rpm-x86_64.sh build-rpm-x86_64:latest
-
-
-  apk-packaging:
-    name: Build Alpine Linux APK Package
-    runs-on: ubuntu-20.04
-    needs: unit-tests
-    timeout-minutes: 120
-
-    steps:
-      - name: checkout
-        uses: actions/checkout@v2
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v1
 
       - name: Package Pulsar source
         run: build-support/generate-source-archive.sh
@@ -255,12 +208,14 @@ jobs:
       - name: Build dependencies Docker image
         uses: docker/build-push-action@v3
         with:
-          context: ./pkg/apk
+          context: ./pkg/${{matrix.pkg.type}}
           load: true
-          tags: build-apk-x86_64:latest
-          build-args: PLATFORM=x86_64
+          tags: build:latest
+          platforms: linux/${{matrix.cpu.platform}}
+          build-args: PLATFORM=${{matrix.cpu.arch}}
           cache-from: type=gha
           cache-to: type=gha,mode=max
 
-      - name: Build APK packages
-        run: pkg/apk/docker-build-apk-x86_64.sh build-apk-x86_64:latest
+      - name: Build packages
+        run: 
pkg/${{matrix.pkg.type}}/docker-build-${{matrix.pkg.type}}-${{matrix.cpu.platform}}.sh
 build:latest
+

Reply via email to