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 CircleCI CI to use Orb #1288

Merged
merged 9 commits into from
Jan 13, 2022
240 changes: 35 additions & 205 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
version: 2.1

executors:
gfortran:
docker:
- image: gmao/ubuntu20-geos-env-mkl:v6.2.8-openmpi_4.0.6-gcc_11.2.0
auth:
username: $DOCKERHUB_USER
password: $DOCKERHUB_AUTH_TOKEN
environment:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
OMPI_MCA_btl_vader_single_copy_mechanism: none
MPIEXEC_PREFLAGS: --oversubscribe
resource_class: large
#MEDIUM# resource_class: medium

ifort:
docker:
- image: gmao/ubuntu20-geos-env:v6.2.8-intelmpi_2021.3.0-intel_2021.3.0
auth:
username: $DOCKERHUB_USER
password: $DOCKERHUB_AUTH_TOKEN
resource_class: large
#MEDIUM# resource_class: medium
orbs:
circleci-tools: geos-esm/circleci-tools@0.5.0

workflows:
build-and-test:
Expand Down Expand Up @@ -78,167 +57,24 @@ workflows:
# - docker-hub-creds #
#####################################################

commands:
versions:
description: "Versions, etc."
parameters:
compiler:
type: string
default: ""
steps:
- run:
name: "Versions, etc."
command: |
mpirun --version && << parameters.compiler >> --version && echo $BASEDIR && pwd && ls && echo "$(nproc)"

