@@ -2,11 +2,13 @@ name: Build/Test
2
2
3
3
on : [push, pull_request]
4
4
5
+ env :
6
+ BUILD_DIR : _build
7
+
5
8
jobs :
6
9
build-test-unix :
7
10
if :
8
- github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
9
- github.repository
11
+ github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
10
12
11
13
runs-on : ${{ matrix.os }}
12
14
25
27
steps :
26
28
- uses : actions/checkout@v4
27
29
28
- - uses : mamba-org/setup-micromamba@v1
30
+ - uses : mamba-org/setup-micromamba@v2
29
31
with :
30
32
micromamba-version : latest
31
33
environment-name : testing
@@ -35,19 +37,14 @@ jobs:
35
37
fortran-compiler
36
38
bmi-fortran
37
39
38
- - name : Make CMake build directory
39
- run : cmake -E make_directory build
40
-
41
- - name : Configure CMake
42
- working-directory : ${{ github.workspace }}/build
40
+ - name : Configure project
43
41
run : |
44
- cmake $GITHUB_WORKSPACE \
42
+ cmake $GITHUB_WORKSPACE -B ${{ env.BUILD_DIR }} \
45
43
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
46
44
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
47
45
48
- - name : Build
49
- working-directory : ${{ github.workspace }}/build
50
- run : cmake --build . --target install --config ${{ matrix.build-type }}
46
+ - name : Build and install project
47
+ run : cmake --build ${{ env.BUILD_DIR }} --target install --config ${{ matrix.build-type }}
51
48
52
49
- name : Test for installed files
53
50
run : |
58
55
test -f $CONDA_PREFIX/include/bmiheatf.mod
59
56
test -f $CONDA_PREFIX/lib/pkgconfig/bmiheatf.pc
60
57
61
- - name : Run CTest
62
- working-directory : ${{ github.workspace }}/build
63
- run : ctest -C ${{ matrix.build-type }} --output-on-failure
58
+ - name : Run project tests
59
+ run : ctest --test-dir ${{ env.BUILD_DIR }} -C ${{ matrix.build-type }} --output-on-failure
64
60
65
61
- name : Memcheck
66
62
if : matrix.os == 'ubuntu-latest'
78
74
79
75
build-test-windows :
80
76
if :
81
- github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
82
- github.repository
77
+ github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
83
78
84
79
runs-on : windows-latest
85
80
@@ -89,52 +84,42 @@ jobs:
89
84
steps :
90
85
- uses : actions/checkout@v4
91
86
- uses : ilammy/msvc-dev-cmd@v1
92
- - uses : mamba-org/setup-micromamba@v1
87
+ - uses : mamba-org/setup-micromamba@v2
93
88
with :
94
89
micromamba-version : latest
95
90
environment-name : testing
96
91
create-args : >-
97
92
cmake
98
93
pkg-config
99
94
cxx-compiler
95
+ fortran-compiler
96
+ bmi-fortran
100
97
init-shell : >-
101
98
powershell
102
99
103
- # The Fortran conda compiler doesn't seem to work on Windows in Actions.
104
- # Instead, use the gfortran installed by chocolately. However, we then
105
- # can't use the bmi-fortran package from conda-forge because it's not
106
- # ABI-compatible. So, build bmi-fortran locally, This is a hack
107
- # workaround.
108
- - name : Build the bmi-fortran specification locally
100
+ - name : Set the FC environment variable to the Fortran conda compiler
101
+ run : |
102
+ echo "FC=$env:CONDA_PREFIX\Library\bin\flang-new.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
103
+
104
+ - name : List current environment variables
109
105
run : |
110
- curl -o bmi-fortran.zip -L https://github.com/csdms/bmi-fortran/archive/refs/heads/master.zip
111
- unzip bmi-fortran.zip
112
- cd bmi-fortran-master
113
- mkdir build && cd build
114
- cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="${{ env.LIBRARY_PREFIX }}" -DCMAKE_BUILD_TYPE=Release
115
- cmake --build . --target install --config Release
116
- cd ${{ github.workspace }}
117
-
118
- - name : Make cmake build directory
119
- run : cmake -E make_directory build
120
-
121
- - name : Configure, build, and install
122
- working-directory : ${{ github.workspace }}/build
106
+ ls env:
107
+
108
+ - name : Configure, build, and install project
123
109
run : |
124
- cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="${{ env.LIBRARY_PREFIX }}" -DCMAKE_BUILD_TYPE=Release
125
- cmake --build . --target install --config Release
110
+ cmake -B ${{ env.BUILD_DIR }} -LA -G Ninja -DCMAKE_INSTALL_PREFIX="${{ env.LIBRARY_PREFIX }}" -DCMAKE_BUILD_TYPE=Release
111
+ cmake --build ${{ env.BUILD_DIR }} --target install --config Release
126
112
127
113
- name : Test for installed files
128
114
run : |
129
- if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libheatf.a ) ){ exit 1 }
115
+ if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\heatf.lib ) ){ exit 1 }
130
116
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\bin\run_heatf.exe ) ){ exit 1 }
131
117
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\include\heatf.mod ) ){ exit 1 }
132
118
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\pkgconfig\heatf.pc ) ){ exit 1 }
133
119
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\bin\run_bmiheatf.exe ) ){ exit 1 }
134
- if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libbmiheatf.a ) ){ exit 1 }
120
+ if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\bmiheatf.lib ) ){ exit 1 }
135
121
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\include\bmiheatf.mod ) ){ exit 1 }
136
122
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\pkgconfig\bmiheatf.pc ) ){ exit 1 }
137
123
138
124
- name : Run CTest
139
- working-directory : ${{ github.workspace }}/build
140
- run : ctest -C Release -VV --output-on-failure
125
+ run : ctest --test-dir ${{ env.BUILD_DIR }} -C Release -VV --output-on-failure
0 commit comments