Skip to content

Commit

Permalink
add clang container to CI workflow (#184)
Browse files Browse the repository at this point in the history
* add clang container to CI workflow

* set oversubscribe args only for OpenMPI

* disable trace from ci build script
  • Loading branch information
yaswant authored Oct 3, 2023
1 parent 620c3bb commit ca7c891
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 16 deletions.
75 changes: 66 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
name: CI

on:
push:
branches: [develop]
pull_request:
branches: [develop]

env:
REPO: ${{ github.event.repository.name }}
BUNDLE: pr-${{ github.event.number }}

jobs:
build1:
name: gnu 11.3.1 (UKMO)
if: github.repository_owner == 'MetOffice'
runs-on: jedi-self-hosted-rg

env:
REPO: ${{ github.event.repository.name }}
BUNDLE: pr-${{ github.event.number }}


steps:
- name: pre-submit cleanup
run: |
Expand Down Expand Up @@ -81,10 +83,6 @@ jobs:
if: github.repository_owner == 'MetOffice'
runs-on: ubuntu-latest

env:
REPO: ${{ github.event.repository.name }}
BUNDLE: pr-${{ github.event.number }}

steps:
- name: checkout current
uses: actions/checkout@v4
Expand Down Expand Up @@ -138,3 +136,62 @@ jobs:
--workdir=/usr/local/src/${REPO}/${BUNDLE} \
--volume ${PWD}/${BUNDLE}:/usr/local/src/${REPO}/${BUNDLE} \
'jcsda/docker-gnu-openmpi-dev:latest'
build3:
name: clang 10.0.0 (JCSDA)
if: github.repository_owner == 'MetOffice'
runs-on: ubuntu-latest

steps:
- name: checkout current
uses: actions/checkout@v4
with:
path: ./${{ env.BUNDLE }}/${{ env.REPO }}
- name: initiate bundle
run: cp ./${{ env.BUNDLE }}/${{ env.REPO }}/ci/* ./${{ env.BUNDLE }}/

- name: checkout jedicmake
uses: actions/checkout@v4
with:
path: ./${{ env.BUNDLE }}/jedicmake
repository: JCSDA-internal/jedi-cmake
submodules: true
token: ${{ secrets.GH_PAT }}

- name: checkout oops
uses: actions/checkout@v4
with:
path: ./${{ env.BUNDLE }}/oops
repository: JCSDA-internal/oops
token: ${{ secrets.GH_PAT }}
- name: matching branch checkout attempt oops ${{ github.head_ref }}
if: github.event_name == 'pull_request'
run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/oops

- name: checkout ioda
uses: actions/checkout@v4
with:
path: ./${{ env.BUNDLE }}/ioda
repository: JCSDA-internal/ioda
token: ${{ secrets.GH_PAT }}
- name: matching branch checkout attempt ioda ${{ github.head_ref }}
if: github.event_name == 'pull_request'
run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/ioda

- name: checkout ufo
uses: actions/checkout@v4
with:
path: ./${{ env.BUNDLE }}/ufo
repository: JCSDA-internal/ufo
token: ${{ secrets.GH_PAT }}
- name: matching branch checkout attempt ufo ${{ github.head_ref }}
if: github.event_name == 'pull_request'
run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/ufo

- name: build and test
run: |
docker run --rm \
--entrypoint=/usr/local/src/${REPO}/${BUNDLE}/build-and-test \
--workdir=/usr/local/src/${REPO}/${BUNDLE} \
--volume ${PWD}/${BUNDLE}:/usr/local/src/${REPO}/${BUNDLE} \
'jcsda/docker-clang-mpich-dev:latest'
16 changes: 9 additions & 7 deletions ci/build-and-test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# (C) Crown Copyright 2023, the Met Office. All rights reserved.
#
set -euxo pipefail
set -euo pipefail

finally() {
trap '' ERR
Expand All @@ -13,34 +13,36 @@ finally() {
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##*/}"
export OMPI_MCA_rmaps_base_oversubscribe=true

trap finally ERR EXIT

cd "${WORKD}"

# If using JCSDA Docker container
# -- 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"
cmake -B . -S "${HERE}" -G "${GENERATOR}" -DCMAKE_BUILD_TYPE=Debug

# -- 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 './opsinputs' --output-on-failure ||\
ctest -j"${NPROC}" --test-dir "${TESTDIR}" || \
env OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 \
ctest --test-dir './opsinputs' --rerun-failed -V
ctest --test-dir "${TESTDIR}" --rerun-failed -V

exit

0 comments on commit ca7c891

Please sign in to comment.