compress_artifacts:
description: "Compress artifacts"
steps:
- run:
name: "Compress artifacts"
command: |
gzip -9 /logfiles/*

checkout_fixture:
description: "Checkout fixture"
parameters:
repo:
type: string
default: ""
steps:
- run:
name: "Checkout fixture"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}
git clone https://github.com/GEOS-ESM/<< parameters.repo >>.git

checkout_branch_on_fixture:
description: "Checkout branch on fixture"
parameters:
repo:
type: string
default: ""
branch:
type: string
default: ""
steps:
- run:
name: "Checkout branch on fixture"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >>
git checkout << parameters.branch >>

mepoclone:
description: "Mepo clone external repos"
parameters:
repo:
type: string
default: ""
steps:
- run:
name: "Mepo clone external repos"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >>
mepo clone
mepo status

mepodevelop:
description: "Mepo develop GEOSgcm_GridComp GEOSgcm_App GMAO_Shared"
parameters:
repo:
type: string
default: ""
steps:
- run:
name: "Mepo develop GEOSgcm_GridComp GEOSgcm_App GMAO_Shared"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >>
mepo develop GEOSgcm_GridComp GEOSgcm_App GMAO_Shared
mepo status

cmake:
description: "Run CMake"
parameters:
repo:
type: string
default: ""
compiler:
type: string
default: ""
steps:
- run:
name: "Run CMake"
command: |
mkdir -p /logfiles
cd ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >>
mkdir -p ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
cmake ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >> -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=<< parameters.compiler >> -DCMAKE_BUILD_TYPE=Debug -DUSE_F2PY=OFF -DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS} -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/workspace/install-<< parameters.repo >> |& tee /logfiles/cmake.log

buildinstall:
description: "Build and install"
parameters:
repo:
type: string
default: ""
steps:
- run:
name: "Build and install"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
make -j"$(nproc)" install |& tee /logfiles/make.log || make -j4 install |& tee /logfiles/make-retry.log
#MEDIUM# make -j4 install |& tee /logfiles/make.log

checkout_mapl_branch:
description: "Mepo checkout MAPL branch"
parameters:
repo:
type: string
default: ""
steps:
- run:
name: "Mepo checkout MAPL branch"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >>/src/Shared/@MAPL

# Based a bit on: https://stackoverflow.com/a/55940371/1876449
#
# CIRCLE_PR_NUMBER is only available on forked PRs:
#
# https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables
#
# so if it exists we fetch the PR's branch. This fetch was
# figured out by looking at the MAPL build-and-test above
# which did work!
if [ ! -z "${CIRCLE_PR_NUMBER}" ]; then
git fetch --force origin "${CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}"
fi

mepo checkout ${CIRCLE_BRANCH} MAPL
if [ "${CIRCLE_BRANCH}" != "develop" ] && [ "${CIRCLE_BRANCH}" != "main" ]
then
mepo checkout-if-exists ${CIRCLE_BRANCH}
fi
mepo status

jobs:
build-and-test-MAPL:
parameters:
compiler:
type: string
executor: << parameters.compiler >>
executor: circleci-tools/<< parameters.compiler >>
working_directory: /root/project
steps:
- checkout:
path: MAPL
- versions:
- circleci-tools/versions:
compiler: << parameters.compiler >>
- mepoclone:
- circleci-tools/mepoclone:
repo: MAPL
- cmake:
- circleci-tools/cmake:
repo: MAPL
compiler: << parameters.compiler >>
- buildinstall:
- circleci-tools/buildinstall:
repo: MAPL
- run:
name: "Build MAPL Unit Tests"
Expand All @@ -252,31 +88,25 @@ jobs:
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-MAPL
# skip Performance tests (maybe doable on CircleCI?)
ctest -R MAPL -LE PERFORMANCE --output-on-failure |& tee /logfiles/ctest.log
- compress_artifacts
- circleci-tools/compress_artifacts
- store_artifacts:
path: /logfiles

build-GEOSgcm:
parameters:
compiler:
type: string
executor: << parameters.compiler >>
executor: circleci-tools/<< parameters.compiler >>
working_directory: /root/project
steps:
- checkout_fixture:
repo: GEOSgcm
- mepoclone:
repo: GEOSgcm
- mepodevelop:
repo: GEOSgcm
- checkout_mapl_branch:
repo: GEOSgcm
- cmake:
repo: GEOSgcm
- circleci-tools/checkout_fixture
- circleci-tools/mepoclone
- circleci-tools/mepodevelop
- circleci-tools/checkout_mapl_branch
- circleci-tools/cmake:
compiler: << parameters.compiler >>
- buildinstall:
repo: GEOSgcm
- compress_artifacts
- circleci-tools/buildinstall
- circleci-tools/compress_artifacts
- store_artifacts:
path: /logfiles

Expand All @@ -293,57 +123,57 @@ jobs:
parameters:
compiler:
type: string
executor: << parameters.compiler >>
executor: circleci-tools/<< parameters.compiler >>
working_directory: /root/project
steps:
- checkout_fixture:
- circleci-tools/checkout_fixture:
repo: GEOSldas
- checkout_branch_on_fixture:
- circleci-tools/checkout_branch_on_fixture:
repo: GEOSldas
branch: develop
- mepoclone:
- circleci-tools/mepoclone:
repo: GEOSldas
- checkout_mapl_branch:
- circleci-tools/checkout_mapl_branch:
repo: GEOSldas
- cmake:
- circleci-tools/cmake:
repo: GEOSldas
compiler: << parameters.compiler >>
- buildinstall:
- circleci-tools/buildinstall:
repo: GEOSldas
- compress_artifacts
- circleci-tools/compress_artifacts
- store_artifacts:
path: /logfiles

build-GEOSadas:
parameters:
compiler:
type: string
executor: << parameters.compiler >>
executor: circleci-tools/<< parameters.compiler >>
resource_class: xlarge
working_directory: /root/project
steps:
- checkout_fixture:
- circleci-tools/checkout_fixture:
repo: GEOSadas
- mepoclone:
- circleci-tools/mepoclone:
repo: GEOSadas
- mepodevelop:
- circleci-tools/mepodevelop:
repo: GEOSadas
- checkout_mapl_branch:
- circleci-tools/checkout_mapl_branch:
repo: GEOSadas
- cmake:
- circleci-tools/cmake:
repo: GEOSadas
compiler: << parameters.compiler >>
- buildinstall:
- circleci-tools/buildinstall:
repo: GEOSadas
- compress_artifacts
- circleci-tools/compress_artifacts
- store_artifacts:
path: /logfiles

make-FV3-exp:
parameters:
compiler:
type: string
executor: << parameters.compiler >>
executor: circleci-tools/<< parameters.compiler >>
working_directory: /root/project
steps:
- attach_workspace:
Expand Down Expand Up @@ -388,7 +218,7 @@ jobs:
parameters:
compiler:
type: string
executor: << parameters.compiler >>
executor: circleci-tools/<< parameters.compiler >>
working_directory: /root/project
steps:
- attach_workspace:
Expand All @@ -414,7 +244,7 @@ jobs:
echo "EGRESS not found!"
exit 1
fi
- compress_artifacts
- circleci-tools/compress_artifacts
- store_artifacts:
path: /logfiles

19 changes: 13 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

### Added

### Changed

### Removed

### Deprecated

## [2.16.0] - 2022-01-13

### Fixed

- A bug in splitting the fields for History when an alias contains a single entry (#1296)
- Trap more errors in pFIO
- Free types and operation created by profiler
- Finalize profiler in MAPL_finalize call
- Fix how a retry-build is done in CI
- Fix issue with logger message and single quotes

### Added

### Changed

- Updated README.md
- Refactored MAPL_Generic.F90 - lots of changes.
- consistent indentation (emacs mode)
- extracted helper procedures in GenericInitialize
- Added new step to CircleCI to try and re-run build on failure.

### Removed

### Deprecated
- Updated CircleCI config to use new [GEOS-ESM/circleci-tools orb](https://circleci.com/developer/orbs/orb/geos-esm/circleci-tools)

## [2.15.1] - 2022-01-06

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_policy (SET CMP0054 NEW)

project (
MAPL
VERSION 2.15.1
VERSION 2.16.0
LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF

# Set the default build type to release
Expand Down