You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by xy...@apache.org on 2022/10/13 02:30:40 UTC

[pulsar-client-cpp] branch main updated: Use parametrized job to build packages (#36)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new ce8fe5a  Use parametrized job to build packages (#36)
ce8fe5a is described below

commit ce8fe5a68f5594f4c79b709a0818005811ea8999
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Wed Oct 12 19:30:35 2022 -0700

    Use parametrized job to build packages (#36)
    
    ### Motivation
    
    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          |  91 +++-------
 2 files changed, 46 insertions(+), 258 deletions(-)

diff --git a/.github/workflows/ci-build-binary-artifacts.yaml b/.github/workflows/ci-build-binary-artifacts.yaml
index dd48231..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: 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
-
-      - 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: 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
-
-      - 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: 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
-
-      - 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: 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
-
-      - 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: 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
-
-      - 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: 120
+  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 92157bf..4fbc83c 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,22 +208,24 @@ 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
 
 
   # Job that will be required to complete and depends on all the other jobs
   check-completion:
     name: Check Completion
     runs-on: ubuntu-latest
-    needs: [unit-tests, cpp-build-windows, deb-packaging, rpm-packaging, apk-packaging]
+    needs: [unit-tests, cpp-build-windows, package]
 
     steps:
       - run: true
+