-
Notifications
You must be signed in to change notification settings - Fork 36
251 lines (224 loc) · 8.91 KB
/
build_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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
name: Build and Test Matrix
on: [pull_request]
env:
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18497/w_BaseKit_p_2022.1.2.154_offline.exe
WINDOWS_HPCKIT_LATEST_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18529/w_HPCKit_p_2022.1.2.116_offline.exe
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/17392/w_HPCKit_p_2021.1.0.2682_offline.exe
WINDOWS_DPCPP_COMPONENTS: intel.oneapi.win.dpcpp-compiler
WINDOWS_FORTRAN_COMPONENTS: intel.oneapi.win.ifort-compiler
SAMPLES_TAG: 2022.1.0
jobs:
pipeline:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows 2019 MSVC",
build_type: "Release",
os: windows-2019,
}
- {
name: "Ubuntu 20.04",
build_type: "Release",
os: ubuntu-20.04,
}
- {
name: "Ubuntu 20.04 with SuperLU",
build_type: "Release",
super_lu: true,
os: ubuntu-20.04,
}
- {
name: "macOS Big Sur 11",
build_type: "Release",
os: macos-11,
}
steps:
# Useful for debugging dll load issues.
# - name: Download Dependencies
# if: runner.os == 'Windows'
# shell: bash
# run: |
# curl -L https://github.com/lucasg/Dependencies/releases/download/v1.11.1/Dependencies_x64_Release.zip -O
# ls
# unzip Dependencies_x64_Release.zip
# - name: Run Dependencies
# if: runner.os == 'Windows'
# shell: cmd
# run: |
# python -VV
# Dependencies.exe -depth 2 -chain "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/14.29.30133/x64/Microsoft.VC142.CRT/vcruntime140.dll"
# This is not needed, we can just install the Fortran compiler for the HPC kit.
# - name: Install oneAPI base kit
# if: runner.os == 'Windows'
# shell: bash
# run: oneapi/scripts/install_windows.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_COMPONENTS
# - name: Build oneAPI base kit
# if: runner.os == 'Windows'
# shell: bash
# run: oneapi/scripts/build_windows.bat dpc++ "" $SAMPLES_TAG
# - name: Checkout oneAPI scripts
# if: runner.os == 'Windows'
# uses: actions/checkout@v3
# with:
# repository: 'hsorby/oneapi-ci'
# path: 'oneapi'
# Caching doesn't work with Visual Studio integration on.
# - name: Cache install oneAPI
# if: runner.os == 'Windows'
# id: cache-install
# uses: actions/cache@v2
# with:
# path: C:\Program Files (x86)\Intel\oneAPI\compiler
# key: install-${{ env.WINDOWS_HPCKIT_URL }}-${{ env.WINDOWS_FORTRAN_COMPONENTS }}-compiler-${{ hashFiles('**/oneapi/scripts/cache_exclude_windows.sh') }}
- name: Install oneAPI HPC kit
if: runner.os == 'Windows'
uses: hsorby/install-intelfortran-action@main
with:
cache: false
# working-directory: oneapi
# shell: bash
# run: |
# scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_FORTRAN_COMPONENTS
# Delete the following if you don't want to save install logs
# - name: Saving install logs
# if: runner.os == 'Windows' && steps.cache-install.outputs.cache-hit != 'true'
# uses: actions/upload-artifact@v2
# with:
# name: InstallLogs_${{ github.job }}
# path: |
# oneapi/bootstrapper*
# oneapi/installer*
# retention-days: 7
# Add in for building a simple Fortran application to test the Fortran compiler is working.
# - name: Build oneAPI HPC kit
# if: runner.os == 'Windows'
# shell: bash
# run: oneapi/scripts/build_windows.bat fortran "" $SAMPLES_TAG
# - name: Exclude unused files from cache
# if: runner.os == 'Windows' && steps.cache-install.outputs.cache-hit != 'true'
# working-directory: oneapi
# run: scripts/cache_exclude_windows.ps1
- name: Checkout lungsim
uses: actions/checkout@v3
with:
path: lungsim
- name: Run get Fortran environment script
id: setup-fortran-win
if: runner.os == 'WindowsX'
shell: bash
working-directory: lungsim
run: |
latest_version=`.github/scripts/oneapi-env-vars-location.bat`
echo "ifort compiler: $latest_version"
# latest_version=`echo $latest_version | tr '\' '/'`
# echo $latest_version
# echo "::set-output name=env_bat::${latest_version}"
echo "fc=${latest_version}" >> $GITHUB_OUTPUT
redist_location=`.github/scripts/oneapi-redist-location.bat`
echo "redist location: ${redist_location}"
echo "redist_loc=${redist_location}" >> $GITHUB_OUTPUT
- name: Report CMake version
run: cmake --version
- name: Install SuperLU
if: matrix.config.super_lu
shell: bash
run: sudo apt-get install libsuperlu-dev
- name: Create virtual environment
shell: cmake -P {0}
id: create-venv
run: |
if ("${{ runner.os }}" STREQUAL "Windows")
set(SYS_PYTHON_EXE python)
else()
set(SYS_PYTHON_EXE python3)
endif()
execute_process(
COMMAND ${SYS_PYTHON_EXE} -m venv venv
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Failed to create virtual environment.")
endif()
if ("${{ runner.os }}" STREQUAL "Windows")
file(GLOB PYTHON_EXE venv/Scripts/python.exe)
file(GLOB PIP_EXE venv/Scripts/pip.exe)
else()
file(GLOB PYTHON_EXE venv/bin/python)
file(GLOB PIP_EXE venv/bin/pip)
endif()
execute_process(
COMMAND ${PYTHON_EXE} -m pip install numpy
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Failed to install numpy to virtual environment.")
endif()
file(APPEND $ENV{GITHUB_OUTPUT} "python_exe=${PYTHON_EXE}\n")
file(APPEND $ENV{GITHUB_OUTPUT} "pip_exe=${PIP_EXE}\n")
- name: Generate build instructions - Windows
shell: cmd
if: runner.os == 'Windows'
run: |
cmake -S lungsim -B build-lungsim -D CMAKE_Fortran_COMPILER="%INTEL_COMPILER_BIN_PATH:\=/%/ifort.exe" -D AETHER_ENABLE_TESTS=FALSE -D Python_EXECUTABLE=${{ steps.create-venv.outputs.python_exe }}
- name: Generate build instructions - Linux
shell: bash
if: runner.os == 'Linux'
run: |
cmake \
-S lungsim \
-B build-lungsim \
-D CMAKE_Fortran_COMPILER=gfortran \
-D AETHER_ENABLE_TESTS=FALSE \
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-D Python_EXECUTABLE=${{ steps.create-venv.outputs.python_exe }}
- name: Generate build instructions - macOS
shell: bash
if: runner.os == 'macOS'
run: |
cmake \
-S lungsim \
-B build-lungsim \
-D CMAKE_Fortran_COMPILER=gfortran-10 \
-D AETHER_ENABLE_TESTS=FALSE \
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-D Python_EXECUTABLE=${{ steps.create-venv.outputs.python_exe }}
- name: Build lungsim
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "Windows")
set(WINDOWS_BUILD_CONFIG --config ${{ matrix.config.build_type }})
endif()
execute_process(
COMMAND cmake --build build-lungsim ${WINDOWS_BUILD_CONFIG}
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE output
ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE
)
if (NOT result EQUAL 0)
string(REGEX MATCH "FAILED:.*$" error_message "${output}")
string(REPLACE "\n" "%0A" error_message "${error_message}")
message("::error::${error_message}")
message(FATAL_ERROR "Build failed.")
endif()
- name: Test lungsim
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
multi_config_dir=/${{ matrix.config.build_type }}
fi
${{ steps.create-venv.outputs.pip_exe }} install wheel
${{ steps.create-venv.outputs.pip_exe }} install $GITHUB_WORKSPACE/build-lungsim/src/bindings/python$multi_config_dir
if [ "${{ runner.os }}" == "Windows" ]; then
# Horrible hack for GitHub actions Windows virtual machine.
prefix_path=$(dirname $(dirname ${{ steps.create-venv.outputs.python_exe }}))
cp $prefix_path/Library/bin/libifcoremd.dll $GITHUB_WORKSPACE/venv/Lib/site-packages/aether
cp $prefix_path/Library/bin/libmmd.dll $GITHUB_WORKSPACE/venv/Lib/site-packages/aether
cp $prefix_path/Library/bin/svml_dispmd.dll $GITHUB_WORKSPACE/venv/Lib/site-packages/aether
fi
${{ steps.create-venv.outputs.python_exe }} $GITHUB_WORKSPACE/lungsim/.github/scripts/diagnostics_test.py
exit $?