Skip to content

Commit

Permalink
Refactor matrix; add push jobs to run on main only
Browse files Browse the repository at this point in the history
Signed-off-by: Spencer Wilson <[email protected]>
  • Loading branch information
SWilson4 committed Aug 23, 2024
1 parent bf32d36 commit ec2caa4
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build Docker images

on:
pull_request:
push:
branches-ignore: 'main'

jobs:
ubuntu:
strategy:
matrix:
arch:
- arm64
- x86_64
distro:
- focal
- jammy
- latest
include:
- arch: arm64
runner: oqs-arm64
- arch: x86_64
runner: ubuntu-latest
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build image
uses: docker/build-push-action@v6
with:
push: false
build-args: ARCH=${{ matrix.arch }}
tags: openquantumsafe/ci-ubuntu-${{ matrix.distro }}:latest-${{ matrix.arch }}
context: ubuntu-${{ matrix.distro }}
24 changes: 21 additions & 3 deletions .github/workflows/ci.yml → .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Build and push Docker images

on:
push:
branches: 'main'

jobs:
ubuntu-arm64:
Expand All @@ -15,10 +16,15 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build arm64 tag
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push arm64 tag
uses: docker/build-push-action@v6
with:
# push: true
push: true
build-args: ARCH=arm64
tags: openquantumsafe/ci-ubuntu-${{ matrix.distro }}:latest-arm64
context: ubuntu-${{ matrix.distro }}
Expand All @@ -35,10 +41,22 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
if: github.ref_name == 'main'
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push x86_64 tag
uses: docker/build-push-action@v6
with:
# push: true
push: true
build-args: ARCH=x86_64
tags: openquantumsafe/ci-ubuntu-${{ matrix.distro }}:latest-x86_64
context: ubuntu-${{ matrix.distro }}
- name: Create multiarch image
run: |
docker manifest create openquantumsafe/ci-ubuntu-${{ matrix.distro }}:latest \
--amend openquantumsafe/ci-ubuntu-${{ matrix.distro }}:latest-x86_64 \
--amend openquantumsafe/ci-ubuntu-${{ matrix.distro }}:latest-arm64 \
&& docker manifest push openquantumsafe/ci-ubuntu-${{ matrix.distro }}:latest

0 comments on commit ec2caa4

Please sign in to comment.