Skip to content

Commit f30fd6b

Browse files
authored
Merge pull request #43 from sourceryinstitute/fix-ci
Fix CI
2 parents 2434a05 + 9318deb commit f30fd6b

File tree

3 files changed

+35
-23
lines changed

3 files changed

+35
-23
lines changed

.github/workflows/CI.yml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,44 @@ on: [push, pull_request]
44

55
jobs:
66
Build:
7-
runs-on: ubuntu-22.04
8-
strategy:
9-
fail-fast: true
7+
runs-on: [ubuntu-22.04]
108

119
env:
1210
FC: gfortran
1311
GCC_V: 12
1412

13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
1517
- name: Install fpm
1618
uses: fortran-lang/setup-fpm@v4
1719
with:
1820
github-token: ${{ secrets.GITHUB_TOKEN }}
1921

2022
- name: Get Time
2123
id: time
22-
uses: nanzm/get-time-action@v1.0
24+
uses: nanzm/get-time-action@v1.1
2325
with:
2426
format: 'YYYY-MM'
2527

2628
- name: Setup cache for opencoarrays
2729
id: cache-opencoarrays
28-
uses: actions/cache@v2
30+
uses: actions/cache@v3
2931
with:
3032
path: "OpenCoarrays-2.10.0/"
3133
key: ${{ steps.time.outputs.time }}
3234

3335
- name: Install GFortran, OpenCoarrays
3436
run: |
35-
sudo apt install -y gfortran-${GCC_V} graphviz
37+
sudo apt update
38+
sudo apt install -y build-essential gfortran-${GCC_V} g++-${GCC_V} pkg-config make
3639
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
37-
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
38-
--slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V}
40+
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
41+
--slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_V}
3942
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
4043
41-
steps:
42-
- name: Checkout code
43-
uses: actions/checkout@v3
44-
45-
- name: Build and Test
44+
- name: Build, run, and test
4645
run: |
47-
export PATH="${HOME}/.local/bin:$PATH"
4846
source OpenCoarrays-2.10.0/prerequisites/installations/opencoarrays/2.10.0/setup.sh
49-
fpm test \
50-
--compiler caf \
51-
--runner "cafrun -n 4" \
52-
--flag "-DCOMPILER_LACKS_COLLECTIVE_SUBROUTINES" \
53-
--flag "-DCOMPILER_LACKS_FINDLOC" \
54-
--flag "-Wall" \
55-
--flag "-std=f2018"
47+
fpm test --compiler caf --runner "cafrun -n 2"

test/command_line_test.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ function check_flag_value() result(test_passes)
3434
integer exit_status, command_status
3535
character(len=132) command_message
3636

37-
! command = "fpm run --example get-flag-value -- --input-file ni_weights_iter131072 > /dev/null 2>&1", &
3837
call execute_command_line( &
3938
command = "fpm run --example get-flag-value -- --input-file some_file_name", &
4039
wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message &

test/main.f90

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,35 @@ program main
1818

1919
integer :: passes=0, tests=0
2020

21+
2122
call data_partition_test%report(passes, tests)
2223
call collectives_test%report(passes, tests)
2324
call object_test%report(passes, tests)
2425
call formats_test%report(passes, tests)
2526
call test_result_test%report(passes, tests)
26-
call command_line_test%report(passes, tests)
2727
call string_test%report(passes, tests)
2828

29+
if (.not. GitHub_CI()) call command_line_test%report(passes, tests)
30+
2931
if (this_image()==1) print *, new_line('a'), "_________ In total, ",passes," of ",tests, " tests pass. _________"
32+
3033
if (passes /= tests) error stop
34+
35+
contains
36+
37+
logical function GitHub_CI()
38+
integer name_length
39+
character(len=:), allocatable :: CI
40+
41+
call get_environment_variable("CI", length=name_length)
42+
43+
if (name_length==0) then
44+
GitHub_CI = .false.
45+
else
46+
allocate(character(len=name_length):: CI)
47+
call get_environment_variable("CI", value=CI)
48+
GitHub_CI = merge(.true., .false., CI=="true")
49+
end if
50+
end function
51+
3152
end program

0 commit comments

Comments
 (0)