From 014287e745f8b5e9ad78e1e6b8394d4f94f6b157 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sun, 27 Sep 2026 19:15:56 -0700 Subject: [PATCH 1/4] CI: Tweak Build FPM step --- .github/workflows/build.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2e71a3c..a0bb0e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -220,6 +220,7 @@ jobs: FC: ${{ matrix.compiler }} FFLAGS: ${{ matrix.extra_flags }} FPM_FLAGS: --profile release --verbose + CURL_OPTIONS: --retry 10 --retry-all-errors --fail -L CHECK_ASSERT: --flag -DASSERTIONS 2>&1 | tee output ; test ${PIPESTATUS[0]} = $ERROR_STOP_CODE && grep -q "Assertion failure" output steps: @@ -235,7 +236,7 @@ jobs: if [[ ${COMPILER_VERSION} -lt 15 ]] || type -p gfortran-${COMPILER_VERSION} ; then sudo apt install -y gfortran-${COMPILER_VERSION} else - curl -L https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o install-homebrew.sh + curl $CURL_OPTIONS https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o install-homebrew.sh chmod +x install-homebrew.sh env CI=1 ./install-homebrew.sh HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew" @@ -328,10 +329,15 @@ jobs: if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }} run: | export FPM_VERSION=0.13.0 + for suff in -14 -15 -16 "" -13 -12 ; do + GFORTRAN=gfortran$suff + if type -P $GFORTRAN ; then break ; fi + done + [[ -n "$GFORTRAN" ]] mkdir -p fpm-temp/bin cd fpm-temp - curl --retry 5 -LOsS https://github.com/fortran-lang/fpm/releases/download/v$FPM_VERSION/fpm-$FPM_VERSION.F90 - gfortran-14 -o bin/fpm fpm-$FPM_VERSION.F90 + curl $CURL_OPTIONS https://github.com/fortran-lang/fpm/releases/download/v$FPM_VERSION/fpm-$FPM_VERSION.F90 -o fpm.F90 + $GFORTRAN -fopenmp -o bin/fpm fpm.F90 echo "PATH=$PWD/bin:${PATH}" >> "$GITHUB_ENV" - name: Version info From 73305b7d76ff3b2a72d457b6d3ec75bd2e2ebfac Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sun, 27 Sep 2026 19:31:40 -0700 Subject: [PATCH 2/4] CI: Install automatic retry for dependency downloads --- .github/workflows/build.yml | 41 ++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a0bb0e1..2eff335 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -227,20 +227,41 @@ jobs: - name: Checkout code uses: actions/checkout@v6 + - name: Install shell functions + run: | + mkdir -p ~/.bash_helpers + cat << 'EOF' > ~/.bash_helpers/custom_functions.sh + retry() { + local retry_cnt=0 + local retry_delay + while ! "$@" ; do + retry_cnt=$(expr $retry_cnt + 1) + if [[ $retry_cnt > 5 ]] ; then exit 1 ; fi + ( set +x ; + echo "::warning::Command failed: <$@> Pausing before retry $retry_cnt..." ); + retry_delay=$(( 5 ** retry_cnt )) + if [[ $retry_delay > 600 ]] ; then retry_delay=600 ; fi + sleep $retry_delay + done + } + EOF + # Register file in BASH_ENV so it automatically loads in all future steps + echo "BASH_ENV=~/.bash_helpers/custom_functions.sh" >> $GITHUB_ENV + - name: Install Ubuntu Native Dependencies if: ${{ contains(matrix.os, 'ubuntu') && matrix.container == '' && matrix.compiler == 'gfortran' }} run: | - sudo apt-get update + retry sudo apt-get update #sudo apt list -a 'gfortran-*' - sudo apt install -y build-essential + retry sudo apt install -y build-essential if [[ ${COMPILER_VERSION} -lt 15 ]] || type -p gfortran-${COMPILER_VERSION} ; then - sudo apt install -y gfortran-${COMPILER_VERSION} + retry sudo apt install -y gfortran-${COMPILER_VERSION} else curl $CURL_OPTIONS https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o install-homebrew.sh chmod +x install-homebrew.sh env CI=1 ./install-homebrew.sh HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew" - ${HOMEBREW_PREFIX}/bin/brew install -v gcc@${COMPILER_VERSION} binutils + retry ${HOMEBREW_PREFIX}/bin/brew install -v gcc@${COMPILER_VERSION} binutils ls -al ${HOMEBREW_PREFIX}/bin echo "PATH=${HOMEBREW_PREFIX}/bin:${PATH}" >> "$GITHUB_ENV" : Homebrew GCC@15 needs binutils 2.44+ @@ -254,8 +275,8 @@ jobs: - name: Install Ubuntu Container Dependencies if: ${{ contains(matrix.os, 'ubuntu') && matrix.container != '' && !contains(matrix.container, 'phhargrove') }} run: | - apt update - apt install -y build-essential # pkg-config make git curl + retry apt update + retry apt install -y build-essential # pkg-config make git curl # Add container lfortran to PATH: if test "$FC" = "lfortran"; then echo "/app/bin" >> "$GITHUB_PATH" @@ -280,17 +301,17 @@ jobs: - name: Install macOS Dependencies if: contains(matrix.os, 'macos') run: | - brew update + retry brew update # fpm binary distribution for macOS requires gfortran shared libraries from gcc@12 - brew install gcc@12 + retry brew install gcc@12 if [[ ${{ matrix.compiler }} == 'gfortran' && ${COMPILER_VERSION} -gt 15 ]] ; then - brew install gcc@${COMPILER_VERSION} + retry brew install gcc@${COMPILER_VERSION} fi - name: Install LLVM flang on macOS if: contains(matrix.os, 'macos') && matrix.compiler == 'flang' run: | - brew install llvm@${COMPILER_VERSION} flang + retry brew install llvm@${COMPILER_VERSION} flang # workaround issue #228: clang cannot find homebrew flang's C header for p in /opt/homebrew /usr/local $(brew --prefix) ; do find $p/Cellar/flang -name ISO_Fortran_binding.h 2>/dev/null || true ; done echo "CFLAGS=-I$(dirname $(find $(brew --prefix)/Cellar/flang -name ISO_Fortran_binding.h | head -1)) ${CFLAGS}" >> "$GITHUB_ENV" From 5cd6b334360f317116eba4f520125cadb558f0bd Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sun, 27 Sep 2026 19:38:10 -0700 Subject: [PATCH 3/4] CI: Filter harmless nuisance warnings from Homebrew --- .github/workflows/build.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2eff335..d79fc7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -221,6 +221,7 @@ jobs: FFLAGS: ${{ matrix.extra_flags }} FPM_FLAGS: --profile release --verbose CURL_OPTIONS: --retry 10 --retry-all-errors --fail -L + BREW_WARNING_FILTER: 's/^[[:punct:]]*warning[[:punct:]]*(You are using macOS)/warn: \1/i' CHECK_ASSERT: --flag -DASSERTIONS 2>&1 | tee output ; test ${PIPESTATUS[0]} = $ERROR_STOP_CODE && grep -q "Assertion failure" output steps: @@ -303,15 +304,18 @@ jobs: run: | retry brew update # fpm binary distribution for macOS requires gfortran shared libraries from gcc@12 - retry brew install gcc@12 + retry brew install gcc@12 \ + 2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0 if [[ ${{ matrix.compiler }} == 'gfortran' && ${COMPILER_VERSION} -gt 15 ]] ; then - retry brew install gcc@${COMPILER_VERSION} + retry brew install gcc@${COMPILER_VERSION} \ + 2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0 fi - name: Install LLVM flang on macOS if: contains(matrix.os, 'macos') && matrix.compiler == 'flang' run: | - retry brew install llvm@${COMPILER_VERSION} flang + retry brew install llvm@${COMPILER_VERSION} flang \ + 2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0 # workaround issue #228: clang cannot find homebrew flang's C header for p in /opt/homebrew /usr/local $(brew --prefix) ; do find $p/Cellar/flang -name ISO_Fortran_binding.h 2>/dev/null || true ; done echo "CFLAGS=-I$(dirname $(find $(brew --prefix)/Cellar/flang -name ISO_Fortran_binding.h | head -1)) ${CFLAGS}" >> "$GITHUB_ENV" From c2680f8c66f8a3b1704ae46988fe0785095c36a2 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sun, 27 Sep 2026 21:41:12 -0700 Subject: [PATCH 4/4] CI: Tweak brew tap adjustment, to ignore intermittent harmkess errors --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d79fc7b..fa77e10 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -289,7 +289,7 @@ jobs: if: ${{ contains(matrix.os, 'macos') }} run: | # silence Homebrew tap trust warnings: - (set +e ; brew untap -f aws/tap hashicorp/tap 2>&1 | perl -pe 's/#*.warning./warn: /' ; brew trust azure/bicep ) + (set +e ; brew untap -f aws/tap hashicorp/tap 2>&1 | perl -pe 's/^::*//;s/^##*//' ; brew trust azure/bicep ; echo ) # set some Homebrew knobs to accelerate installation # but only when we are not simulating the user environment brew-via-install workflow if [[ -z "${{ matrix.brew_via_install }}" ]] ; then