From f85b0874010fb1765a819f59edfea92fc6acfeaf Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Fri, 6 Nov 2026 10:18:18 -0800 Subject: [PATCH 1/3] CI: set macports cache key Ensure that we don't conflate compiler versions into the same cache key --- .github/workflows/build.yml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 865cc8b4..81196990 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -400,9 +400,22 @@ jobs: echo HOMEBREW_NO_INSTALL_CLEANUP=1 >> "$GITHUB_ENV" fi + - name: Set Macports configuration + if: matrix.macports + run: | + # Create a config file to inject our ports into the cache key, + # while still allowing them to be installed as a separate step + echo "cache-mix: ${{ matrix.compiler }}-${{ matrix.version }}" > .github/setup-macports.yaml + # keep the default prefix to avoid triggering a rebuild of macports + MACPORTS_PREFIX="/opt/local" + echo "MACPORTS_PREFIX=$MACPORTS_PREFIX" >> "$GITHUB_ENV" + - name: Setup Macports if: matrix.macports uses: melusina-org/setup-macports@v1 + with: + parameters: '.github/setup-macports.yaml' + cache: enable - name: Install macOS Dependencies (Homebrew) if: ${{ contains(matrix.os, 'macos') && !matrix.macports && !matrix.brew_via_install }} @@ -430,7 +443,7 @@ jobs: retry sudo port -v -b install gcc${COMPILER_VERSION} fi # Append Macports dynamic library directory - echo "DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib/libgcc/:$DYLD_FALLBACK_LIBRARY_PATH" >> "$GITHUB_ENV" + echo "DYLD_FALLBACK_LIBRARY_PATH=$MACPORTS_PREFIX/lib/libgcc/:$DYLD_FALLBACK_LIBRARY_PATH" >> "$GITHUB_ENV" - name: Install LLVM flang on macOS (Homebrew) if: ${{ contains(matrix.os, 'macos') && matrix.compiler == 'flang' && !matrix.macports && !matrix.brew_via_install }} @@ -444,12 +457,12 @@ jobs: if: ${{ matrix.compiler == 'flang' && matrix.macports }} run: | retry sudo port -v -b install flang-${COMPILER_VERSION} - sudo ln -sf /opt/local/bin/flang-mp-${COMPILER_VERSION} /opt/local/bin/flang - sudo ln -sf /opt/local/bin/flang-mp-${COMPILER_VERSION} /opt/local/bin/flang-new - sudo ln -sf /opt/local/bin/clang-mp-${COMPILER_VERSION} /opt/local/bin/clang - sudo ln -sf /opt/local/bin/clang++-mp-${COMPILER_VERSION} /opt/local/bin/clang++ + sudo ln -sf $MACPORTS_PREFIX/bin/flang-mp-${COMPILER_VERSION} $MACPORTS_PREFIX/bin/flang + sudo ln -sf $MACPORTS_PREFIX/bin/flang-mp-${COMPILER_VERSION} $MACPORTS_PREFIX/bin/flang-new + sudo ln -sf $MACPORTS_PREFIX/bin/clang-mp-${COMPILER_VERSION} $MACPORTS_PREFIX/bin/clang + sudo ln -sf $MACPORTS_PREFIX/bin/clang++-mp-${COMPILER_VERSION} $MACPORTS_PREFIX/bin/clang++ # Prepend Macports clang to PATH: - echo "PATH=/opt/local/bin:${PATH}" >> "$GITHUB_ENV" + echo "PATH=$MACPORTS_PREFIX/bin:${PATH}" >> "$GITHUB_ENV" - name: Choose FPM if: ${{ !matrix.brew_via_install }} From 1d3be95bb88ce43617b77c4e09dbeaf4fe88d831 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Fri, 6 Nov 2026 12:44:01 -0800 Subject: [PATCH 2/3] CI: Restore flang testing on MacIntel using macports --- .github/workflows/build.yml | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81196990..856d4fc6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -94,15 +94,16 @@ jobs: compiler: flang brew_via_install: 1 # No Homebrew bottle for Intel, use MacPorts instead - # Currently broken - #- os: macos-15-intel - # compiler: flang - # version: 23 - # macports: 1 - #- os: macos-26-intel - # compiler: flang - # version: 23 - # macports: 1 + # Binary ports for the current LLVM major version are frequently stale (broken) + # so use a prior release where the binary ports are stable + - os: macos-15-intel + compiler: flang + version: 22 + macports: 1 + - os: macos-26-intel + compiler: flang + version: 22 + macports: 1 - os: ubuntu-24.04 compiler: flang @@ -242,17 +243,16 @@ jobs: container: ghcr.io/lfortran/lfortran:v0.68.0 # No Homebrew bottle for Intel, use MacPorts instead - # Currently broken - #- os: macos-15-intel - # compiler: flang - # version: 23 - # macports: 1 - # network: udp - #- os: macos-26-intel - # compiler: flang - # version: 23 - # macports: 1 - # network: udp + - os: macos-15-intel + compiler: flang + version: 22 + macports: 1 + network: udp + - os: macos-26-intel + compiler: flang + version: 22 + macports: 1 + network: udp - os: macos-15 compiler: flang From fd0c455add933b4557ca2a81d543efcc7b71b55e Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Fri, 6 Nov 2026 11:58:37 -0800 Subject: [PATCH 3/3] CI: Improve robustness of Linux gfortran install via brew The -B option is not documented as allowing a space, so don't use one --- .github/workflows/build.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 856d4fc6..4238c830 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -365,6 +365,7 @@ jobs: run: | retry sudo apt update retry sudo apt install -y build-essential pkg-config make + [[ ${{ matrix.compiler }} == 'gfortran' ]] # assert no container means gfortran if [[ ${COMPILER_VERSION} -lt 15 ]] || type -p gfortran-${COMPILER_VERSION} ; then retry sudo apt install -y gfortran-${COMPILER_VERSION} g++-${COMPILER_VERSION} else @@ -379,10 +380,10 @@ jobs: : Homebrew GCC@15 needs binutils 2.44+ HOMEBREW_BINUTILS=$(ls -d ${HOMEBREW_PREFIX}/Cellar/binutils/2.*/bin ) ls -al ${HOMEBREW_BINUTILS} - echo "FFLAGS=${FFLAGS:+"$FFLAGS" }-B ${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV" - echo "CFLAGS=${CFLAGS:+"$CFLAGS" }-B ${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV" - echo "CXXFLAGS=${CXXFLAGS:+"$CXXFLAGS" }-B ${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV" - echo "LDFLAGS=${LDFLAGS:+"$LDFLAGS" }-B ${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV" + echo "FFLAGS=${FFLAGS:+"$FFLAGS" }-B${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV" + echo "CFLAGS=${CFLAGS:+"$CFLAGS" }-B${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV" + echo "CXXFLAGS=${CXXFLAGS:+"$CXXFLAGS" }-B${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV" + echo "LDFLAGS=${LDFLAGS:+"$LDFLAGS" }-B${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV" fi - name: Fix macOS Homebrew Configuration