Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 13 additions & 21 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,44 @@ 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:
github-token: ${{ secrets.GITHUB_TOKEN }}

- 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"
1 change: 0 additions & 1 deletion test/command_line_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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 &
Expand Down
23 changes: 22 additions & 1 deletion test/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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