Skip to content

Commit

Permalink
ci: use GHA matrix to build two images
Browse files Browse the repository at this point in the history
Signed-off-by: Zespre Schmidt <starbops@zespre.com>
  • Loading branch information
starbops committed Jul 28, 2024
1 parent f847130 commit 7103c2d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 63 deletions.
33 changes: 10 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ on:
jobs:
build-main:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dockerfile: ./Dockerfile
image: starbops/kubebmc-controller
- dockerfile: ./Dockerfile.kbmc
image: starbops/kbmc
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -28,30 +31,14 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: |
starbops/kubebmc-controller
starbops/kbmc
- name: Test
run: make test
- name: Build
run: make build
- name: Docker build and push (controller)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker build and push (kbmc)
images: ${{ matrix.image }}
- name: Docker build and push
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile.kbmc
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
29 changes: 12 additions & 17 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ on:
jobs:
build-pr:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dockerfile: ./Dockerfile
image: starbops/kubebmc-controller
- dockerfile: ./Dockerfile.kbmc
image: starbops/kbmc
steps:
- name: Check out repository code
uses: actions/checkout@v4
Expand All @@ -24,30 +31,18 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: |
starbops/kubebmc-controller
starbops/kbmc
- name: Test
images: ${{ matrix.image }}
- name: Run tests
run: make test
- name: Build
- name: Build binaries
run: make build
- name: Docker build (controller)
- name: Docker build
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker build (kbmc)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile.kbmc
file: ${{ matrix.dockerfile }}
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
33 changes: 10 additions & 23 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ on:
jobs:
build-tag:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dockerfile: ./Dockerfile
image: starbops/kubebmc-controller
- dockerfile: ./Dockerfile.kbmc
image: starbops/kbmc
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -28,30 +31,14 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: |
starbops/kubebmc-controller
starbops/kbmc
- name: Test
run: make test
- name: Build
run: make build
- name: Docker build and push (controller)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker build and push (kbmc)
images: ${{ matrix.image }}
- name: Docker build and push
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile.kbmc
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 7103c2d

Please sign in to comment.