From 7b171b4abc349ed7906848aa52faafc438ec75c2 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 10 Jul 2026 21:52:00 -0400 Subject: [PATCH 1/7] Add CI job to check syntax of `contrib` scripts Note that `zsh` is not installed in `ubuntu-slim` by default. --- .github/scripts/check-contrib.sh | 8 ++++++++ .github/workflows/check-contrib.yml | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 .github/scripts/check-contrib.sh create mode 100644 .github/workflows/check-contrib.yml diff --git a/.github/scripts/check-contrib.sh b/.github/scripts/check-contrib.sh new file mode 100755 index 000000000..f56a5a8a8 --- /dev/null +++ b/.github/scripts/check-contrib.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh +set -e + +bash --version +zsh --version + +find contrib -type f \( -name '*.sh' -o -name '*.bash' \) -exec bash --norc -n {} \; +find contrib/zsh_compl -type f -name '_rgb*' -exec zsh -n {} \; diff --git a/.github/workflows/check-contrib.yml b/.github/workflows/check-contrib.yml new file mode 100644 index 000000000..34e24620d --- /dev/null +++ b/.github/workflows/check-contrib.yml @@ -0,0 +1,23 @@ +name: Contrib script syntax checking +on: + - push + - pull_request + +env: + # Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/) + TERM: xterm-256color + CLICOLOR: 1 + CLICOLOR_FORCE: 1 + +jobs: + check-contrib: + runs-on: ubuntu-slim + steps: + - name: Checkout repo + uses: actions/checkout@v7 + - name: Install zsh + run: | + sudo apt install -Uyq zsh + - name: Check contrib scripts + run: | + .github/scripts/check-contrib.sh From 7d91957732508b314037f6be7ce71ce8c6cfb359 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 10 Jul 2026 21:54:35 -0400 Subject: [PATCH 2/7] Move CI-only `check-format` script to `.github/` --- contrib/checkformat.sh => .github/scripts/check-format.sh | 0 .github/workflows/{checkformat.yml => check-format.yml} | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename contrib/checkformat.sh => .github/scripts/check-format.sh (100%) rename .github/workflows/{checkformat.yml => check-format.yml} (88%) diff --git a/contrib/checkformat.sh b/.github/scripts/check-format.sh similarity index 100% rename from contrib/checkformat.sh rename to .github/scripts/check-format.sh diff --git a/.github/workflows/checkformat.yml b/.github/workflows/check-format.yml similarity index 88% rename from .github/workflows/checkformat.yml rename to .github/workflows/check-format.yml index 65842b2a8..ccd56ccd1 100644 --- a/.github/workflows/checkformat.yml +++ b/.github/workflows/check-format.yml @@ -8,7 +8,7 @@ env: CLICOLOR_FORCE: 1 jobs: - checkformat: + check-format: runs-on: ubuntu-slim steps: - name: Checkout repo @@ -18,4 +18,4 @@ jobs: sudo apt install -Uyq clang-format - name: Check format run: | - contrib/checkformat.sh + .github/scripts/check-format.sh From 590e6b1b85a7cfd5057d411faafb10b3aca18b88 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 10 Jul 2026 21:56:53 -0400 Subject: [PATCH 3/7] Move CI-only `check-diff` script to `.github/` --- .../checkdiff.bash => .github/scripts/check-diff.bash | 0 .github/workflows/{checkdiff.yml => check-diff.yml} | 4 ++-- Makefile | 9 +-------- 3 files changed, 3 insertions(+), 10 deletions(-) rename contrib/checkdiff.bash => .github/scripts/check-diff.bash (100%) rename .github/workflows/{checkdiff.yml => check-diff.yml} (89%) diff --git a/contrib/checkdiff.bash b/.github/scripts/check-diff.bash similarity index 100% rename from contrib/checkdiff.bash rename to .github/scripts/check-diff.bash diff --git a/.github/workflows/checkdiff.yml b/.github/workflows/check-diff.yml similarity index 89% rename from .github/workflows/checkdiff.yml rename to .github/workflows/check-diff.yml index 6dd92cf1a..1d1ef8740 100644 --- a/.github/workflows/checkdiff.yml +++ b/.github/workflows/check-diff.yml @@ -8,7 +8,7 @@ env: CLICOLOR_FORCE: 1 jobs: - checkdiff: + check-diff: runs-on: ubuntu-slim steps: - name: Clone repo @@ -20,7 +20,7 @@ jobs: run: | MERGE_BASE=$(gh api "/repos/{owner}/{repo}/compare/$BASE_SHA...$HEAD_SHA" --jq '.merge_base_commit.sha') git fetch origin "$MERGE_BASE" - contrib/checkdiff.bash "$MERGE_BASE" | sed -E 's/^/::warning::/' + .github/scripts/check-diff.bash "$MERGE_BASE" | sed -E 's/^/::warning::/' env: BASE_SHA: ${{ github.event.pull_request.base.sha }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} diff --git a/Makefile b/Makefile index 5e3ec98c7..6f70ab8db 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ .SUFFIXES: .SUFFIXES: .cpp .y .o -.PHONY: all clean install checkdiff develop debug profile coverage format tidy iwyu wine-shim dist +.PHONY: all clean install develop debug profile coverage format tidy iwyu wine-shim dist # User-defined variables @@ -44,9 +44,6 @@ BISON := src/bison.sh RM := rm -rf -# Used for checking pull requests -BASE_REF := origin/master - # Rules to build the RGBDS binaries all: rgbasm rgblink rgbfix rgbgfx @@ -214,10 +211,6 @@ install: all $Qinstall -m ${MANMODE} ${MANSRC}rgbds.5 ${MANSRC}rgbasm.5 ${MANSRC}rgbasm-old.5 ${MANSRC}rgblink.5 ${DESTDIR}${mandir}/man5/ $Qinstall -m ${MANMODE} ${MANSRC}rgbds.7 ${MANSRC}gbz80.7 ${DESTDIR}${mandir}/man7/ -# Target used to check for suspiciously missing changed files. -checkdiff: - $Qcontrib/checkdiff.bash `git merge-base HEAD ${BASE_REF}` - # Target used in development to prevent adding new issues to the source code. # All warnings are treated as errors to block the compilation and make the # continous integration infrastructure return failure. From 3f2e4675ec6ed5e2f46b55895f7d6a7de2b55e1c Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 10 Jul 2026 21:58:51 -0400 Subject: [PATCH 4/7] Use `#!/usr/bin/env bash`, not `#!/bin/bash` --- .github/scripts/draft-release.sh | 2 +- contrib/view_palettes.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/draft-release.sh b/.github/scripts/draft-release.sh index 97fe2a024..c55d8a71c 100755 --- a/.github/scripts/draft-release.sh +++ b/.github/scripts/draft-release.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail tag=$1 diff --git a/contrib/view_palettes.sh b/contrib/view_palettes.sh index ef57951d0..f27ebf244 100755 --- a/contrib/view_palettes.sh +++ b/contrib/view_palettes.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail if [[ $# -ne 2 ]]; then From 42f61a4655dee040ef4da6bb2ecd745456f223ae Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 10 Jul 2026 22:03:44 -0400 Subject: [PATCH 5/7] Rename `install_deps.sh` to `install-deps.sh` for consistency --- .github/scripts/{install_deps.sh => install-deps.sh} | 0 .github/workflows/coverage.yml | 2 +- .github/workflows/create-release-artifacts.yml | 6 +++--- .github/workflows/testing.yml | 12 ++++++------ Dockerfile | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) rename .github/scripts/{install_deps.sh => install-deps.sh} (100%) diff --git a/.github/scripts/install_deps.sh b/.github/scripts/install-deps.sh similarity index 100% rename from .github/scripts/install_deps.sh rename to .github/scripts/install-deps.sh diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7a525dff4..f112cf27d 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v7 - name: Install deps run: | - .github/scripts/install_deps.sh ubuntu-latest lcov + .github/scripts/install-deps.sh ubuntu-latest lcov - name: Generate coverage report run: | contrib/coverage.bash --os ubuntu-latest --jobs "$(getconf _NPROCESSORS_ONLN)" diff --git a/.github/workflows/create-release-artifacts.yml b/.github/workflows/create-release-artifacts.yml index d24027f09..ee13a0bf9 100644 --- a/.github/workflows/create-release-artifacts.yml +++ b/.github/workflows/create-release-artifacts.yml @@ -33,7 +33,7 @@ jobs: uses: actions/checkout@v7 - name: Install deps run: | - bash .github/scripts/install_deps.sh windows + bash .github/scripts/install-deps.sh windows - name: Build Windows binaries shell: cmd run: | @@ -58,7 +58,7 @@ jobs: uses: actions/checkout@v7 - name: Install deps run: | - ./.github/scripts/install_deps.sh macos lld + ./.github/scripts/install-deps.sh macos lld - name: Build binaries run: | cmake -B build -G Ninja --preset macos-static -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}" @@ -86,7 +86,7 @@ jobs: uses: actions/checkout@v7 - name: Install deps run: | - ./.github/scripts/install_deps.sh ubuntu-22.04 + ./.github/scripts/install-deps.sh ubuntu-22.04 - name: Build binaries run: | make -k -j "$(getconf _NPROCESSORS_ONLN)" WARNFLAGS="-Wall -Wextra -pedantic -static" PKG_CONFIG="pkg-config --static" Q= diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 33012cc19..523c95f56 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -52,7 +52,7 @@ jobs: uses: actions/checkout@v7 - name: Install deps run: | - .github/scripts/install_deps.sh ${{ matrix.os }} ${{ matrix.cxx }} + .github/scripts/install-deps.sh ${{ matrix.os }} ${{ matrix.cxx }} - name: Build using Make if: matrix.buildsys == 'make' run: | @@ -123,7 +123,7 @@ jobs: uses: actions/checkout@v7 - name: Install deps run: | - .github/scripts/install_deps.sh macos lld + .github/scripts/install-deps.sh macos lld - name: Cache library deps uses: actions/cache@v5 with: @@ -185,7 +185,7 @@ jobs: uses: actions/checkout@v7 - name: Install deps run: | - bash .github/scripts/install_deps.sh ${{ matrix.os }} + bash .github/scripts/install-deps.sh ${{ matrix.os }} - name: Cache library deps uses: actions/cache@v5 with: @@ -247,7 +247,7 @@ jobs: uses: actions/checkout@v7 - name: Install deps run: | - .github/scripts/install_deps.sh ubuntu mingw${{ matrix.bits }} + .github/scripts/install-deps.sh ubuntu mingw${{ matrix.bits }} - name: Cache library deps uses: actions/cache@v5 with: @@ -292,7 +292,7 @@ jobs: uses: actions/checkout@v7 - name: Install test deps run: | - .github/scripts/install_deps.sh windowsmingw + .github/scripts/install-deps.sh windowsmingw - name: Retrieve binaries uses: actions/download-artifact@v8 with: @@ -396,7 +396,7 @@ jobs: release: "14.3" usesh: true prepare: | - .github/scripts/install_deps.sh freebsd + .github/scripts/install-deps.sh freebsd run: | # Leak detection is not supported on FreeBSD, so disable it. cmake -B build --preset develop cmake --build build --verbose -- -k -j "$(getconf _NPROCESSORS_ONLN)" diff --git a/Dockerfile b/Dockerfile index bf070f58f..4c4a83dc9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN apt-get update && \ apt-get install sudo make cmake gcc build-essential -y # Install dependencies and compile RGBDS -RUN ./.github/scripts/install_deps.sh debian +RUN ./.github/scripts/install-deps.sh debian RUN make -j "$(getconf _NPROCESSORS_ONLN)" CXXFLAGS="-O3 -flto -DNDEBUG -static" PKG_CONFIG="pkg-config --static" Q= # Create the install script From 346bd4bb352c85edbca663ef79c7003cbf8cdd29 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 10 Jul 2026 22:12:26 -0400 Subject: [PATCH 6/7] Use `set -u` too --- .github/scripts/check-contrib.sh | 2 +- contrib/coverage.bash | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/check-contrib.sh b/.github/scripts/check-contrib.sh index f56a5a8a8..3cc0ef321 100755 --- a/.github/scripts/check-contrib.sh +++ b/.github/scripts/check-contrib.sh @@ -1,5 +1,5 @@ #!/usr/bin/env sh -set -e +set -eu bash --version zsh --version diff --git a/contrib/coverage.bash b/contrib/coverage.bash index fbf03fd41..b0c9ad294 100755 --- a/contrib/coverage.bash +++ b/contrib/coverage.bash @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -eu usage() { cat <<"EOF" From aff5eca0e0cba83e8b0787629783c2ca25102574 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 10 Jul 2026 22:19:11 -0400 Subject: [PATCH 7/7] Group the two dep install commands together in Dockerfile --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4c4a83dc9..fb1461ec1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,11 +5,12 @@ WORKDIR /rgbds COPY . . +# Install dependencies RUN apt-get update && \ apt-get install sudo make cmake gcc build-essential -y - -# Install dependencies and compile RGBDS RUN ./.github/scripts/install-deps.sh debian + +# Build RGBDS RUN make -j "$(getconf _NPROCESSORS_ONLN)" CXXFLAGS="-O3 -flto -DNDEBUG -static" PKG_CONFIG="pkg-config --static" Q= # Create the install script