From 330db36e077a073b66c33fb57586c78adb0fb224 Mon Sep 17 00:00:00 2001 From: tison Date: Thu, 16 Feb 2023 12:28:41 +0800 Subject: [PATCH 1/2] ci: Use QEMU as Docker push multi arch shortcoming Signed-off-by: tison --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++++++++++- .github/workflows/release.yml | 16 +++++----------- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a32703c..68e6cbe3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,19 +72,51 @@ jobs: - name: Maven verify run: ./mvnw clean verify + docker: + if: (github.event_name != 'schedule') || (github.repository == 'korandoru/hawkeye') + name: Check Docker image - ${{matrix.runner}} + strategy: + fail-fast: false + matrix: + runner: [buildjet-4vcpu-ubuntu-2204, buildjet-4vcpu-ubuntu-2204-arm] + runs-on: ${{matrix.runner}} + steps: + - uses: actions/checkout@v3 + - name: Build hawkeye + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile + load: true + tags: ghcr.io/korandoru/hawkeye:latest + - name: Build hawkeye-native + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile.native + load: true + tags: ghcr.io/korandoru/hawkeye-native:latest + - name: Check license headers + uses: ./ + - name: Run sanity checks + run: | + docker run --rm -v $(pwd):/github/workspace ghcr.io/korandoru/hawkeye:latest check + docker run --rm -v $(pwd):/github/workspace ghcr.io/korandoru/hawkeye-native:latest check + required: name: Required runs-on: ubuntu-latest - timeout-minutes: 10 if: ${{ always() && ((github.event_name != 'schedule') || (github.repository == 'korandoru/hawkeye')) }} needs: - check + - docker - unittest steps: - name: Guardian run: | if [[ ! ( \ "${{ needs.check.result }}" == "success" \ + && "${{ needs.docker.result }}" == "success" \ && "${{ needs.unittest.result }}" == "success" \ ) ]]; then echo "Required jobs haven't been completed successfully." diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index db63de8b..06afb3be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,37 +16,31 @@ name: Release on: push: - branches: [main] tags: ['v1.*'] pull_request: - branches: [main] + paths: ['.github/workflow/release.yml'] workflow_dispatch: jobs: release-docker-image: - name: Release - ${{matrix.name}} - ${{matrix.platform}} + name: Release - ${{matrix.name}} strategy: matrix: name: [hawkeye, hawkeye-native] file: [Dockerfile, Dockerfile.native] - runner: [buildjet-4vcpu-ubuntu-2204, buildjet-4vcpu-ubuntu-2204-arm] - platform: [linux/amd64, linux/arm64] exclude: - name: hawkeye file: Dockerfile.native - name: hawkeye-native file: Dockerfile - - runner: buildjet-4vcpu-ubuntu-2204 - platform: linux/arm64 - - runner: buildjet-4vcpu-ubuntu-2204-arm - platform: linux/amd64 - runs-on: ${{matrix.runner}} + runs-on: ubuntu-latest permissions: contents: read packages: write steps: - uses: actions/checkout@v3 + - uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v2 @@ -74,7 +68,7 @@ jobs: with: context: . file: ./${{ matrix.file }} - platforms: ${{ matrix.platform }} + platforms: linux/amd64, linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From d048a6a1ea0ff950e3a0ede5d66d035356a15e12 Mon Sep 17 00:00:00 2001 From: tison Date: Thu, 16 Feb 2023 12:34:39 +0800 Subject: [PATCH 2/2] Update .github/workflows/release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 06afb3be..4a8c49a0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ on: push: tags: ['v1.*'] pull_request: - paths: ['.github/workflow/release.yml'] + paths: ['.github/workflows/release.yml'] workflow_dispatch: jobs: