|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened] |
| 6 | + |
| 7 | + |
| 8 | +# automatically cancel previous runs on the same PR |
| 9 | +# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre/67939898#67939898 |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | + |
| 15 | +jobs: |
| 16 | + # tmate: |
| 17 | + # name: TMate |
| 18 | + # runs-on: postgres-builder-32core |
| 19 | + # timeout-minutes: 120 |
| 20 | + # steps: |
| 21 | + # - name: Checkout |
| 22 | + # uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v3 |
| 23 | + # with: |
| 24 | + # # https://github.com/actions/checkout/issues/626 |
| 25 | + # # This is correct, because we're using a merge queue (mergify) which only merges when built against the latest target branch. |
| 26 | + # # https://docs.mergify.com/actions/queue/ |
| 27 | + # ref: ${{ github.event.pull_request.head.sha }} |
| 28 | + |
| 29 | + # - name: Set up Docker Buildx |
| 30 | + # uses: docker/setup-buildx-action@v2 |
| 31 | + |
| 32 | + # - name: Setup tmate session |
| 33 | + # uses: mxschmitt/action-tmate@v3 |
| 34 | + |
| 35 | + docker-build: |
| 36 | + name: Build Docker ${{ fromJson(matrix.image).dockerfile }} |
| 37 | + runs-on: postgres-builder-32core |
| 38 | + timeout-minutes: 120 |
| 39 | + strategy: |
| 40 | + fail-fast: false |
| 41 | + matrix: |
| 42 | + image: |
| 43 | + - '{"dockerfile": "./Dockerfile", "context": ".", "platforms": "linux/amd64" }' |
| 44 | + - '{"dockerfile": "./Dockerfile.ami_buildscript", "context": ".", "platforms": "linux/amd64" }' |
| 45 | + steps: |
| 46 | + - name: Checkout |
| 47 | + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v3 |
| 48 | + with: |
| 49 | + # https://github.com/actions/checkout/issues/626 |
| 50 | + # This is correct, because we're using a merge queue (mergify) which only merges when built against the latest target branch. |
| 51 | + # https://docs.mergify.com/actions/queue/ |
| 52 | + ref: ${{ github.event.pull_request.head.sha }} |
| 53 | + |
| 54 | + - name: Set up Docker Buildx |
| 55 | + uses: docker/setup-buildx-action@v2 |
| 56 | + |
| 57 | + - name: Docker Cache |
| 58 | + uses: actions/cache@v3 |
| 59 | + with: |
| 60 | + path: /tmp/.buildx-cache |
| 61 | + key: ${{ runner.os }}-${{ fromJson(matrix.image).dockerfile }}-buildx |
| 62 | + |
| 63 | + - name: Docker build |
| 64 | + uses: docker/build-push-action@v4 |
| 65 | + with: |
| 66 | + context: ${{ fromJson(matrix.image).context }} |
| 67 | + file: ${{ fromJson(matrix.image).dockerfile }} |
| 68 | + platforms: ${{ fromJson(matrix.image).platforms }} |
| 69 | + cache-from: type=local,src=/tmp/.buildx-cache |
| 70 | + cache-to: type=local,dest=/tmp/.buildx-cache,mode=max |
| 71 | + push: false |
0 commit comments