Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial CI implementation #55

Merged
merged 18 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

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

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout current repo
uses: actions/checkout@v3
with:
lfs: true

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

- name: checkout oops
uses: actions/checkout@v3
with:
path: ci/oops
repository: JCSDA-internal/oops
token: ${{ secrets.GH_PAT }}

- name: checkout ioda
uses: actions/checkout@v3
with:
path: ci/ioda
repository: JCSDA-internal/ioda
token: ${{ secrets.GH_PAT }}

- name: checkout ufo
uses: actions/checkout@v3
with:
path: ci/ufo
repository: JCSDA-internal/ufo
token: ${{ secrets.GH_PAT }}

- name: checkout atlas-orca
uses: actions/checkout@v3
with:
path: ci/atlas-orca
repository: ECMWF/atlas-orca

- name: checkout atlas-data
uses: actions/checkout@v3
with:
path: ci/atlas-data
repository: MetOffice/atlas-data
lfs: true
token: ${{ secrets.GH_PAT }}

- name: build and test
run: |
docker run --rm \
--entrypoint=/usr/local/src/orca-jedi/ci/build-and-test.sh \
--workdir=/usr/local/src/orca-jedi/ci \
--volume $PWD:/usr/local/src/orca-jedi \
'jcsda/docker-gnu-openmpi-dev:latest'
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. image:: https://github.com/MetOffice/orca-jedi/actions/workflows/ci.yml/badge.svg

orca-jedi
=========

Expand Down
23 changes: 23 additions & 0 deletions ci/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# (C) Copyright 2022 Met Office
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.

cmake_minimum_required( VERSION 3.18 FATAL_ERROR )

project( orca-jedi-ci VERSION 1.0 LANGUAGES C CXX Fortran )

set( ENABLE_MPI ON CACHE BOOL "Compile with MPI" )
set( ENABLE_OMP ON CACHE BOOL "Compile with OpenMP" )

add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/jedicmake" EXCLUDE_FROM_ALL)
if(NOT DEFINED jedicmake_DIR)
set(jedicmake_DIR "${CMAKE_BINARY_DIR}/jedicmake")
endif()

add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/atlas-orca" EXCLUDE_FROM_ALL)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/oops" EXCLUDE_FROM_ALL)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ioda" EXCLUDE_FROM_ALL)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ufo" EXCLUDE_FROM_ALL)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/orca-jedi")
enable_testing()
55 changes: 55 additions & 0 deletions ci/build-and-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
set -euo pipefail

finally() {
trap '' ERR
trap '' EXIT
if [[ -d "${WORKD:-}" ]]; then
cd /
rm -fr "${WORKD}"
fi
}

HERE="$(cd "$(dirname "$0")" && pwd)"
THIS="$(basename "$0")"
NPROC=${NPROC:-2}
WORKD="$(mktemp -d "${THIS}-XXXXXX" -t)"

trap finally ERR
trap finally EXIT

cd "${WORKD}"

source /opt/spack-environment/activate.sh

echo "
-------------------------------
gcc version $(gcc -dumpversion ||:)
$(ecbuild --version ||:)
atlas version $(atlas --version ||:)
eckit version $(eckit-version ||:)
ectrans version $(ectrans --version ||:)
fckit version $(fckit --version ||:)
fiat version $(fiat --version ||:)
lz4 version $(lz4 --version ||:)
odc version $(odc --version ||:)
-------------------------------
"

rm -f "${HERE}/orca-jedi"
ln -s '..' "${HERE}/orca-jedi"
ecbuild -S "${HERE}"
make -j "${NPROC}"

if [[ ! -f share/plugins/atlas-orca.yml ]]; then
echo "ERROR atlas-orca.yml not found!" | tee >(cat >&2)
exit 1
fi

env OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 \
ATLAS_TRACE=1 ATLAS_DEBUG=1 \
LD_LIBRARY_PATH="${HERE}/lib:${LD_LIBRARY_PATH}" \
ATLAS_DATA_PATH="${HERE}/atlas-data" \
ctest -j "${NPROC}" -V --output-on-failure --test-dir "./orca-jedi"

exit
2 changes: 1 addition & 1 deletion src/tests/orca-jedi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ecbuild_add_test( TARGET test_orcajedi_nemo_io_field_reader.x
LIST( APPEND ATLAS_TEST_ENVIRONMENT
ATLAS_ORCA_CACHING=1
ATLAS_CACHE_PATH=${CMAKE_BINARY_DIR}/share
PLUGINS_MANIFEST_PATH=${CMAKE_BINARY_DIR}/atlas-orca/share/plugins )
PLUGINS_MANIFEST_PATH=${CMAKE_BINARY_DIR}/share/plugins )

ecbuild_add_test( TARGET test_orcajedi_nemo_io_field_writer.x
SOURCES test_nemo_io_field_writer.cc
Expand Down