Skip to content

Commit a5ad63e

Browse files
authored
Merge pull request #67 from bonachea/ci-2026-09
[NO REVIEW]: CI Updates
2 parents 4bae3f0 + fd78608 commit a5ad63e

1 file changed

Lines changed: 51 additions & 14 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ jobs:
4141
exclude:
4242
- compiler: gfortran # gfortran disabled for now
4343

44+
# Homebrew removed Intel bottles for gcc@16
45+
- os: macos-15-intel
46+
version: 16
47+
- os: macos-26-intel
48+
version: 16
49+
4450
include:
4551

4652
# --- LLVM flang coverage ---
@@ -163,25 +169,48 @@ jobs:
163169
FC: ${{ matrix.compiler }}
164170
FFLAGS: ${{ matrix.extra_flags }}
165171
FPM_FLAGS: --profile release --verbose
172+
CURL_OPTIONS: --retry 10 --retry-all-errors --fail -L
173+
BREW_WARNING_FILTER: 's/^[[:punct:]]*warning[[:punct:]]*(You are using macOS)/warn: \1/i'
166174

167175
steps:
168176
- name: Checkout code
169177
uses: actions/checkout@v5
170178

179+
- name: Install shell functions
180+
run: |
181+
mkdir -p ~/.bash_helpers
182+
cat << 'EOF' > ~/.bash_helpers/custom_functions.sh
183+
retry() {
184+
local retry_cnt=0
185+
local retry_delay
186+
while ! "$@" ; do
187+
retry_cnt=$(expr $retry_cnt + 1)
188+
if [[ $retry_cnt > 5 ]] ; then exit 1 ; fi
189+
( set +x ;
190+
echo "::warning::Command failed: <$@> Pausing before retry $retry_cnt..." );
191+
retry_delay=$(( 5 ** retry_cnt ))
192+
if [[ $retry_delay > 600 ]] ; then retry_delay=600 ; fi
193+
sleep $retry_delay
194+
done
195+
}
196+
EOF
197+
# Register file in BASH_ENV so it automatically loads in all future steps
198+
echo "BASH_ENV=~/.bash_helpers/custom_functions.sh" >> $GITHUB_ENV
199+
171200
- name: Install Ubuntu Native Dependencies
172201
if: ${{ contains(matrix.os, 'ubuntu') && matrix.container == '' && matrix.compiler == 'gfortran' }}
173202
run: |
174-
sudo apt-get update
203+
retry sudo apt-get update
175204
#sudo apt list -a 'gfortran-*'
176-
sudo apt install -y build-essential
205+
retry sudo apt install -y build-essential
177206
if [[ ${COMPILER_VERSION} -lt 15 ]] ; then
178-
sudo apt install -y gfortran-${COMPILER_VERSION}
207+
retry sudo apt install -y gfortran-${COMPILER_VERSION}
179208
else
180-
curl -L https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o install-homebrew.sh
209+
curl $CURL_OPTIONS https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o install-homebrew.sh
181210
chmod +x install-homebrew.sh
182211
env CI=1 ./install-homebrew.sh
183212
HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
184-
${HOMEBREW_PREFIX}/bin/brew install -v gcc@${COMPILER_VERSION} binutils
213+
retry ${HOMEBREW_PREFIX}/bin/brew install -v gcc@${COMPILER_VERSION} binutils
185214
ls -al ${HOMEBREW_PREFIX}/bin
186215
echo "PATH=${HOMEBREW_PREFIX}/bin:${PATH}" >> "$GITHUB_ENV"
187216
: Homebrew GCC@15 needs binutils 2.44+
@@ -195,8 +224,8 @@ jobs:
195224
- name: Install Ubuntu Container Dependencies
196225
if: ${{ contains(matrix.os, 'ubuntu') && matrix.container != '' && !contains(matrix.container, 'phhargrove') }}
197226
run: |
198-
apt update
199-
apt install -y build-essential pkg-config make git curl
227+
retry apt update
228+
retry apt install -y build-essential pkg-config make git curl
200229
# Add container lfortran to PATH:
201230
if test "$FC" = "lfortran"; then
202231
echo "/app/bin" >> "$GITHUB_PATH"
@@ -208,7 +237,7 @@ jobs:
208237
if: ${{ contains(matrix.os, 'macos') }}
209238
run: |
210239
# silence Homebrew tap trust warnings:
211-
(set +e ; brew untap -f aws/tap hashicorp/tap 2>&1 | perl -pe 's/#*.warning./warn: /' ; brew trust azure/bicep )
240+
(set +e ; brew untap -f aws/tap hashicorp/tap 2>&1 | perl -pe 's/^::*//;s/^##*//' ; brew trust azure/bicep ; echo )
212241
# set some Homebrew knobs to accelerate installation
213242
# but only when we are not simulating the user environment brew-via-install workflow
214243
if [[ -z "${{ matrix.brew_via_install }}" ]] ; then
@@ -221,17 +250,20 @@ jobs:
221250
- name: Install macOS Dependencies
222251
if: contains(matrix.os, 'macos')
223252
run: |
224-
brew update
253+
retry brew update
225254
# fpm binary distribution for macOS requires gfortran shared libraries from gcc@12
226-
brew install gcc@12
255+
retry brew install gcc@12 \
256+
2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0
227257
if [[ ${{ matrix.compiler }} == 'gfortran' && ${COMPILER_VERSION} -gt 15 ]] ; then
228-
brew install gcc@${COMPILER_VERSION}
258+
retry brew install gcc@${COMPILER_VERSION} \
259+
2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0
229260
fi
230261
231262
- name: Install LLVM flang on macOS
232263
if: contains(matrix.os, 'macos') && matrix.compiler == 'flang'
233264
run: |
234-
brew install llvm@${COMPILER_VERSION} flang
265+
retry brew install llvm@${COMPILER_VERSION} flang \
266+
2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0
235267
# workaround issue #228: clang cannot find homebrew flang's C header
236268
for p in /opt/homebrew /usr/local $(brew --prefix) ; do find $p/Cellar/flang -name ISO_Fortran_binding.h 2>/dev/null || true ; done
237269
echo "CFLAGS=-I$(dirname $(find $(brew --prefix)/Cellar/flang -name ISO_Fortran_binding.h | head -1)) ${CFLAGS}" >> "$GITHUB_ENV"
@@ -276,10 +308,15 @@ jobs:
276308
if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }}
277309
run: |
278310
export FPM_VERSION=0.13.0
311+
for suff in -14 -15 -16 "" -13 -12 ; do
312+
GFORTRAN=gfortran$suff
313+
if type -P $GFORTRAN ; then break ; fi
314+
done
315+
[[ -n "$GFORTRAN" ]]
279316
mkdir -p fpm-temp/bin
280317
cd fpm-temp
281-
curl --retry 5 -LOsS https://github.com/fortran-lang/fpm/releases/download/v$FPM_VERSION/fpm-$FPM_VERSION.F90
282-
gfortran-14 -o bin/fpm fpm-$FPM_VERSION.F90
318+
curl $CURL_OPTIONS https://github.com/fortran-lang/fpm/releases/download/v$FPM_VERSION/fpm-$FPM_VERSION.F90 -o fpm.F90
319+
$GFORTRAN -fopenmp -o bin/fpm fpm.F90
283320
echo "PATH=$PWD/bin:${PATH}" >> "$GITHUB_ENV"
284321
285322
- name: Version info

0 commit comments

Comments
 (0)