about summary refs log tree commit diff
path: root/.github/workflows
diff options
context:
space:
mode:
authorrhtenhove <rhtenhove@users.noreply.github.com>2022-06-27 11:05:17 -0400
committerGitHub <noreply@github.com>2022-06-27 11:05:17 -0400
commit22c3b519fa92e02add77a0cf30600b5034d179d9 (patch)
tree0addb71fb3dbf1802b3ace7012b17b51691ba747 /.github/workflows
parent1dac69b1eb16dff00d7a625138da5555c3acccb8 (diff)
downloadafl++-22c3b519fa92e02add77a0cf30600b5034d179d9.tar.gz
reverts, fixes and even smaller image (#3)
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/container.yaml37
1 files changed, 22 insertions, 15 deletions
diff --git a/.github/workflows/container.yaml b/.github/workflows/container.yaml
index 504eadfa..534e737a 100644
--- a/.github/workflows/container.yaml
+++ b/.github/workflows/container.yaml
@@ -19,20 +19,21 @@ jobs:
         uses: actions/checkout@v3
       - name: Set up Docker Buildx
         uses: docker/setup-buildx-action@v2
-      - name: Login to GitHub Container Registry # Container cache registry
+      - name: Login to GitHub Container Registry  # Container cache registry
         uses: docker/login-action@v2
         with:
           registry: ghcr.io
-          username: ${{ github.actor }}
+          username: ${{ github.repository_owner }}
           password: ${{ secrets.GITHUB_TOKEN }}
       - name: Build amd64
         uses: docker/build-push-action@v3
         with:
           context: .
           platforms: linux/amd64
-          tags: ghcr.io/${{ github.actor }}/aflplusplus:amd64
+          tags: ghcr.io/${{ github.repository_owner }}/aflplusplus:amd64
           push: true
-          cache-from: type=registry,ref=ghcr.io/${{ github.actor }}/aflplusplus:amd64
+          cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/aflplusplus/cache:amd64,mode=max
+          cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/aflplusplus/cache:amd64
 
   build-arm64:
     name: Build arm64 image
@@ -46,7 +47,7 @@ jobs:
         uses: docker/login-action@v2
         with:
           registry: ghcr.io
-          username: ${{ github.actor }}
+          username: ${{ github.repository_owner }}
           password: ${{ secrets.GITHUB_TOKEN }}
       - name: Set up QEMU
         uses: docker/setup-qemu-action@v2
@@ -57,18 +58,24 @@ jobs:
         with:
           context: .
           platforms: linux/arm64
-          tags: ghcr.io/${{ github.actor }}/aflplusplus:arm64
+          tags: ghcr.io/${{ github.repository_owner }}/aflplusplus:arm64
           push: true
-          cache-from: type=registry,ref=ghcr.io/${{ github.actor }}/aflplusplus:arm64
+          cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/aflplusplus/cache:arm64,mode=max
+          cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/aflplusplus/cache:arm64
 
   test-amd64:
     name: Test amd64 image
     runs-on: ubuntu-latest
     needs: build-amd64
+    container:
+      image: ghcr.io/${{ github.repository_owner }}/aflplusplus:amd64
     steps:
       - name: Test amd64
-        run: docker run --rm ghcr.io/${{ github.actor }}/aflplusplus:amd64 make tests
-        continue-on-error: true
+        working-directory: /AFLplusplus
+        run: |
+          apt-get update
+          apt-get install -y libcmocka-dev
+          make -i tests
 
   codeql-amd64:
     name: CodeQL Analyze amd64 compiled code
@@ -76,7 +83,7 @@ jobs:
     needs:
       - build-amd64
     container:
-      image: ghcr.io/${{ github.actor }}/aflplusplus:amd64
+      image: ghcr.io/${{ github.repository_owner }}/aflplusplus:amd64
     steps:
       - name: Fix for using external repo in container build # https://github.com/actions/checkout/issues/760
         run: git config --global --add safe.directory /__w/AFLplusplus/AFLplusplus
@@ -100,7 +107,7 @@ jobs:
     needs:
       - test-amd64
       - build-arm64
-    if: ${{ github.event_name == 'push' }}
+    if: ${{ github.event_name == 'push' && github.repository == 'AFLplusplus/AFLplusplus' }}
     steps:
       - name: Checkout
         uses: actions/checkout@v3
@@ -128,9 +135,9 @@ jobs:
         uses: docker/build-push-action@v3
         with:
           context: .
-          platforms: linux/amd64,linux/arm64 # TODO: Fix: arm64 image doesn't use cached layer from COPY line
+          platforms: linux/amd64,linux/arm64
           push: true
           tags: ${{ steps.push-tags.outputs.PUSH_TAGS }}
-          cache-from: |
-            type=registry,ref=ghcr.io/${{ github.actor }}/aflplusplus:amd64
-            type=registry,ref=ghcr.io/${{ github.actor }}/aflplusplus:arm64
+          cache-from: |  # TODO: From COPY line on is not cached
+            type=registry,ref=ghcr.io/${{ github.repository_owner }}/aflplusplus/cache:amd64
+            type=registry,ref=ghcr.io/${{ github.repository_owner }}/aflplusplus/cache:arm64