Debian Codegraph @

.github/workflows/build.yaml

raw
1 ---
2 name: Build APBS
3
4 on:
5 push:
6 branches: [main]
7 tags: ['*']
8 pull_request:
9
10 workflow_dispatch:
11
12
13 env:
14 WIN_DEPENDENCIES_RELEASE: "v0.4.0"
15 WIN_TOOLCHAIN_FILE: '/c/vcpkg/scripts/buildsystems/vcpkg.cmake'
16 BUILD_DOC: ON
17 BUILD_TOOLS: ON
18 RELEASE_TYPE: Release
19 ENABLE_PYGBE: ON
20 ENABLE_BEM: ON
21 ENABLE_GEOFLOW: ON
22 # FETK_VERSION: "1.9.2"
23 FETK_VERSION: 57195e55351e04ce6ee0ef56a143c996a9aee7e2
24 ENABLE_iAPBS: ON
25 ENABLE_PBAM: OFF
26 ENABLE_PBSAM: OFF
27 ENABLE_PYTHON: OFF
28 ENABLE_TESTS: ON
29 GET_NanoShaper: ON
30
31 jobs:
32
33 build:
34 name: Compile Code
35
36 runs-on: ${{ matrix.os }}
37
38 if: "!contains(github.event.head_commit.message, 'noci')"
39
40 strategy:
41 fail-fast: false
42 matrix:
43 platform: [ubuntu, macOS, windows]
44 openmp: [OFF]
45 static-build: [ON]
46 python-version: ["3.9"]
47 include:
48 - platform: ubuntu
49 os: ubuntu-20.04
50 bla-vendor: OpenBLAS
51 create-package: true
52 architecture: x64
53 - platform: macos
54 os: macos-11
55 bla-vendor: Apple
56 create-package: true
57 architecture: x64
58 - platform: windows
59 os: windows-2022
60 bla-vendor: OpenBLAS
61 create-package: true
62 architecture: x86
63
64 env:
65 BLA_VENDOR: ${{ matrix.bla-vendor }}
66 ENABLE_OPENMP: ${{ matrix.openmp }}
67 APBS_STATIC_BUILD: ${{matrix.static-build }}
68 PYTHON_VERSION: "${{ matrix.python-version }}"
69
70 outputs:
71 apbs-version: ${{ steps.extract-version.outputs.apbs-version }}
72 apbs-tag: ${{ steps.extract-version.outputs.apbs-tag }}
73 cpack-out-lin-zip: ${{ steps.cpack-ml.outputs.cpack-out-ubuntu-zip }}
74 cpack-out-mac-zip: ${{ steps.cpack-ml.outputs.cpack-out-macos-zip }}
75 cpack-out-win-zip: ${{ steps.cpack-w.outputs.cpack-out-windows-zip }}
76
77 steps:
78
79 - name: Add msbuild to PATH
80 if: startsWith(matrix.os, 'windows') # Windows only
81 uses: microsoft/[email protected]
82
83 - name: Checkout reposistory
84 uses: actions/checkout@master
85 with:
86 submodules: recursive
87
88 - name: Extract version
89 run: |
90 version="$(grep -E '^[0-9]+_[0-9]+_[0-9]+' VERSION | sed 's/_/./g')"
91 echo $version
92 echo ::set-output name=apbs-version::${version}
93 echo ::set-output name=apbs-tag::v${version}
94 shell: bash
95 id: extract-version
96
97 - name: Set up Python
98 uses: actions/setup-python@v2
99 with:
100 python-version: ${{ matrix.python-version }}
101 architecture: ${{ matrix.architecture }}
102
103 - name: Mac Prereqs
104 if: startsWith(matrix.os, 'macos') # Mac only
105 run: |
106 brew install \
107 wget \
108 bison \
109 flex \
110 swig \
111 boost \
112 eigen \
113 lapack \
114 suite-sparse
115 wget http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz
116 gunzip metis-5.1.0.tar.gz
117 tar -xf metis-5.1.0.tar
118 cd metis-5.1.0
119 make config prefix=/usr/local
120 make install
121 cd ..
122 git clone https://github.com/opencollab/arpack-ng.git
123 cd arpack-ng
124 git fetch --all --tags
125 git checkout tags/3.8.0 -b latest
126 mkdir build && cd build
127 cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DCMAKE_Fortran_COMPILER=$(which gfortran-11) -DEXAMPLES=OFF -DMPI=OFF -DBUILD_SHARED_LIBS=OFF ..
128 make install
129 # brew upgrade gcc@9
130
131 - name: Linux Prereqs and Remove broken apt repos [Ubuntu]
132 if: startsWith(matrix.os, 'ubuntu') # Linux only
133 run: |
134 for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
135 sudo apt-get install -yq \
136 software-properties-common \
137 build-essential \
138 wget \
139 bison \
140 flex \
141 swig \
142 libreadline-dev \
143 libeigen3-dev \
144 libboost-dev \
145 libopenblas-serial-dev \
146 libarpack2-dev \
147 liblapack-dev \
148 libsuitesparse-dev
149 wget http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz
150 gunzip metis-5.1.0.tar.gz
151 tar -xf metis-5.1.0.tar
152 cd metis-5.1.0
153 make config prefix=/usr/local
154 sudo make install
155
156 - name: Install Window dependencies
157 if: startsWith(matrix.os, 'windows') # Windows only
158 run: |
159 choco install wget
160 wget https://github.com/Electrostatics/cache/releases/download/${WIN_DEPENDENCIES_RELEASE}/apbs_dependencies_vcpkg.zip
161 7z x apbs_dependencies_vcpkg.zip -aoa -o/c/vcpkg
162 ls /c/vcpkg
163 vcpkg integrate install
164 vcpkg list --triplet x86-windows
165 shell: bash
166
167 - name: Configure for Windows
168 if: startsWith(matrix.os, 'windows') # Windows only
169 env:
170 CMAKE_PREFIX_PATH: ${VCPKG_INSTALLATION_ROOT}/installed/x86-windows
171 run: |
172 mkdir -p build/${RELEASE_TYPE}
173 cd build
174 echo $CMAKE_PREFIX_PATH
175 cmake -DCMAKE_TOOLCHAIN_FILE=${WIN_TOOLCHAIN_FILE} -DVCPKG_TARGET_TRIPLET=x86-windows -DCMAKE_INSTALL_INCLUDEDIR=include -DCMAKE_BUILD_TYPE=${RELEASE_TYPE} -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF -DBUILD_TESTING=${BUILD_TESTING} -DBUILD_TOOLS=${BUILD_TOOLS} -DCHECK_EPSILON=ON -DBLA_VENDOR=${BLA_VENDOR} -DENABLE_BEM=${ENABLE_BEM} -DENABLE_GEOFLOW=${ENABLE_GEOFLOW} -DENABLE_iAPBS=${ENABLE_iAPBS} -DENABLE_PYGBE=${ENABLE_PYGBE} -DPYTHON_VERSION="${PYTHON_VERSION}" -DENABLE_INLINE=ON -DENABLE_PBAM=${ENABLE_PBAM} -DENABLE_PBSAM=${ENABLE_PBSAM} -DENABLE_PYTHON=${ENABLE_PYTHON} -DENABLE_TESTS=${ENABLE_TESTS} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DENABLE_VERBOSE_DEBUG=OFF -DGET_NanoShaper=${GET_NanoShaper} -DFETK_VERSION=${FETK_VERSION} -G "Visual Studio 17 2022" -A Win32 ..
176 cat CMakeCache.txt
177 shell: bash
178
179 - name: Configure and Build for Mac
180 if: startsWith(matrix.os, 'macos') # Mac only
181 env:
182 INSTALL_DIR: "./"
183 run: |
184 ./.build.sh
185
186 - name: Configure and Build for Linux
187 if: startsWith(matrix.os, 'ubuntu') # Linux only
188 env:
189 # https://codecov.io/gh/Electrostatics/apbs
190 CODECOV_TOKEN: "e3a1e24c-5598-4f47-9353-7fa0ac57f98e"
191 INSTALL_DIR: "./"
192 run: |
193 ./.build.sh
194
195 - name: Build on Windows
196 if: startsWith(matrix.os, 'windows') # Windows only
197 run: |
198 cd build
199 cmake --build . --config ${RELEASE_TYPE} --parallel 2 --target install
200 shell: bash
201
202 - name: Configure Pagefile on Windows
203 if: startsWith(matrix.os, 'windows') # Windows only
204 uses: al-cheb/[email protected]
205 with:
206 minimum-size: 8GB
207 maximum-size: 16GB
208
209 - name: Run tests
210 # Path setting includes a windows-specific path, but this should just be ignored in linux/mac
211 run: |
212 cd build
213 export PATH=$(pwd)/bin:/c/vcpkg/installed/x86-windows/bin:$PATH
214 ctest -C ${RELEASE_TYPE} -VV --output-on-failure
215 shell: bash
216
217 - name: Create package for Mac and Linux
218 if: matrix.create-package && startsWith(matrix.os, 'macos') || startswith(matrix.os, 'ubuntu') # Mac or Linux only
219 id: cpack-ml
220 run: |
221 cd build
222 cpack -C ${RELEASE_TYPE} -G ZIP
223 ZIP_CPACK_FILE=`ls APBS*.zip`
224 echo "ZIP_CPACK_FILE=${ZIP_CPACK_FILE}" >> $GITHUB_ENV
225 echo "PATH_TO_PACKAGE=build/" >> $GITHUB_ENV
226 echo ::set-output name=cpack-out-${{ matrix.platform }}-zip::${ZIP_CPACK_FILE}
227 echo "ZIP CPack file: $ZIP_CPACK_FILE"
228 unzip -l ${ZIP_CPACK_FILE}
229
230 - name: Create package for Windows
231 if: matrix.create-package && startsWith(matrix.os, 'windows') # Windows only
232 id: cpack-w
233 run: |
234 cd build
235 /c/Program\ Files/CMake/bin/cpack.exe -C ${RELEASE_TYPE} -G ZIP -V
236 ZIP_CPACK_FILE=`ls APBS*.zip`
237 echo "Repackaging with extra dlls"
238 mkdir unzip
239 cp $ZIP_CPACK_FILE unzip
240 cd unzip
241 7z x $ZIP_CPACK_FILE
242 PACKAGE_DIR=${ZIP_CPACK_FILE%.*}
243 cp /c/vcpkg/installed/x86-windows/bin/{libumfpack.dll,libcholmod.dll,libamd.dll,openblas.dll,libcamd.dll,libcolamd.dll,libccolamd.dll,liblapack.dll,libgfortran-5.dll,libgcc_s_dw2-1.dll,libwinpthread-1.dll,libquadmath-0.dll} ./${PACKAGE_DIR}/bin
244 7z a -r $ZIP_CPACK_FILE $PACKAGE_DIR/bin/*.dll
245 echo "ZIP_CPACK_FILE=${ZIP_CPACK_FILE}" >> $GITHUB_ENV
246 echo "PATH_TO_PACKAGE=build/unzip/" >> $GITHUB_ENV
247 echo ::set-output name=cpack-out-${{ matrix.platform }}-zip::${ZIP_CPACK_FILE}
248 echo "ZIP CPack file: $ZIP_CPACK_FILE"
249 unzip -l ${ZIP_CPACK_FILE}
250 shell: bash
251
252 - name: Upload ZIP package to the action
253 if: matrix.create-package
254 uses: actions/upload-artifact@v2
255 with:
256 name: ${{ env.ZIP_CPACK_FILE }}
257 path: ${{ env.PATH_TO_PACKAGE }}${{ env.ZIP_CPACK_FILE }}
258 retention-days: 5
259
260 # For debugging
261 # - name: Setup tmate session
262 # if: startsWith(matrix.os, 'macos') || ! success()
263 # if: startsWith(matrix.os, 'windows') || ! success()
264 # if: ${{ ! success() }}
265 # uses: mxschmitt/action-tmate@v3
266
267
268 test:
269 name: Test Usage
270
271 needs: build
272
273 runs-on: ${{ matrix.os }}
274
275 strategy:
276 fail-fast: false
277 matrix:
278 cpack: [lin-zip, mac-zip, win-zip]
279 python-version: ["3.9"]
280 include:
281 - cpack: lin-zip
282 os: ubuntu-20.04
283 package_file: ${{ needs.build.outputs.cpack-out-lin-zip }}
284 architecture: x64
285 - cpack: mac-zip
286 os: macOS-11
287 package_file: ${{ needs.build.outputs.cpack-out-mac-zip }}
288 architecture: x64
289 - cpack: win-zip
290 os: windows-2022
291 package_file: ${{ needs.build.outputs.cpack-out-win-zip }}
292 architecture: x86
293
294 steps:
295
296 - name: Set up Python
297 if: startsWith(matrix.os, 'windows') # Windows only (no static python libs in windows)
298 uses: actions/setup-python@v2
299 with:
300 python-version: ${{ matrix.python-version }}
301 architecture: ${{ matrix.architecture }}
302
303 # - name: Linux Prereqs
304 # if: startsWith(matrix.os, 'ubuntu') # Linux only
305 # run: |
306 # sudo apt-get install -yq \
307 # libsuitesparse-dev \
308 # libsuperlu-dev \
309 # libopenblas-dev \
310 # python3-dev
311
312 # - name: Mac Prereqs
313 # if: startsWith(matrix.os, 'macos') # Mac only
314 # run: |
315 # brew install \
316 # suite-sparse \
317 # superlu \
318 # openblas
319
320 # We only need libumfpack. For some reason it's still being linked into apbs.exe
321 # - name: Windows Prereqs
322 # if: startsWith(matrix.os, 'windows') # Windows only
323 # run: |
324 # choco install wget
325 # wget https://github.com/Electrostatics/cache/releases/download/${WIN_DEPENDENCIES_RELEASE}/apbs_dependencies_vcpkg.zip
326 # 7z x apbs_dependencies_vcpkg.zip -aoa -o/c/vcpkg
327 # echo "/c/vcpkg/installed/x86-windows/bin" >> $GITHUB_PATH
328 # shell: bash
329
330 - name: Download artifacts
331 uses: actions/download-artifact@v2
332 with:
333 name: ${{ matrix.package_file }}
334
335 - name: Run zipped examples
336 if: endsWith(matrix.cpack, 'zip')
337 run: |
338 unzip ${{ matrix.package_file }}
339 APBS_DIR=${RUNNER_WORKSPACE}/apbs/$(basename -- "$(ls ${{ matrix.package_file }})" .zip)
340 cd ${APBS_DIR}/share/apbs/examples
341 ./run_selected_examples.sh
342 shell: bash
343
344 - name: ldd
345 if: ${{ ! success() && startsWith(matrix.os, 'windows') }}
346 run: |
347 git clone https://github.com/LRN/ntldd.git
348 cd ntldd
349 ./makeldd.cmd
350 export PATH=/d/a/apbs/apbs/ntldd:$PATH
351 cd ../APBS-3.3.0.Windows/bin
352 ntldd.exe ./apbs.exe
353 shell: bash
354
355 # For debugging
356 # - name: Setup tmate session
357 # if: ${{ ! success() }}
358 # if: startsWith(matrix.os, 'macOS')
359 # uses: mxschmitt/action-tmate@v3
360
361
362 release:
363 name: Publish Release Artifacts
364
365 needs: [build, test]
366
367 if: startswith(github.ref, 'refs/tags/') # Tag/release only
368
369 runs-on: ${{ matrix.os }}
370
371 strategy:
372 fail-fast: false
373 matrix:
374 os: [ubuntu-latest, macOS-latest, windows-latest]
375 include:
376 - os: ubuntu-latest
377 package_file: ${{ needs.build.outputs.cpack-out-lin-zip }}
378 - os: macOS-latest
379 package_file: ${{ needs.build.outputs.cpack-out-mac-zip }}
380 - os: windows-latest
381 package_file: ${{ needs.build.outputs.cpack-out-win-zip }}
382
383 steps:
384
385 - name: Download artifacts
386 uses: actions/download-artifact@v2
387 with:
388 name: ${{ matrix.package_file }}
389
390 - name: Release artifacts
391 uses: softprops/action-gh-release@v1
392 env:
393 GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
394 with:
395 files: |
396 ${{ matrix.package_file }}
397 fail_on_unmatched_files: true
398 tag_name: ${{ needs.build.outputs.apbs-tag }}
399
400 # For debugging
401 # - name: Setup tmate session
402 # if: ${{ ! success() }}
403 # uses: mxschmitt/action-tmate@v3