Skip to content

[NO REVIEW]: CI: Add GFortran 15 testing on macOS #68

[NO REVIEW]: CI: Add GFortran 15 testing on macOS

[NO REVIEW]: CI: Add GFortran 15 testing on macOS #68

Workflow file for this run

name: Build
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.compiler }}-${{ matrix.version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14, macos-15, ubuntu-24.04]
compiler: [ gfortran ]
version: [ 12, 13, 14, 15 ]
extra_flags: [ -g ]
exclude:
- os: ubuntu-24.04
version: 15 # no package available (yet?)
include:
- os: ubuntu-22.04
compiler: gfortran
version: 12 # no package available for gfortran 13+
# --- LLVM flang coverage ---
- os: macos-13
compiler: flang
version: 20
- os: macos-14
compiler: flang
version: 20
- os: macos-15
compiler: flang
version: 20
# https://hub.docker.com/r/snowstep/llvm/tags
- os: ubuntu-24.04
compiler: flang
version: latest
container: snowstep/llvm:noble
- os: ubuntu-22.04
compiler: flang
version: latest
container: snowstep/llvm:jammy
# https://hub.docker.com/r/phhargrove/llvm-flang/tags
- os: ubuntu-24.04
compiler: flang
version: 20
container: phhargrove/llvm-flang:20.1.0-1
- os: ubuntu-24.04
compiler: flang
version: 19
extra_flags: -g -mmlir -allow-assumed-rank
container: phhargrove/llvm-flang:19.1.1-1
# - os: ubuntu-24.04
# compiler: flang
# version: new
# container: gmao/llvm-flang:latest
# --- Intel coverage ---
- os: ubuntu-24.04
compiler: ifx
version: 2025.1.0
error_stop_code: 128
container: intel/fortran-essentials:2025.1.0-0-devel-ubuntu24.04
#container: intel/oneapi-hpckit:2025.1.0-0-devel-ubuntu24.04
- os: ubuntu-22.04
compiler: ifx
version: 2025.0.0
error_stop_code: 128
container: intel/fortran-essentials:2025.0.0-0-devel-ubuntu22.04
# --- LFortran coverage ---
# https://hub.docker.com/r/phhargrove/lfortran/tags
- os: ubuntu-24.04
compiler: lfortran
version: 0.54.0
container: phhargrove/lfortran:0.54.0-1
# https://github.com/lfortran/lfortran/pkgs/container/lfortran
- os: ubuntu-22.04
compiler: lfortran
version: latest
container: ghcr.io/lfortran/lfortran:latest
container:
image: ${{ matrix.container }}
env:
COMPILER_VERSION: ${{ matrix.version }}
FC: ${{ matrix.compiler }}
FFLAGS: ${{ matrix.extra_flags }}
FPM_FLAGS: --profile release --verbose
CHECK_ASSERT: --flag -DASSERTIONS 2>&1 | tee output ; test ${PIPESTATUS[0]} = $ERROR_STOP_CODE && grep -q "Assertion failure" output
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Ubuntu Native Dependencies
if: ${{ contains(matrix.os, 'ubuntu') && matrix.container == '' && matrix.compiler == 'gfortran' }}
run: |
set -x
sudo apt update
# sudo apt list -a 'gfortran-*'
sudo apt install -y build-essential gfortran-${COMPILER_VERSION}
- name: Install Ubuntu Container Dependencies
if: ${{ contains(matrix.os, 'ubuntu') && matrix.container != '' && !contains(matrix.container, 'phhargrove') }}
run: |
set -x
apt update
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" ; \
ls -alh /app/bin ; \
ls -alh /app/share/lfortran/lib/ ; \
fi
- name: Install macOS Dependencies
if: contains(matrix.os, 'macos') && matrix.compiler == 'flang'
run: |
set -x
brew update
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"
# Prepend homebrew clang to PATH:
echo "PATH=$(brew --prefix)/opt/llvm/bin:${PATH}" >> "$GITHUB_ENV"
- name: Setup Compilers
run: |
set -x
if test "$FC" = "flang" ; then \
echo "FPM_FC=flang-new" >> "$GITHUB_ENV" ; \
elif test "$FC" = "ifx" ; then \
echo "FPM_FC=ifx" >> "$GITHUB_ENV" ; \
elif test "$FC" = "lfortran" ; then \
echo "FPM_FC=lfortran" >> "$GITHUB_ENV" ; \
echo "FFLAGS=--cpp $FFLAGS" >> "$GITHUB_ENV" ; \
else \
echo "FPM_FC=gfortran-${COMPILER_VERSION}" >> "$GITHUB_ENV" ; \
echo "FFLAGS=-ffree-line-length-0 $FFLAGS" >> "$GITHUB_ENV" ; \
fi
if test -n "${{ matrix.error_stop_code }}" ; then \
echo "ERROR_STOP_CODE=${{ matrix.error_stop_code }}" >> "$GITHUB_ENV" ; \
else \
echo "ERROR_STOP_CODE=1" >> "$GITHUB_ENV" ; \
fi
- name: Setup FPM
uses: fortran-lang/setup-fpm@main
if: ${{ !contains(matrix.os, 'macos') || matrix.os == 'macos-13' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fpm-version: latest
- name: Build FPM
# no macos-arm64 fpm distro, build from source
if: ${{ contains(matrix.os, 'macos') && matrix.os != 'macos-13' }}
run: |
set -x
curl --retry 5 -LOsS https://github.com/fortran-lang/fpm/releases/download/v0.11.0/fpm-0.11.0.F90
mkdir fpm-temp
gfortran-14 -o fpm-temp/fpm fpm-0.11.0.F90
echo "PATH=`pwd`/fpm-temp:${PATH}" >> "$GITHUB_ENV"
- name: Version info
run: |
echo == TOOL VERSIONS ==
echo PATH="$PATH"
set -x
uname -a
if test -r /etc/os-release ; then cat /etc/os-release ; fi
${FPM_FC} --version
fpm --version
- name: Build and Test (Assertions OFF)
run: |
set -x
fpm test ${FPM_FLAGS} --flag "$FFLAGS"
fpm run --example false-assertion ${FPM_FLAGS} --flag "$FFLAGS"
fpm run --example simple-assertions ${FPM_FLAGS} --flag "$FFLAGS"
fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS"
- name: Build and Test (Assertions ON)
run: |
set -x
fpm test ${FPM_FLAGS} --flag "$FFLAGS" --flag -DASSERTIONS
( set +e ; eval fpm run --example false-assertion ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
( set +e ; eval fpm run --example simple-assertions ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
( set +e ; eval fpm run --example invoke-via-macro ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
- name: Test Assertions w/ Parallel Callbacks
if: ${{ matrix.compiler != 'lfortran' || matrix.version == 'latest' }} # issue #68
env:
FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -DASSERT_MULTI_IMAGE --flag -DASSERT_PARALLEL_CALLBACKS
run: |
set -x
fpm run --example false-assertion ${FPM_FLAGS} --flag "$FFLAGS"
fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS"
( set +e ; eval fpm run --example false-assertion ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
( set +e ; eval fpm run --example invoke-via-macro ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )