diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml deleted file mode 100644 index 61d8913..0000000 --- a/.github/workflows/CI.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: CI - -on: [push, pull_request] - - -jobs: - Build: - runs-on: [ubuntu-22.04] - - env: - FC: gfortran - GCC_V: 12 - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - uses: fortran-lang/setup-fpm@main - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Install Dependencies Ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - sudo apt-get update - sudo apt install -y gfortran-${GCC_V} build-essential - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \ - --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \ - --slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V} - - - name: Build and Test - run: | - fpm test --profile release --flag -ffree-line-length-0 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0786b00 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,111 @@ +name: Build + +on: [push, pull_request] + + +jobs: + build: + name: ${{ matrix.compiler }}-${{ matrix.version }} (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-13, macos-14, ubuntu-22.04, ubuntu-24.04] + compiler: [ gfortran ] + version: [ 12, 13, 14 ] + extra_flags: [ -ffree-line-length-0 ] + include: + # https://hub.docker.com/r/phhargrove/llvm-flang/tags + - os: ubuntu-24.04 + compiler: flang + version: 20 + extra_flags: -g + 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 +# extra_flags: -g + + exclude: + - os: ubuntu-22.04 + version: 13 # no package available + - os: ubuntu-22.04 + version: 14 # no package available + + container: + image: ${{ matrix.container }} + + env: + GCC_VERSION: ${{ matrix.version }} + FC: ${{ matrix.compiler }} + 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' && 0 }} + run: | + sudo apt-get update + sudo apt list -a 'gfortran-*' + sudo apt install -y gfortran-${GCC_VERSION} build-essential + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \ + --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_VERSION} + + - name: Setup Compilers + run: | + set -x + if test "$FC" = "flang" ; then \ + echo "FPM_FC=flang-new" >> "$GITHUB_ENV" ; \ + else \ + echo "FPM_FC=gfortran-${GCC_VERSION}" >> "$GITHUB_ENV" ; \ + fi + + - name: Setup FPM + uses: fortran-lang/setup-fpm@main + if: ${{ matrix.os != 'macos-14' }} + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Build FPM + if: ${{ matrix.os == 'macos-14' }} # no arm64 fpm distro, build from source + 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: | + set -x + echo == TOOL VERSIONS == + 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 "${{ matrix.EXTRA_FLAGS }}" + fpm run --example false-assertion ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" + fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" + + - name: Build and Test (Assertions ON) + env: + FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -DASSERTIONS + run: | + set -x + fpm test ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" + ( set +e ; fpm run --example false-assertion ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" ; test $? = 1 ) + ( set +e ; fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" ; test $? = 1 ) + + diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 1806a06..e586409 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -4,7 +4,8 @@ on: [push, pull_request] jobs: - Build: + build: + name: Build and Deploy Documentation runs-on: ubuntu-22.04 env: diff --git a/test/run-false-assertion.sh b/test/run-false-assertion.sh index cd2f664..fa6b98b 100755 --- a/test/run-false-assertion.sh +++ b/test/run-false-assertion.sh @@ -1,3 +1,3 @@ #!/bin/bash output=$(fpm run --example false-assertion --compiler flang-new --flag '-mmlir -allow-assumed-rank -O3 -DASSERTIONS' > /dev/null 2>&1) -echo $? +echo $? > build/exit_status diff --git a/test/test-assert-subroutine-error-termination.F90 b/test/test-assert-subroutine-error-termination.F90 index 5174df7..c84fd4b 100644 --- a/test/test-assert-subroutine-error-termination.F90 +++ b/test/test-assert-subroutine-error-termination.F90 @@ -21,7 +21,7 @@ program test_assert_subroutine_error_termination #elif NAGFOR command = "fpm run --example false-assertion --compiler nagfor --flag '-DASSERTIONS -fpp' > /dev/null 2>&1", & #elif __flang__ - command = "./test/run-false-assertion.sh | fpm run --example check-exit-status", & + command = "./test/run-false-assertion.sh", & #elif __INTEL_COMPILER command = "./test/run-false-assertion-intel.sh | fpm run --example check-exit-status", & #elif _CRAYFTN