diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e9cb5793..2d98c693 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -4,14 +4,16 @@ on: [push, pull_request] jobs: Build: - runs-on: ubuntu-22.04 - strategy: - fail-fast: true + runs-on: [ubuntu-22.04] env: FC: gfortran GCC_V: 12 + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Install fpm uses: fortran-lang/setup-fpm@v4 with: @@ -19,37 +21,27 @@ jobs: - name: Get Time id: time - uses: nanzm/get-time-action@v1.0 + uses: nanzm/get-time-action@v1.1 with: format: 'YYYY-MM' - name: Setup cache for opencoarrays id: cache-opencoarrays - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: "OpenCoarrays-2.10.0/" key: ${{ steps.time.outputs.time }} - name: Install GFortran, OpenCoarrays run: | - sudo apt install -y gfortran-${GCC_V} graphviz + sudo apt update + sudo apt install -y build-essential gfortran-${GCC_V} g++-${GCC_V} pkg-config make 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/bingcov gcov /usr/bin/gcov-${GCC_V} + --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \ + --slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_V} if [ ! -d OpenCoarrays-2.10.0 ] ; then wget -P . https://github.com/sourceryinstitute/OpenCoarrays/releases/download/2.10.0/OpenCoarrays-2.10.0.tar.gz && tar -xf OpenCoarrays-2.10.0.tar.gz && cd OpenCoarrays-2.10.0 && TERM=xterm ./install.sh -y; fi - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Build and Test + - name: Build, run, and test run: | - export PATH="${HOME}/.local/bin:$PATH" source OpenCoarrays-2.10.0/prerequisites/installations/opencoarrays/2.10.0/setup.sh - fpm test \ - --compiler caf \ - --runner "cafrun -n 4" \ - --flag "-DCOMPILER_LACKS_COLLECTIVE_SUBROUTINES" \ - --flag "-DCOMPILER_LACKS_FINDLOC" \ - --flag "-Wall" \ - --flag "-std=f2018" + fpm test --compiler caf --runner "cafrun -n 2" diff --git a/test/command_line_test.f90 b/test/command_line_test.f90 index 4fcf6f92..0eb85ff4 100644 --- a/test/command_line_test.f90 +++ b/test/command_line_test.f90 @@ -34,7 +34,6 @@ function check_flag_value() result(test_passes) integer exit_status, command_status character(len=132) command_message - ! command = "fpm run --example get-flag-value -- --input-file ni_weights_iter131072 > /dev/null 2>&1", & call execute_command_line( & command = "fpm run --example get-flag-value -- --input-file some_file_name", & wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message & diff --git a/test/main.f90 b/test/main.f90 index 09698103..019c47e1 100644 --- a/test/main.f90 +++ b/test/main.f90 @@ -18,14 +18,35 @@ program main integer :: passes=0, tests=0 + call data_partition_test%report(passes, tests) call collectives_test%report(passes, tests) call object_test%report(passes, tests) call formats_test%report(passes, tests) call test_result_test%report(passes, tests) - call command_line_test%report(passes, tests) call string_test%report(passes, tests) + if (.not. GitHub_CI()) call command_line_test%report(passes, tests) + if (this_image()==1) print *, new_line('a'), "_________ In total, ",passes," of ",tests, " tests pass. _________" + if (passes /= tests) error stop + +contains + + logical function GitHub_CI() + integer name_length + character(len=:), allocatable :: CI + + call get_environment_variable("CI", length=name_length) + + if (name_length==0) then + GitHub_CI = .false. + else + allocate(character(len=name_length):: CI) + call get_environment_variable("CI", value=CI) + GitHub_CI = merge(.true., .false., CI=="true") + end if + end function + end program