Merge pull request #160 from rouson/fix-intentional-failure-output #200
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: [push, pull_request] | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build: | |
| name: ${{ matrix.compiler }}-${{ matrix.version }} (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ macos-14, macos-15, macos-15-intel, macos-26, ubuntu-24.04 ] | |
| compiler: [ gfortran ] | |
| version: [ 13, 14, 15 ] | |
| extra_flags: [ -g -O3 ] | |
| include: | |
| # --- LLVM flang coverage --- | |
| - os: macos-14 | |
| compiler: flang | |
| version: 21 | |
| - os: macos-15 | |
| compiler: flang | |
| version: 21 | |
| - os: macos-15-intel | |
| compiler: flang | |
| version: 21 | |
| - os: macos-26 | |
| compiler: flang | |
| version: 21 | |
| # 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: 21 | |
| container: phhargrove/llvm-flang:21.1.0-latest | |
| - os: ubuntu-24.04 | |
| compiler: flang | |
| version: 20 | |
| container: phhargrove/llvm-flang:20.1.0-latest | |
| - os: ubuntu-24.04 | |
| compiler: flang | |
| version: 19 | |
| extra_flags: -g -mmlir -allow-assumed-rank -O3 | |
| container: phhargrove/llvm-flang:19.1.1-latest | |
| # --- Intel coverage --- | |
| # https://hub.docker.com/r/intel/fortran-essentials/tags | |
| - os: ubuntu-24.04 | |
| compiler: ifx | |
| version: 2025.2.0 | |
| error_stop_code: 128 | |
| container: intel/fortran-essentials:2025.2.0-0-devel-ubuntu24.04 | |
| - os: ubuntu-24.04 | |
| compiler: ifx | |
| version: 2025.2.2 | |
| error_stop_code: 128 | |
| container: intel/fortran-essentials:2025.2.2-0-devel-ubuntu24.04 | |
| - os: ubuntu-24.04 | |
| compiler: ifx | |
| version: latest | |
| error_stop_code: 128 | |
| container: intel/fortran-essentials:latest | |
| # --- 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 | |
| container: | |
| image: ${{ matrix.container }} | |
| env: | |
| COMPILER_VERSION: ${{ matrix.version }} | |
| FC: ${{ matrix.compiler }} | |
| FFLAGS: ${{ matrix.extra_flags }} | |
| FPM_FLAGS: --profile release --verbose | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Dependencies Ubuntu | |
| if: ${{ contains(matrix.os, 'ubuntu') && matrix.compiler == 'gfortran' && matrix.version == '15' }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt list -a 'gfortran-*' | |
| sudo apt install -y build-essential | |
| if [[ ${COMPILER_VERSION} < 15 ]] ; then \ | |
| sudo apt install -y gfortran-${COMPILER_VERSION} ; \ | |
| else \ | |
| curl -L 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 ; \ | |
| ls -al ${HOMEBREW_PREFIX}/bin ; \ | |
| echo "PATH=${HOMEBREW_PREFIX}/bin:${PATH}" >> "$GITHUB_ENV" ; \ | |
| : Homebrew GCC@15 needs binutils 2.44+ ; \ | |
| HOMEBREW_BINUTILS=$(ls -d ${HOMEBREW_PREFIX}/Cellar/binutils/2.*/bin ) ; \ | |
| ls -al ${HOMEBREW_BINUTILS} ; \ | |
| echo "FFLAGS=$FFLAGS -B ${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV" ; \ | |
| echo "CFLAGS=$CFLAGS -B ${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV" ; \ | |
| echo "CXXFLAGS=$CXXFLAGS -B ${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV" ; \ | |
| fi | |
| - 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 | |
| - name: Install macOS Dependencies | |
| if: contains(matrix.os, 'macos') | |
| run: | | |
| set -x | |
| brew update | |
| # fpm binary distribution for macOS requires gfortran shared libraries from gcc@12 | |
| brew install gcc@12 | |
| - name: Install LLVM flang on macOS | |
| if: contains(matrix.os, 'macos') && matrix.compiler == 'flang' | |
| run: | | |
| set -x | |
| 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" ; \ | |
| echo "FFLAGS=-coarray -fpp -g -traceback $FFLAGS" >> "$GITHUB_ENV" ; \ | |
| echo "FOR_COARRAY_NUM_IMAGES=4" >> "$GITHUB_ENV" ; \ | |
| : echo "FOR_COARRAY_DEBUG_STARTUP=1" >> "$GITHUB_ENV" ; \ | |
| : echo "FOR_COARRAY_MPI_VERBOSE=1" >> "$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 [[ "${{ matrix.container }}" =~ "snowstep/llvm" ]] ; then \ | |
| echo "LD_LIBRARY_PATH=/usr/lib/llvm-22/lib:$LD_LIBRARY_PATH" >> "$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 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| fpm-version: latest | |
| - name: Build FPM | |
| if: false | |
| run: | | |
| set -x | |
| export FPM_VERSION=0.12.0 | |
| curl --retry 5 -LOsS https://github.com/fortran-lang/fpm/releases/download/v$FPM_VERSION/fpm-$FPM_VERSION.F90 | |
| mkdir fpm-temp | |
| gfortran-14 -o fpm-temp/fpm fpm-$FPM_VERSION.F90 | |
| echo "PATH=`pwd`/fpm-temp:${PATH}" >> "$GITHUB_ENV" | |
| - name: Version info | |
| run: | | |
| echo == TOOL VERSIONS == | |
| echo Platform version info: | |
| uname -a | |
| if test -r /etc/os-release ; then grep -e NAME -e VERSION /etc/os-release ; fi | |
| if test -x /usr/bin/sw_vers ; then /usr/bin/sw_vers ; fi | |
| echo | |
| echo PATH="$PATH" | |
| for tool in ${FPM_FC} fpm ; do | |
| ( echo ; set -x ; w=$(which $tool) ; ls -al $w ; ls -alhL $w ; $tool --version ) | |
| done | |
| - name: Build and Test (Assertions OFF) | |
| run: | | |
| set -x | |
| fpm test ${FPM_FLAGS} --flag "$FFLAGS" | |
| - name: Build and Test (Assertions ON) | |
| env: | |
| FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -DASSERTIONS | |
| run: | | |
| set -x | |
| fpm test ${FPM_FLAGS} --flag "$FFLAGS" | |
| - name: Test w/ Parallel Callbacks | |
| env: | |
| FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -DJULIENNE_PARALLEL_CALLBACKS --flag -DTEST_PARALLEL_CALLBACKS | |
| run: | | |
| set -x | |
| fpm test ${FPM_FLAGS} --flag "$FFLAGS" | |