-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from MetOffice/feature/ci
Use both JCSDA and UKMO environments for CI build
- Loading branch information
Showing
3 changed files
with
175 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
# | ||
# (C) Crown Copyright 2023, the Met Office. All rights reserved. | ||
# | ||
set -euo pipefail | ||
|
||
finally() { | ||
trap '' ERR | ||
trap '' EXIT | ||
if [[ -d "${WORKD:-}" ]]; then | ||
cd / | ||
rm -fr "${WORKD}" | ||
fi | ||
} | ||
|
||
# HERE is /usr/local/src/<REPONAME>/pr-<#> (cf ../.github/workflow/ci.yml) | ||
HERE="$(cd "$(dirname "$0")" && pwd)" | ||
THIS="$(basename "$0")" | ||
NPROC=${NPROC:-$(nproc)} | ||
WORKD="$(mktemp -d "${THIS}-XXXXXX" -t)" | ||
GENERATOR=Unix\ Makefiles | ||
if command -v ninja &>/dev/null; then GENERATOR=Ninja; fi | ||
BASE="${HERE%/*}" | ||
TESTDIR="${BASE##*/}" | ||
|
||
trap finally ERR EXIT | ||
|
||
cd "${WORKD}" | ||
|
||
# -- Activate spack env if using JCSDA Docker container | ||
if [[ -f /opt/spack-environment/activate.sh ]]; then | ||
source /opt/spack-environment/activate.sh | ||
fi | ||
|
||
|
||
# -- Configure | ||
cmake -B . -S "${HERE}" -G "${GENERATOR}" \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DMPI_ARGS="--oversubscribe" | ||
|
||
# -- Build | ||
cmake --build . -j "${NPROC}" | ||
|
||
# -- Test | ||
env OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 \ | ||
ctest -j"${NPROC}" --test-dir "${TESTDIR}" -R 'coding_norms' -V | ||
|
||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters