Skip to content

Commit

Permalink
Automatically make the Homebrew Bison path available to all CI steps
Browse files Browse the repository at this point in the history
  • Loading branch information
ISSOtm committed Aug 9, 2024
1 parent a9140e6 commit f4af818
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
8 changes: 5 additions & 3 deletions .github/scripts/install_deps.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -euo pipefail

case "${1%-*}" in
ubuntu)
Expand All @@ -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'"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/create-release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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} .
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f4af818

Please sign in to comment.