Don't allow invalid interpolations to occur #5250
Workflow file for this run
This file contains hidden or 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: Regression testing | |
| on: | |
| - push | |
| - pull_request | |
| env: | |
| CLICOLOR_FORCE: 1 # Tells CMake to have colored output. | |
| CMAKE_COLOR_DIAGNOSTICS: ON # Tells CMake-generated build systems to have colored output. | |
| # Approximate number of CPU cores in GitHub's runners as of 2026-03-18: | |
| # https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories | |
| CMAKE_BUILD_PARALLEL_LEVEL: 4 # `cmake --build` now implies `--parallel 4`. | |
| CMAKE_INSTALL_PARALLEL_LEVEL: 4 # `cmake --install` now implies `--parallel 4`. | |
| CMAKE_CONFIG_TYPE: Debug # `cmake --build` now implies `--config Debug`. | |
| GIT_CONFIG_COUNT: 1 | |
| GIT_CONFIG_KEY_0: color.ui | |
| GIT_CONFIG_VALUE_0: always # Colorful output is helpful even though CI is not considered to be a terminal. | |
| # We instruct CMake to download and build third-party projects outside of our source tree, | |
| # otherwise they can trigger `-Werror=dev` (from the `develop` preset). | |
| DEPS_ROOT_DIR: ~/_deps # Note that this needs to be used in a position where Bash will trigger tilde expansion! | |
| jobs: | |
| unix: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-22.04, macos-14] | |
| cxx: [g++, clang++] | |
| buildsys: [make, cmake] | |
| exclude: | |
| - { os: macos-14, cxx: g++ } # Don't use `g++` on macOS; it's just an alias to `clang++`. | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Install deps | |
| shell: bash | |
| run: | | |
| ./.github/scripts/install_deps.sh ${{ matrix.os }} | |
| - name: Build & install using Make | |
| if: matrix.buildsys == 'make' | |
| run: | | |
| make develop -kj Q= CXX=${{ matrix.cxx }} | |
| sudo make install -j Q= | |
| - name: Build & install using CMake | |
| if: matrix.buildsys == 'cmake' | |
| # Since GitHub's runners are basically kitchen sinks, | |
| # the Mono framework exposes a libpng 1.4.x header, breaking everything. | |
| # Searching frameworks last makes Homebrew's libpng be discovered first, which works. | |
| # Note that since this is specific to our CI environment, the workaround is | |
| # better applied here than in our CMakeLists, where it could affect and break someone else. | |
| run: | | |
| cmake -S . -B build --preset develop -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DTESTS_OS_NAME=${{ matrix.os }} | |
| cmake --build build --verbose | |
| sudo cmake --install build --verbose | |
| - name: Package binaries | |
| run: | | |
| mkdir bins | |
| cp rgb{asm,link,fix,gfx} bins | |
| - name: Upload binaries | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: rgbds-canary-${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.buildsys }} | |
| path: bins | |
| if-no-files-found: error | |
| - name: Compute test dependency cache params | |
| id: test-deps-cache-params | |
| shell: bash | |
| run: | | |
| paths=$(test/fetch-test-deps.sh --get-paths) | |
| hash=$(test/fetch-test-deps.sh --get-hash) | |
| tee -a <<<"paths=\"${paths//,/\\n}\"" $GITHUB_OUTPUT | |
| tee -a <<<"hash=${hash%-}" $GITHUB_OUTPUT | |
| - name: Check test dependency repositories cache | |
| id: test-deps-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ fromJSON(steps.test-deps-cache-params.outputs.paths) }} | |
| key: ${{ matrix.os }}-${{ steps.test-deps-cache-params.outputs.hash }} | |
| - name: Fetch test dependency repositories | |
| if: steps.test-deps-cache.outputs.cache-hit != 'true' | |
| continue-on-error: true | |
| run: | | |
| test/fetch-test-deps.sh | |
| - name: Install test dependency dependencies | |
| shell: bash | |
| run: | | |
| test/fetch-test-deps.sh --get-deps ${{ matrix.os }} | |
| - name: Run tests using our script | |
| if: matrix.buildsys == 'make' | |
| shell: bash | |
| run: | | |
| CXX=${{ matrix.cxx }} test/run-tests.sh --os ${{ matrix.os }} | |
| - name: Run tests using CTest | |
| if: matrix.buildsys == 'cmake' | |
| run: | | |
| ctest --test-dir build --verbose | |
| macos-static: | |
| runs-on: macos-14 | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Install deps | |
| shell: bash | |
| run: | | |
| ./.github/scripts/install_deps.sh macos | |
| - name: Build libpng | |
| run: | | |
| ./.github/scripts/build_libpng.sh | |
| - name: Build & install | |
| run: | | |
| make -kj CXXFLAGS="-O3 -flto -DNDEBUG -mmacosx-version-min=10.9 -arch x86_64 -arch arm64" PNGCFLAGS="-I libpng-staging/include" PNGLDLIBS="libpng-staging/lib/libpng.a -lz" Q= | |
| - name: Package binaries | |
| run: | | |
| mkdir bins | |
| cp rgb{asm,link,fix,gfx} bins | |
| - name: Upload binaries | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: rgbds-canary-macos-static | |
| path: bins | |
| if-no-files-found: error | |
| - name: Compute test dependency cache params | |
| id: test-deps-cache-params | |
| shell: bash | |
| run: | | |
| paths=$(test/fetch-test-deps.sh --get-paths) | |
| hash=$(test/fetch-test-deps.sh --get-hash) | |
| tee -a <<<"paths=\"${paths//,/\\n}\"" $GITHUB_OUTPUT | |
| tee -a <<<"hash=${hash%-}" $GITHUB_OUTPUT | |
| - name: Check test dependency repositories cache | |
| id: test-deps-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ fromJSON(steps.test-deps-cache-params.outputs.paths) }} | |
| key: macos-14-${{ steps.test-deps-cache-params.outputs.hash }} | |
| - name: Fetch test dependency repositories | |
| if: steps.test-deps-cache.outputs.cache-hit != 'true' | |
| continue-on-error: true | |
| run: | | |
| test/fetch-test-deps.sh | |
| - name: Install test dependency dependencies | |
| shell: bash | |
| run: | | |
| test/fetch-test-deps.sh --get-deps macos | |
| - name: Run tests | |
| shell: bash | |
| run: | | |
| test/run-tests.sh --os macos | |
| windows: | |
| strategy: | |
| matrix: | |
| bits: [32, 64] | |
| os: [windows-2022, windows-2025] | |
| include: | |
| - bits: 32 | |
| arch: x86 | |
| - bits: 64 | |
| arch: x86_x64 | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Install deps | |
| run: | | |
| bash .github/scripts/install_deps.sh ${{ matrix.os }} | |
| - name: Cache library deps | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.DEPS_ROOT_DIR }}/*-tmp/ | |
| key: dep-srcs-${{ hashFiles('cmake/deps.cmake') }} | |
| enableCrossOsArchive: true # Currently only used on Windows, but the contents are OS-agnostic. | |
| - name: Build Windows binaries | |
| shell: bash | |
| run: | # ASan seems to be broken on Windows, so we disable it. | |
| cmake -S . -B build --preset develop-msvc${{ matrix.bits }} -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}" -DSANITIZERS=OFF | |
| cmake --build build | |
| - name: Package binaries | |
| shell: bash | |
| run: | | |
| cmake --install build --config Debug --prefix install_dir --verbose | |
| mkdir bins | |
| cp -v install_dir/bin/{rgb*.exe,*.dll} bins | |
| - name: Upload Windows binaries | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: rgbds-canary-w${{ matrix.bits }}-${{ matrix.os }} | |
| path: bins | |
| if-no-files-found: error | |
| - name: Compute test dependency cache params | |
| id: test-deps-cache-params | |
| shell: bash | |
| run: | | |
| paths=$(test/fetch-test-deps.sh --get-paths) | |
| hash=$(test/fetch-test-deps.sh --get-hash) | |
| tee -a <<<"paths=\"${paths//,/\\n}\"" $GITHUB_OUTPUT | |
| tee -a <<<"hash=${hash%-}" $GITHUB_OUTPUT | |
| - name: Check test dependency repositories cache | |
| id: test-deps-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ fromJSON(steps.test-deps-cache-params.outputs.paths) }} | |
| key: ${{ matrix.os }}-${{ matrix.bits }}-${{ steps.test-deps-cache-params.outputs.hash }} | |
| - name: Fetch test dependency repositories | |
| if: steps.test-deps-cache.outputs.cache-hit != 'true' | |
| shell: bash | |
| continue-on-error: true | |
| run: | | |
| test/fetch-test-deps.sh | |
| - name: Install test dependency dependencies | |
| shell: bash | |
| run: | | |
| test/fetch-test-deps.sh --get-deps ${{ matrix.os }} | |
| - name: Run tests | |
| shell: bash | |
| run: | | |
| cp bins/* . | |
| cp bins/*.dll test/gfx | |
| test/run-tests.sh --os ${{ matrix.os }} | |
| windows-mingw-build: | |
| strategy: | |
| matrix: | |
| bits: [32, 64] | |
| include: | |
| - bits: 32 | |
| arch: i686 | |
| triplet: i686-w64-mingw32 | |
| - bits: 64 | |
| arch: x86-64 | |
| triplet: x86_64-w64-mingw32 | |
| fail-fast: false | |
| runs-on: ubuntu-22.04 | |
| env: | |
| DIST_DIR: win${{ matrix.bits }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Install deps | |
| shell: bash | |
| run: | | |
| ./.github/scripts/install_deps.sh ubuntu | |
| - name: Install MinGW | |
| run: | # dpkg-dev is apparently required for pkg-config for cross-building | |
| sudo apt-get install g++-mingw-w64-${{ matrix.arch }}-win32 mingw-w64-tools libz-mingw-w64-dev dpkg-dev | |
| - name: Install libpng dev headers for MinGW | |
| run: | | |
| ./.github/scripts/mingw-w64-libpng-dev.sh ${{ matrix.triplet }} | |
| - name: Cross-build Windows binaries | |
| run: | | |
| make mingw${{ matrix.bits }} -kj Q= | |
| - name: Package binaries | |
| run: | # DLL dependencies can be figured out using e.g. Dependency Walker or objdump -p | |
| mkdir bins | |
| mv -v rgb{asm,link,fix,gfx}.exe bins/ | |
| cp -v /usr/${{ matrix.triplet }}/lib/zlib1.dll bins | |
| cp -v /usr/${{ matrix.triplet }}/bin/libpng16-16.dll bins | |
| cp -v /usr/lib/gcc/${{ matrix.triplet }}/10-win32/lib{ssp-0,stdc++-6}.dll bins | |
| [ "${{ matrix.bits }}" -ne 32 ] || cp -v /usr/lib/gcc/${{ matrix.triplet }}/10-win32/libgcc_s_dw2-1.dll bins | |
| - name: Upload Windows binaries | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: rgbds-canary-mingw-win${{ matrix.bits }} | |
| path: bins | |
| if-no-files-found: error | |
| - name: Upload Windows test binaries | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: testing-programs-mingw-win${{ matrix.bits }} | |
| path: | | |
| test/gfx/randtilegen.exe | |
| test/gfx/rgbgfx_test.exe | |
| if-no-files-found: error | |
| windows-mingw-testing: | |
| needs: windows-mingw-build | |
| strategy: | |
| matrix: | |
| os: [windows-2022, windows-2025] | |
| bits: [32, 64] | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Retrieve binaries | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: rgbds-canary-mingw-win${{ matrix.bits }} | |
| path: bins | |
| - name: Retrieve test binaries | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: testing-programs-mingw-win${{ matrix.bits }} | |
| path: test/gfx | |
| - name: Extract binaries | |
| shell: bash | |
| run: | | |
| cp bins/* . | |
| cp bins/*.dll test/gfx | |
| - name: Compute test dependency cache params | |
| id: test-deps-cache-params | |
| shell: bash | |
| run: | | |
| paths=$(test/fetch-test-deps.sh --get-paths) | |
| hash=$(test/fetch-test-deps.sh --get-hash) | |
| tee -a <<<"paths=\"${paths//,/\\n}\"" $GITHUB_OUTPUT | |
| tee -a <<<"hash=${hash%-}" $GITHUB_OUTPUT | |
| - name: Check test dependency repositories cache | |
| id: test-deps-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ fromJSON(steps.test-deps-cache-params.outputs.paths) }} | |
| key: mingw-${{ matrix.bits }}-${{ steps.test-deps-cache-params.outputs.hash }} | |
| - name: Fetch test dependency repositories | |
| if: steps.test-deps-cache.outputs.cache-hit != 'true' | |
| shell: bash | |
| continue-on-error: true | |
| run: | | |
| test/fetch-test-deps.sh | |
| - name: Install test dependency dependencies | |
| shell: bash | |
| run: | | |
| test/fetch-test-deps.sh --get-deps ${{ matrix.os }} | |
| - name: Run tests | |
| shell: bash | |
| run: | | |
| test/run-tests.sh --os ${{ matrix.os }} | |
| cygwin: | |
| strategy: | |
| matrix: | |
| bits: [32, 64] | |
| include: | |
| - bits: 32 | |
| arch: x86 | |
| - bits: 64 | |
| arch: x86_64 | |
| fail-fast: false | |
| runs-on: windows-2022 | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup Cygwin | |
| uses: cygwin/cygwin-install-action@v6 | |
| with: | |
| platform: ${{ matrix.arch }} | |
| packages: >- | |
| bison | |
| gcc-g++ | |
| git | |
| libpng-devel | |
| make | |
| pkg-config | |
| - name: Build & install using Make | |
| shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -o igncr '{0}' | |
| run: | # Cygwin does not support `make develop` sanitizers ASan or UBSan | |
| make -kj Q= | |
| make install -j Q= | |
| - name: Run tests | |
| shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -o igncr '{0}' | |
| run: | | |
| test/run-tests.sh --only-internal | |
| freebsd: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Build & test using CMake on FreeBSD | |
| uses: vmactions/freebsd-vm@v1 | |
| with: | |
| envs: CLICOLOR_FORCE CMAKE_COLOR_DIAGNOSTICS CMAKE_BUILD_PARALLEL_LEVEL CMAKE_INSTALL_PARALLEL_LEVEL | |
| release: "14.3" | |
| usesh: true | |
| prepare: | | |
| .github/scripts/install_deps.sh freebsd | |
| run: | # Leak detection is not supported on FreeBSD, so disable it. | |
| cmake -S . -B build --preset develop -DTESTS_RUN_EXTERNAL=OFF -DTESTS_OS_NAME=freebsd | |
| cmake --build build --verbose | |
| cmake --install build --verbose | |
| ASAN_OPTIONS=detect_leaks=0 ctest --test-dir build --verbose |