From f4af8185f3563619ceedf307bf9602d0e868c02f Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Fri, 9 Aug 2024 03:47:55 +0200 Subject: [PATCH] Automatically make the Homebrew Bison path available to all CI steps --- .github/scripts/install_deps.sh | 8 +++++--- .github/workflows/create-release-artifacts.yml | 1 - .github/workflows/testing.yml | 10 +--------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/scripts/install_deps.sh b/.github/scripts/install_deps.sh index 6c225be9a..6fec5ce8d 100755 --- a/.github/scripts/install_deps.sh +++ b/.github/scripts/install_deps.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -euo pipefail case "${1%-*}" in ubuntu) @@ -8,8 +8,10 @@ case "${1%-*}" in ;; macos) brew install bison libpng pkg-config md5sha1sum - # For the version check below exclusively, re-do this before building - export PATH="/opt/homebrew/opt/bison/bin:/usr/local/opt/bison/bin:$PATH" + # 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="/opt/homebrew/opt/bison/bin:$PATH" + printf 'PATH=%s\n' "$PATH" >>"$GITHUB_ENV" # Make it available to later CI steps tpp ;; *) echo "WARNING: Cannot install deps for OS '$1'" diff --git a/.github/workflows/create-release-artifacts.yml b/.github/workflows/create-release-artifacts.yml index 25cbeeb06..140273f4f 100644 --- a/.github/workflows/create-release-artifacts.yml +++ b/.github/workflows/create-release-artifacts.yml @@ -82,7 +82,6 @@ jobs: # We force linking libpng statically; the other libs are provided by macOS itself - name: Build binaries run: | - export PATH="/usr/local/opt/bison/bin:$PATH" make -kj CXXFLAGS="-O3 -flto -DNDEBUG -mmacosx-version-min=10.9" PKG_CONFIG="pkg-config --static" PNGLDLIBS="$(pkg-config --static --libs-only-L libpng | cut -c 3-)/libpng.a $(pkg-config --static --libs-only-l libpng | sed s/-lpng[0-9]*//g)" Q= strip rgb{asm,link,fix,gfx} - name: Package binaries diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d5d86042b..90352ffc3 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -22,18 +22,14 @@ jobs: shell: bash run: | ./.github/scripts/install_deps.sh ${{ matrix.os }} - # Export `bison` to allow using the version we install from Homebrew, - # instead of the outdated 2.3 one preinstalled on macOS. - name: Build & install using Make if: matrix.buildsys == 'make' run: | - export PATH="/opt/homebrew/opt/bison/bin:/usr/local/opt/bison/bin:$PATH" make develop -kj Q= CXX=${{ matrix.cxx }} sudo make install -j Q= - name: Build & install using CMake if: matrix.buildsys == 'cmake' run: | - export PATH="/opt/homebrew/opt/bison/bin:/usr/local/opt/bison/bin:$PATH" cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DSANITIZERS=ON -DMORE_WARNINGS=ON cmake --build build -j --verbose cp build/src/rgb{asm,link,fix,gfx} . @@ -84,12 +80,8 @@ jobs: shell: bash run: | ./.github/scripts/install_deps.sh macos - # 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`...). - name: Build & install run: | - export PATH="/opt/homebrew/opt/bison/bin:/usr/local/opt/bison/bin:$PATH" make -kj CXXFLAGS="-O3 -flto -DNDEBUG -mmacosx-version-min=10.9" PKG_CONFIG="pkg-config --static" PNGLDLIBS="$(pkg-config --static --libs-only-L libpng | cut -c 3-)/libpng.a $(pkg-config --static --libs-only-l libpng | sed s/-lpng[0-9]*//g)" Q= - name: Package binaries run: | @@ -238,7 +230,7 @@ jobs: - name: Install deps shell: bash run: | - ./.github/scripts/install_deps.sh ${{ matrix.os }} + ./.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