-
Notifications
You must be signed in to change notification settings - Fork 5
140 lines (117 loc) · 4.87 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Build/Test
on: [push, pull_request]
jobs:
build-test-unix:
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
env:
SHLIB_EXT: ${{ matrix.os == 'ubuntu-latest' && '.so' || '.dylib' }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
build-type: [Release]
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: latest
environment-name: testing
create-args: >-
cmake
pkg-config
fortran-compiler
bmi-fortran
- name: Make CMake build directory
run: cmake -E make_directory build
- name: Configure CMake
working-directory: ${{ github.workspace }}/build
run: |
cmake $GITHUB_WORKSPACE \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
- name: Build
working-directory: ${{ github.workspace }}/build
run: cmake --build . --target install --config ${{ matrix.build-type }}
- name: Test for installed files
run: |
test -h $CONDA_PREFIX/lib/libheatf${{ env.SHLIB_EXT }}
test -f $CONDA_PREFIX/include/heatf.mod
test -f $CONDA_PREFIX/lib/pkgconfig/heatf.pc
test -h $CONDA_PREFIX/lib/libbmiheatf${{ env.SHLIB_EXT }}
test -f $CONDA_PREFIX/include/bmiheatf.mod
test -f $CONDA_PREFIX/lib/pkgconfig/bmiheatf.pc
- name: Run CTest
working-directory: ${{ github.workspace }}/build
run: ctest -C ${{ matrix.build-type }} --output-on-failure
- name: Memcheck
if: matrix.os == 'ubuntu-latest'
working-directory: ${{ github.workspace }}/example
run: |
sudo apt-get update
sudo apt-get install -y valgrind
valgrind \
--tool=memcheck \
--leak-check=yes \
--show-reachable=yes \
--num-callers=20 \
--track-fds=yes \
run_bmiheatf test1.cfg
build-test-windows:
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository
runs-on: windows-latest
env:
LIBRARY_PREFIX: $env:CONDA_PREFIX\Library
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: latest
environment-name: testing
create-args: >-
cmake
pkg-config
cxx-compiler
init-shell: >-
powershell
# The Fortran conda compiler doesn't seem to work on Windows in Actions.
# Instead, use the gfortran installed by chocolately. However, we then
# can't use the bmi-fortran package from conda-forge because it's not
# ABI-compatible. So, build bmi-fortran locally, This is a hack
# workaround.
- name: Build the bmi-fortran specification locally
run: |
curl -o bmi-fortran.zip -L https://github.com/csdms/bmi-fortran/archive/refs/heads/master.zip
unzip bmi-fortran.zip
cd bmi-fortran-master
mkdir build && cd build
cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="${{ env.LIBRARY_PREFIX }}" -DCMAKE_BUILD_TYPE=Release
cmake --build . --target install --config Release
cd ${{ github.workspace }}
- name: Make cmake build directory
run: cmake -E make_directory build
- name: Configure, build, and install
working-directory: ${{ github.workspace }}/build
run: |
cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="${{ env.LIBRARY_PREFIX }}" -DCMAKE_BUILD_TYPE=Release
cmake --build . --target install --config Release
- name: Test for installed files
run: |
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libheatf.a ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\bin\run_heatf.exe ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\include\heatf.mod ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\pkgconfig\heatf.pc ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\bin\run_bmiheatf.exe ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libbmiheatf.a ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\include\bmiheatf.mod ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\pkgconfig\bmiheatf.pc ) ){ exit 1 }
- name: Run CTest
working-directory: ${{ github.workspace }}/build
run: ctest -C Release -VV --output-on-failure