From fa6bac2ea98768a002b31016d6fd28a45698a525 Mon Sep 17 00:00:00 2001 From: Alex Bozarth Date: Mon, 9 Dec 2024 11:49:55 -0600 Subject: [PATCH] Switch from qemu to runners Signed-off-by: Alex Bozarth --- .github/workflows/openssl3.yml | 32 +++++++++++++++--------- .github/workflows/push-manifest.yml | 38 +++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/push-manifest.yml diff --git a/.github/workflows/openssl3.yml b/.github/workflows/openssl3.yml index ff6c6b1..3cb2cda 100644 --- a/.github/workflows/openssl3.yml +++ b/.github/workflows/openssl3.yml @@ -2,7 +2,7 @@ name: openssl3 on: push: - branches: [ 'main' ] + branches: [ '*' ] paths: ['.github/workflows/openssl3.yml', 'openssl3/**'] pull_request: branches: [ 'main' ] @@ -38,17 +38,17 @@ env: jobs: build: - runs-on: ubuntu-latest strategy: fail-fast: false matrix: - platform: - - linux/amd64 - - linux/arm64 + include: + - arch: arm64 + runner: oqs-arm64 + - arch: x86_64 + runner: ubuntu-latest + runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v4 - - uses: docker/setup-qemu-action@v3 - - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 if: env.push == 'true' with: @@ -65,8 +65,8 @@ jobs: with: load: true context: openssl3 - platforms: ${{ matrix.platform }} build-args: | + ARCH=${{ matrix.arch }} MAKE_DEFINES=-j4 ${{ (inputs.build_main == 'true') && env.build-args || null }} tags: oqs-ossl3 @@ -82,10 +82,20 @@ jobs: with: push: true context: openssl3 - platforms: ${{ matrix.platform }} build-args: | + ARCH=${{ matrix.arch }} MAKE_DEFINES=-j4 ${{ (inputs.build_main == 'true') && env.build-args || null }} tags: | - openquantumsafe/openssl3:${{ inputs.release_tag || 'latest' }} - ghcr.io/open-quantum-safe/openssl3:${{ inputs.release_tag || 'latest' }} + ghcr.io/${{ github.repository_owner }}/openssl3:${{ inputs.release_tag || 'latest' }}-${{ matrix.arch }} + openquantumsafe/openssl3:${{ inputs.release_tag || 'latest' }}-${{ matrix.arch }} + + push: + needs: build + runs-on: ubuntu-latest + steps: + - uses: ./.github/workflows/manifest + if: env.push == 'true' + with: + image_name: openssl3 + release_tag: ${{ inputs.release_tag || 'latest' }} \ No newline at end of file diff --git a/.github/workflows/push-manifest.yml b/.github/workflows/push-manifest.yml new file mode 100644 index 0000000..393405b --- /dev/null +++ b/.github/workflows/push-manifest.yml @@ -0,0 +1,38 @@ +name: push-manifest + +on: + workflow_call: + inputs: + image_name: + description: "Which docker image to push to" + required: true + type: string + release_tag: + description: "Which docker tag to push to" + required: false + type: string + +jobs: + push: + runs-on: ubuntu-latest + steps: + - uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push multiarch image + run: | + docker manifest create ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }} \ + --amend ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }}-x86_64 \ + --amend ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }}-arm64 + docker manifest push ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }} + docker manifest create openquantumsafe/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }} \ + --amend openquantumsafe/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }}-x86_64 \ + --amend openquantumsafe/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }}-arm64 + docker manifest push openquantumsafe/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }}