diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4ea826d..ce1e6b78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,10 @@ 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 }} @@ -16,21 +20,20 @@ jobs: name: gnu 11.3.1 (UKMO) if: github.repository_owner == 'MetOffice' runs-on: jedi-self-hosted-rg - + steps: - - name: pre-submit cleanup + - name: Pre-submit cleanup run: | - ls -la ./ rm -fr ./${{ env.BUNDLE }} || true - ls -la ./ - - name: checkout current + ls -lgo ./ + - name: Checkout current uses: actions/checkout@v4 with: path: ./${{ env.BUNDLE }}/${{ env.REPO }} - - name: initiate bundle + - name: Initiate bundle run: cp ./${{ env.BUNDLE }}/${{ env.REPO }}/ci/* ./${{ env.BUNDLE }}/ - - name: checkout jedicmake + - name: Checkout jedicmake uses: actions/checkout@v4 with: path: ./${{ env.BUNDLE }}/jedicmake @@ -38,45 +41,48 @@ jobs: submodules: true token: ${{ secrets.GH_PAT }} - - name: checkout oops + - 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 }} + - name: Checkout attempt for oops@${{ github.head_ref }} if: github.event_name == 'pull_request' run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/oops - - name: checkout ioda + - 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 }} + - name: Checkout attempt for ioda@${{ github.head_ref }} if: github.event_name == 'pull_request' run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/ioda - - name: checkout ufo + - 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 }} + - name: Checkout attempt for ufo@${{ github.head_ref }} if: github.event_name == 'pull_request' run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/ufo - - name: build and test + - name: Build and Test run: | az acr login --name ngmssboxjediacr 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} \ - 'ngmssboxjediacr.azurecr.io/jedibase:alma9' \ - && rm -fr ${{github.workspace}}/${{env.BUNDLE}} + 'ngmssboxjediacr.azurecr.io/jedibase:alma9' + + - name: Cleanup workspace + working-directory: ${{github.workspace}} + run: rm -fr ${{ env.BUNDLE }} || true build2: name: gnu 9.4.0 (JCSDA) @@ -84,14 +90,14 @@ jobs: runs-on: ubuntu-latest steps: - - name: checkout current + - 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 + - name: Checkout jedicmake uses: actions/checkout@v4 with: path: ./${{ env.BUNDLE }}/jedicmake @@ -99,33 +105,33 @@ jobs: submodules: true token: ${{ secrets.GH_PAT }} - - name: checkout oops + - 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 }} + - name: Checkout attempt for oops@${{ github.head_ref }} if: github.event_name == 'pull_request' run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/oops - - name: checkout ioda + - 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 }} + - name: Checkout attempt for ioda@${{ github.head_ref }} if: github.event_name == 'pull_request' run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/ioda - - name: checkout ufo + - 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 }} + - name: Checkout attempt for ufo@${{ github.head_ref }} if: github.event_name == 'pull_request' run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/ufo @@ -143,14 +149,14 @@ jobs: runs-on: ubuntu-latest steps: - - name: checkout current + - 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 + - name: Checkout jedicmake uses: actions/checkout@v4 with: path: ./${{ env.BUNDLE }}/jedicmake @@ -158,37 +164,37 @@ jobs: submodules: true token: ${{ secrets.GH_PAT }} - - name: checkout oops + - 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 }} + - name: Checkout attempt for oops@${{ github.head_ref }} if: github.event_name == 'pull_request' run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/oops - - name: checkout ioda + - 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 }} + - name: Checkout attempt for ioda@${{ github.head_ref }} if: github.event_name == 'pull_request' run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/ioda - - name: checkout ufo + - 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 }} + - name: Checkout attempt for ufo@${{ github.head_ref }} if: github.event_name == 'pull_request' run: ./${{ env.BUNDLE }}/get-ref-branch ./${{ env.BUNDLE }}/ufo - - name: build and test + - name: Build and Test run: | docker run --rm \ --entrypoint=/usr/local/src/${REPO}/${BUNDLE}/build-and-test \ diff --git a/ci/CMakeLists.txt b/ci/CMakeLists.txt index f1f0decc..c5874cf5 100644 --- a/ci/CMakeLists.txt +++ b/ci/CMakeLists.txt @@ -7,6 +7,8 @@ project( opsinputs-ci VERSION 0.1 LANGUAGES C CXX Fortran ) set( ENABLE_MPI ON CACHE BOOL "Compile with MPI" ) set( ENABLE_OMP ON CACHE BOOL "Compile with OpenMP" ) +option(ENABLE_IODA_DATA "Obtain ioda test data from ioda-data repository (vs tarball)" ON) +option(ENABLE_UFO_DATA "Obtain ufo test data from ufo-data repository (vs tarball)" ON) add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/jedicmake") if(NOT DEFINED jedicmake_DIR) diff --git a/ci/build-and-test b/ci/build-and-test index 975c5c93..81b94676 100755 --- a/ci/build-and-test +++ b/ci/build-and-test @@ -2,6 +2,8 @@ # # (C) Crown Copyright 2023, the Met Office. All rights reserved. # +# shellcheck disable=SC2317 +# shellcheck source=/dev/null set -euo pipefail finally() { @@ -11,6 +13,10 @@ finally() { cd / rm -fr "${WORKD}" fi + if [[ -d ${BASE:-} ]]; then + cd / + rm -fr "$BASE" 2>/dev/null || true + fi } # -- HERE is /usr/local/src//pr-<#> (cf ../.github/workflow/ci.yml)