From 6cba5518e940659c7893c38811dab7991f3f63d2 Mon Sep 17 00:00:00 2001 From: Eldred Habert Date: Sun, 28 Jun 2026 19:06:40 +0200 Subject: [PATCH] Install Pillow together with the rest of our CI deps (#1952) We shouldn't assume how the user wants to install things. In particular, `--break-system-packages` is egregious. --------- Co-authored-by: Rangi --- .github/scripts/install_deps.sh | 30 +++++++++++++++++++++--------- .github/workflows/coverage.yml | 3 --- .github/workflows/testing.yml | 15 +++------------ test/fetch-test-deps.sh | 28 ---------------------------- 4 files changed, 24 insertions(+), 52 deletions(-) diff --git a/.github/scripts/install_deps.sh b/.github/scripts/install_deps.sh index 37f4f7c2..919de1a6 100755 --- a/.github/scripts/install_deps.sh +++ b/.github/scripts/install_deps.sh @@ -2,10 +2,13 @@ # This script requires `sh` instead of `bash` because the latter is not always installed on FreeBSD. set -eu +# Python and the Pillow library are dependencies for libbet, a repo built by our external tests. +# Other dependencies are for building rgbds itself. + case $# in - 1) OS="$1"; TOOLSET= ;; - 2) OS="$1"; TOOLSET="$2";; - *) echo >&2 "Usage: $0 [toolset]" && exit 1;; + 1) OS="$1"; TOOLSET= ;; + 2) OS="$1"; TOOLSET="$2" ;; + *) echo >&2 "Usage: $0 []" && exit 1 ;; esac case "${OS%%-*}" in @@ -21,11 +24,11 @@ case "${OS%%-*}" in TOOLSET= ;; g++-10 | lcov) - pkgs="$pkgs libpng-dev pkgconf $TOOLSET" + pkgs="$pkgs libpng-dev pkgconf python3-pil $TOOLSET" TOOLSET= ;; '' | g++ | clang++) - pkgs="$pkgs libpng-dev pkgconf" + pkgs="$pkgs libpng-dev pkgconf python3-pil" TOOLSET= ;; esac @@ -34,8 +37,8 @@ case "${OS%%-*}" in sudo apt-get install -yq $pkgs ;; macos) - pkgs=bison - case $TOOLSET in + pkgs="bison make pillow" + case "$TOOLSET" in lld) pkgs="$pkgs $TOOLSET" TOOLSET= @@ -48,7 +51,7 @@ case "${OS%%-*}" in # We leave it as the default in `PATH`, to test that our Makefile works with it. # However, CMake automatically uses Homebrew's `gmake`, so our CI has synced output. # shellcheck disable=SC2086 # (This word splitting is intentional.) - brew install $pkgs make + brew install $pkgs # Export `bison` to allow using the version we install from Homebrew, # instead of the outdated one preinstalled on macOS (which doesn't even support `-Wall`...). export PATH="$(brew --prefix)/opt/bison/bin:$PATH" @@ -60,8 +63,12 @@ case "${OS%%-*}" in windows) # GitHub Actions' hosted runners ship CMake 3.x, but versions prior to 4.0.0 ignore `CPACK_PACKAGE_FILE_NAME`. choco install -y winflexbison3 cmake - # The below expects the base name, not the Windows-specific name. + # The version-printing code below will invoke `bison`, not the Windows-specific name `win_bison`. bison() { win_bison "$@"; } # An alias doesn't work, so we use a function instead. + py -3 -m pip install pillow + ;; + windowsmingw) + py -3 -m pip install pillow ;; *) echo "Cannot install deps for OS '$1'" @@ -74,6 +81,11 @@ if [ -n "$TOOLSET" ]; then exit 1 fi +# We do not build RGBDS *in* MinGW on Windows, so skip printing build tool info. +if [ "$OS" = "windowsmingw" ]; then + exit 0 +fi + # Print some system info, for easier debugging. # https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#grouping-log-lines diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 8451017b..bda28dfc 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -18,9 +18,6 @@ jobs: - name: Install deps run: | .github/scripts/install_deps.sh ubuntu-latest lcov - - name: Install test dependency dependencies - run: | - test/fetch-test-deps.sh --get-deps ubuntu - name: Generate coverage report run: | contrib/coverage.bash ubuntu-ci diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 0364eeae..c452e7c7 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -95,9 +95,6 @@ jobs: continue-on-error: true run: | test/fetch-test-deps.sh - - name: Install test dependency dependencies - run: | - test/fetch-test-deps.sh --get-deps ${{ matrix.os }} - name: Run tests using our script if: matrix.buildsys == 'make' run: | @@ -155,9 +152,6 @@ jobs: continue-on-error: true run: | test/fetch-test-deps.sh - - name: Install test dependency dependencies - run: | - test/fetch-test-deps.sh --get-deps macos - name: Run tests run: | ctest --test-dir build --schedule-random @@ -216,9 +210,6 @@ jobs: continue-on-error: true run: | test/fetch-test-deps.sh - - name: Install test dependency dependencies - run: | - test/fetch-test-deps.sh --get-deps ${{ matrix.os }} - name: Run tests using CTest run: | ctest --test-dir build --schedule-random @@ -277,6 +268,9 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v6 + - name: Install test deps + run: | + .github/scripts/install_deps.sh windowsmingw - name: Retrieve binaries uses: actions/download-artifact@v8 with: @@ -309,9 +303,6 @@ jobs: continue-on-error: true run: | test/fetch-test-deps.sh - - name: Install test dependency dependencies - run: | - test/fetch-test-deps.sh --get-deps ${{ matrix.os }} - name: Run tests run: | test/run-tests.sh --os ${{ matrix.os }} diff --git a/test/fetch-test-deps.sh b/test/fetch-test-deps.sh index e2718634..56818bab 100755 --- a/test/fetch-test-deps.sh +++ b/test/fetch-test-deps.sh @@ -10,7 +10,6 @@ Options: -h, --help show this help message --only-free download only freely licensed codebases --only-internal do not download any codebases - --get-deps install programs' own dependencies instead of themselves --get-hash print programs' commit hashes instead of downloading them --get-paths print programs' GitHub paths instead of downloading them EOF @@ -34,11 +33,6 @@ while [[ $# -gt 0 ]]; do --only-internal) external=false ;; - --get-deps) - actionname="$1" - shift - osname="$1" - ;; --get-hash|--get-paths) actionname="$1" ;; @@ -54,28 +48,6 @@ while [[ $# -gt 0 ]]; do done case "$actionname" in - --get-deps) - action() { # _ _ repo _ - # libbet depends on PIL to build - if [ "$3" = "libbet" ]; then - case "${osname%%-*}" in - ubuntu | debian) - sudo apt-get install python3-pil - ;; - macos) - python3 -m pip install --break-system-packages pillow - ;; - windows) - py -3 -m pip install pillow - ;; - *) - echo "WARNING: Cannot install Pillow for OS '$osname'" - ;; - esac - fi - } - ;; - --get-hash) action() { # _ _ repo commit printf "%s@%s-" "$3" "$4"