Skip to content

Commit

Permalink
Use parametrized job to build packages (#36)
Browse files Browse the repository at this point in the history
### Motivation

Consolidated all the RPM/DEB/APK jobs into a single matrix
  • Loading branch information
merlimat authored Oct 13, 2022
1 parent 0fbe25e commit ce8fe5a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 258 deletions.
213 changes: 23 additions & 190 deletions .github/workflows/ci-build-binary-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}}
91 changes: 23 additions & 68 deletions .github/workflows/ci-pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit ce8fe5a

Please sign in to comment.