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

update ci workflow #35

Merged
merged 13 commits into from
Aug 6, 2024
142 changes: 85 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,139 +1,167 @@
# ci.yml
---
name: CI

on:
pull_request:
branches: [develop]

concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/develop' }}

env:
REPO: ${{ github.event.repository.name }}
BUNDLE: pr-${{ github.event.number }}
PR: pr-${{ github.event.number }}
GH_TOKEN: ${{ secrets.GH_PAT }}


jobs:
jobs:
build1:
if: github.repository_owner == 'MetOffice'
name: gnu 11.3.1 (UKMO)
if: |
( github.repository_owner == 'MetOffice' && github.event.pull_request.draft == false )
name: gnu-openmpi (UKMO)
runs-on: jedi-self-hosted-rg

steps:
- name: pre-submit cleanup
steps:
- name: Pre-submit cleanup
run: |
rm -fr ./${{ env.PR }} || true
ls -la ./
rm -fr ./${{ env.BUNDLE }} || true
ls -la ./
- name: checkout current
- name: Checkout ${{ env.REPO }}
uses: actions/checkout@v4
with:
path: ./${{ env.BUNDLE }}/${{ env.REPO }}
- name: initiate bundle
run: cp ./${{ env.BUNDLE }}/${{ env.REPO }}/ci/* ./${{ env.BUNDLE }}/
path: ./${{ env.PR }}/${{ env.REPO }}
- name: Initiate bundle
working-directory: ./${{ env.PR }}
run: ln -sf ./${{ env.REPO }}/ci/* .

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

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

- name: build and test
- name: Build and Test
env:
MOBB_DATA: ${{ github.workspace }}/MOBB_DATA
WORKDIR: /var/tmp/${{ env.REPO }}/${{ env.PR }}
MOBB_DATA: /var/tmp/mobb-data
shell: bash
run: |
az acr login --name ngmssboxjediacr
ln -sfT /testdata/model-interface-data ${MOBB_DATA}
az acr login --name ngmssboxjediacr
ln -sf /testdata/mobb-data -t ${{ github.workspace }}

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} \
--volume ${MOBB_DATA}:/var/tmp/MOBB_DATA \
'ngmssboxjediacr.azurecr.io/jedibase:alma9' \
&& rm -fr ${{ github.workspace }}/${{ env.BUNDLE }}
--name ${REPO}_${PR}_${GITHUB_SHA::7} \
--volume ${{ github.workspace }}/${PR}:${WORKDIR} \
--volume ${{ github.workspace }}/mobb-data:${MOBB_DATA} \
--env MOBB_DATA=${MOBB_DATA} \
--env CI_TESTS=1 \
--workdir=${WORKDIR} \
--entrypoint=${WORKDIR}/build-and-test.sh \
'ngmssboxjediacr.azurecr.io/jedibase:alma9'

- name: Cleanup
working-directory: ${{github.workspace}}
run: rm -fr ${{ env.PR }} || true


build2:
if: '! github.event.pull_request.draft'
name: gnu 9.4.0 (JCSDA)
if: |
( github.repository_owner == 'MetOffice' && github.event.pull_request.draft == false )
name: gnu-openmpi (JCSDA)
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 }}/
path: ./${{ env.PR }}/${{ env.REPO }}
- name: Initiate bundle
run: cp ./${{ env.PR }}/${{ env.REPO }}/ci/* ./${{ env.PR }}/

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

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

- name: Build and Lint
env:
WORKDIR: /usr/local/src/${{ env.REPO }}/${{ env.PR }}

- name: build and lint
run: |
docker run --rm \
--entrypoint=/usr/local/src/${REPO}/${BUNDLE}/build-and-lint \
--workdir=/usr/local/src/${REPO}/${BUNDLE} \
--volume ${PWD}/${BUNDLE}:/usr/local/src/${REPO}/${BUNDLE} \
--volume ${PWD}/${PR}:${WORKDIR} \
--env CI_TESTS=0 \
--workdir=${WORKDIR} \
--entrypoint=${WORKDIR}/build-and-test.sh \
'jcsda/docker-gnu-openmpi-dev:latest'

build3:
if: '! github.event.pull_request.draft'
name: clang 10.0.0 (JCSDA)
if: |
( github.repository_owner == 'MetOffice' && github.event.pull_request.draft == false )
name: clang-mpich (JCSDA)
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 }}/
path: ./${{ env.PR }}/${{ env.REPO }}
- name: initiate PR
run: cp ./${{ env.PR }}/${{ env.REPO }}/ci/* ./${{ env.PR }}/

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

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

- name: Build and Lint
env:
WORKDIR: /usr/local/src/${{ env.REPO }}/${{ env.PR }}

- name: build and lint
run: |
docker run --rm \
--entrypoint=/usr/local/src/${REPO}/${BUNDLE}/build-and-lint \
--workdir=/usr/local/src/${REPO}/${BUNDLE} \
--volume ${PWD}/${BUNDLE}:/usr/local/src/${REPO}/${BUNDLE} \
--volume ${PWD}/${PR}:${WORKDIR} \
--env CI_TESTS=0 \
--workdir=${WORKDIR} \
--entrypoint=${WORKDIR}/build-and-test.sh \
'jcsda/docker-clang-mpich-dev:latest'
14 changes: 7 additions & 7 deletions ci/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
###############################################################################
# MONIO - Met Office NetCDF Input Output #
# #
# (C) Crown Copyright 2023, Met Office. All rights reserved. #
# (C) Crown Copyright 2024, Met Office. All rights reserved. #
# #
# This software is licensed under the terms of the 3-Clause BSD License #
# which can be obtained from https://opensource.org/license/bsd-3-clause/. #
###############################################################################

cmake_minimum_required( VERSION 3.20 FATAL_ERROR )

cmake_minimum_required( VERSION 3.21 FATAL_ERROR )
project( monio-ci VERSION 0.0.1 LANGUAGES C CXX Fortran )

set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS OFF )
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")
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}/oops")
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/oops" EXCLUDE_FROM_ALL)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/monio")

include(CTest)
enable_testing()
53 changes: 0 additions & 53 deletions ci/build-and-lint

This file was deleted.

54 changes: 0 additions & 54 deletions ci/build-and-test

This file was deleted.

Loading