• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Container
2on:
3  push:
4    branches:
5      - stable
6      - dev
7    tags:
8      - "*"
9  pull_request:
10    branches:
11      - dev # No need for stable-pull-request, as that equals dev-push
12
13jobs:
14  build-and-test-amd64:
15    name: Test amd64 image
16    runs-on: ubuntu-latest
17    steps:
18      - name: Checkout
19        uses: actions/checkout@v3
20      - name: Set up Docker Buildx
21        uses: docker/setup-buildx-action@v2
22      - name: Build amd64
23        uses: docker/build-push-action@v3
24        with:
25          context: .
26          tags: aflplusplus:test-amd64
27          load: true
28          cache-to: type=gha,mode=max
29          build-args: |
30            TEST_BUILD=1
31      - name: Test amd64
32        run: >
33          docker run --rm aflplusplus:test-amd64 bash -c "
34          apt-get update &&
35          apt-get install -y libcmocka-dev &&
36          make -i tests
37          "
38
39  push:
40    name: Push amd64 and arm64 images
41    runs-on: ubuntu-latest
42    needs:
43      - build-and-test-amd64
44    if: ${{ github.event_name == 'push' && github.repository == 'AFLplusplus/AFLplusplus' }}
45    steps:
46      - name: Checkout
47        uses: actions/checkout@v3
48      - name: Set up QEMU
49        uses: docker/setup-qemu-action@v2
50        with:
51          platforms: arm64
52      - name: Set up Docker Buildx
53        uses: docker/setup-buildx-action@v2
54      - name: Login to docker.io
55        uses: docker/login-action@v2
56        with:
57          username: ${{ secrets.DOCKER_USERNAME }}
58          password: ${{ secrets.DOCKER_TOKEN }}
59      - name: Set tags to push
60        id: push-tags
61        run: |
62          PUSH_TAGS=docker.io/aflplusplus/aflplusplus:${GITHUB_REF_NAME}
63          if [ "${GITHUB_REF_NAME}" = "stable" ]; then
64            PUSH_TAGS=${PUSH_TAGS},docker.io/aflplusplus/aflplusplus:latest
65          fi
66          export PUSH_TAGS
67          echo "::set-output name=PUSH_TAGS::${PUSH_TAGS}"
68      - name: Push to docker.io registry
69        uses: docker/build-push-action@v3
70        with:
71          context: .
72          platforms: linux/amd64,linux/arm64
73          push: true
74          tags: ${{ steps.push-tags.outputs.PUSH_TAGS }}
75          cache-from: type=gha
76