Disable parallel gcc builds in GitHub Actions #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: sgdk-docker | |
concurrency: | |
group: ${{ github.ref }}-sgdk-docker | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: # Allows for manual triggering. | |
pull_request: # Trigger for pull requests. | |
types: [opened, synchronize, reopened, ready_for_review] | |
branches: | |
- master | |
push: # Trigger when pushed to master. | |
branches: | |
- 'master' | |
paths-ignore: | |
- '.github/**' | |
- 'vstudio/**' | |
- 'bin/**' | |
- 'sample/**' | |
- '**.md' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GHCR (push events only) | |
if: github.event_name == 'push' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check if GCC Dockerfile has changed | |
id: changed-files | |
uses: tj-actions/changed-files@v42 | |
with: | |
files_yaml: | | |
gcc: | |
- deps/gcc.Dockerfile | |
- name: If changed, build (and maybe push) m68k GCC | |
if: steps.changed-files.outputs.gcc_any_changed == 'true' | |
uses: docker/build-push-action@v5 | |
with: | |
file: deps/gcc.Dockerfile | |
context: deps/ | |
platforms: linux/amd64,linux/arm64 | |
# Disable parallel builds, which are hanging in GitHub Actions. | |
build-args: | | |
PARALLEL_BUILD=0 | |
tags: ghcr.io/${{ github.actor }}/sgdk-m68k-gcc:latest | |
push: ${{ github.event_name == 'push' }} | |
# NOTE: If you are seeing failures in this job right after forking SGDK, | |
# you may need to bootstrap the base image into your fork on ghcr.io. | |
# This can be done with: | |
# docker image pull ghcr.io/stephane-d/sgdk-m68k-gcc:latest | |
# docker image tag ghcr.io/stephane-d/sgdk-m68k-gcc:latest \ | |
# ghcr.io/YOUR_NAMEE/sgdk-m68k-gcc:latest | |
# gh auth token | docker login ghcr.io -u YOUR_NAME --password-stdin | |
# docker image push ghcr.io/YOUR_NAMEE/sgdk-m68k-gcc:latest | |
- name: Build (any maybe push) SGDK | |
uses: docker/build-push-action@v5 | |
with: | |
file: Dockerfile | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
BASE_IMAGE=ghcr.io/${{ github.actor }}/sgdk-m68k-gcc | |
tags: ghcr.io/${{ github.actor }}/sgdk:latest | |
push: ${{ github.event_name == 'push' }} |