From 0da7ddb738df60b3650d36832c9ede040a7ba6b9 Mon Sep 17 00:00:00 2001 From: rhtenhove Date: Wed, 22 Jun 2022 06:36:35 -0400 Subject: concurrency and caching (#1) * use concurrency * run here too * allow test failure * only push on push * fix coresight mode build * support but disable coresight * woops * no unicorn for arm * update codeql and fix makefile * forgot those * disable forward cache * fix needing buildx Co-authored-by: Ruben ten Hove --- .github/workflows/build-push-test-container.yaml | 61 --------------- .github/workflows/build-test-push-container.yaml | 96 ++++++++++++++++++++++++ .github/workflows/codeql-analysis.yml | 6 +- 3 files changed, 99 insertions(+), 64 deletions(-) delete mode 100644 .github/workflows/build-push-test-container.yaml create mode 100644 .github/workflows/build-test-push-container.yaml (limited to '.github/workflows') diff --git a/.github/workflows/build-push-test-container.yaml b/.github/workflows/build-push-test-container.yaml deleted file mode 100644 index e2b828ac..00000000 --- a/.github/workflows/build-push-test-container.yaml +++ /dev/null @@ -1,61 +0,0 @@ -name: Build, test and push container image - -on: - push: - branches: - - stable - - dev - tags: - - '*' - -jobs: - build: - name: Build, test and push container image - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: arm64 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Build amd64 image - uses: docker/build-push-action@v3 - with: - context: . - platforms: linux/amd64 - load: true - tags: aflplusplus/aflplusplus:test - - name: Build arm64 image - uses: docker/build-push-action@v3 - with: - context: . - platforms: linux/arm64 - load: true - tags: aflplusplus/aflplusplus:test - - name: Test linux/amd64 image - run: docker run --rm --platform linux/amd64 aflplusplus/aflplusplus:test make tests - - name: Test linux/arm64 image - run: docker run --rm --platform linux/arm64 aflplusplus/aflplusplus:test make tests - - name: Login to Dockerhub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - name: Publish ${{ github.ref_name }} to docker.io registry - uses: docker/build-push-action@v3 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: aflplusplus/aflplusplus:${{ github.ref_name }} - if: ${{ github.ref_name != 'stable' }} - - name: Publish stable and latest to docker.io registry - uses: docker/build-push-action@v3 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: aflplusplus/aflplusplus:${{ github.ref_name }},aflplusplus/aflplusplus:latest - if: ${{ github.ref_name == 'stable' }} diff --git a/.github/workflows/build-test-push-container.yaml b/.github/workflows/build-test-push-container.yaml new file mode 100644 index 00000000..5d9e69e4 --- /dev/null +++ b/.github/workflows/build-test-push-container.yaml @@ -0,0 +1,96 @@ +name: Build and test container image +on: + push: + branches: + - stable + - dev + tags: + - '*' + pull_request: + branch: + - stable + - dev + +jobs: + build-amd64: + name: Build and test amd64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build amd64 + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64 + load: true + tags: aflplusplus/aflplusplus:test + # cache-from: type=gha # Ensure we always build a fresh image. We just use the cache for the subsequent push job. + cache-to: type=gha,mode=max + - name: Test linux/amd64 image + run: docker run --rm --platform linux/amd64 aflplusplus/aflplusplus:test make tests + continue-on-error: true + build-arm64: + name: Build and test arm64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: arm64 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build arm64 + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/arm64 + load: true + tags: aflplusplus/aflplusplus:test + # cache-from: type=gha # Ensure we always build a fresh image. We just use the cache for the subsequent push job. + cache-to: type=gha,mode=max + - name: Test linux/arm64 image + run: docker run --rm --platform linux/arm64 aflplusplus/aflplusplus:test make tests + continue-on-error: true + push: + needs: + - build-amd64 + - build-arm64 + if: ${{ github.event_name == 'push' }} + name: Push image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: arm64 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Dockerhub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: Publish ${{ github.ref_name }} for amd64 and arm64 to docker.io registry + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: aflplusplus/aflplusplus:${{ github.ref_name }} + cache-from: type=gha + # cache-to: type=gha,mode=max # No need to add to cache as we'll never use this + if: ${{ github.ref_name != 'stable' }} + - name: Publish stable and latest to docker.io registry + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: aflplusplus/aflplusplus:${{ github.ref_name }},aflplusplus/aflplusplus:latest + cache-from: type=gha + # cache-to: type=gha,mode=max # No need to add to cache as we'll never use this + if: ${{ github.ref_name == 'stable' }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d5dce05f..55d477fc 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -21,12 +21,12 @@ jobs: uses: actions/checkout@v3 - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 -- cgit v1.2.3