From 078c49ab1f46c78dbbcfc50ff9e7f9e1d59e4d29 Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Thu, 21 Jan 2021 09:36:40 -0800 Subject: [PATCH] Add Github Actions test-cice.yml script (#555) * add Github Actions test-cice.yml script * Update README.md Co-authored-by: Philippe Blain --- .github/workflows/test-cice.yml | 135 +++++++++++++++++++++++++++ .github/workflows/write_logfiles.csh | 10 ++ README.md | 3 +- 3 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-cice.yml create mode 100755 .github/workflows/write_logfiles.csh diff --git a/.github/workflows/test-cice.yml b/.github/workflows/test-cice.yml new file mode 100644 index 000000000..1fdd8188d --- /dev/null +++ b/.github/workflows/test-cice.yml @@ -0,0 +1,135 @@ +name: GHActions + +# This workflow is triggered on pushes, pull-requeust, and releases +# ghactions* branch names will trigger this to support development testing +# To Do: get it working with bash and ubuntu + +on: + push: + branches: + - master + - 'CICE*' + - 'ghactions*' + pull_request: + release: + types: + - created + +defaults: + run: + shell: /bin/csh {0} + +jobs: + build: + name: "CICETesting" + runs-on: ${{ matrix.os }} + strategy: + matrix: +# os: [macos-latest, ubuntu-latest] + os: [macos-latest] +# os: [ubuntu-latest] + include: + - os: macos-latest + envdef: macos + minicond: Miniconda3-latest-MacOSX-x86_64.sh +# - os: ubuntu-latest +# envdef: linux +# minicond: Miniconda3-latest-Linux-x86_64.sh + steps: + - name: reset macos toolchain to commandlinetools + shell: /bin/bash {0} + if: contains( matrix.envdef, 'macos') + run: | + sudo xcode-select -r + sudo xcode-select -s /Library/Developer/CommandLineTools + echo "xcrun --show-sdk-path: $(xcrun --show-sdk-path)" + echo "xcode-select -p: $(xcode-select -p)" + - name: system info + shell: /bin/bash {0} + run: | + type wget + type curl + type csh + echo "readlink \$(which csh): $(python -c 'import os, sys; print os.path.realpath(sys.argv[1])' $(which csh))" + echo "csh --version: $(csh --version)" + echo "uname -a: $(uname -a)" + echo "sw_vers: $(sw_vers)" + echo "HOME: $HOME" + echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE" + echo "OS: ${{ matrix.os }}" + echo "ENVDEF: ${{ matrix.envdef }}" + echo "MINICOND: ${{ matrix.minicond }}" + - name : install miniconda + shell: /bin/bash {0} + run: | + wget https://repo.anaconda.com/miniconda/${{ matrix.minicond }} -O ~/miniconda.sh + bash ~/miniconda.sh -b -p $HOME/miniconda + - name: clone + uses: actions/checkout@v2 + with: + submodules: 'recursive' + - name: link + run: | + ln -s ${GITHUB_WORKSPACE}/../CICE ${HOME}/cice +# ls -al ${HOME}/ +# ls -al ${GITHUB_WORKSPACE}/ + - name: setup conda env + shell: /bin/bash {0} + run: | + cd $HOME && mkdir -p cice-dirs/runs cice-dirs/baseline cice-dirs/input + source $HOME/miniconda/bin/activate + conda init tcsh + cd $HOME/cice + conda env create -f configuration/scripts/machines/environment.yml + - name: check conda env + run: | + conda activate cice && which mpicc && which mpifort && which make + mpifort --version + mpicc --version + make --version + - name: check setup case + run: | + cd $HOME/cice + ./cice.setup -m conda -e ${{ matrix.envdef }} -c case0 --pes 1x1 -s diag1 + - name: check setup test + run: | + cd $HOME/cice + ./cice.setup -m conda -e ${{ matrix.envdef }} --test smoke --testid c0 +# - name: compile case +# run: | +# cd $HOME/cice +# ./cice.setup -m conda -e ${{ matrix.envdef }} -c case1 +# cd case1 +# ./cice.build + - name: download input data + run: | + cd $HOME/cice-dirs/input + wget https://zenodo.org/record/3728358/files/CICE_data_gx3_grid_ic-20200320.tar.gz && tar xvfz CICE_data_gx3_grid_ic-20200320.tar.gz + wget https://zenodo.org/record/3728362/files/CICE_data_gx3_forcing_NCAR_bulk-20200320.tar.gz && tar xvfz CICE_data_gx3_forcing_NCAR_bulk-20200320.tar.gz + wget https://zenodo.org/record/3728364/files/CICE_data_gx3_forcing_JRA55-20200320.tar.gz && tar xvfz CICE_data_gx3_forcing_JRA55-20200320.tar.gz + pwd + ls -alR +# - name: run case +# run: | +# cd $HOME/cice +# cd case1 +# ./cice.run + - name: run suite + run: | + cd $HOME/cice + ./cice.setup -m conda -e ${{ matrix.envdef }} --suite travis_suite --testid ${{ matrix.os }} + - name: write output + run: | + cd $HOME/cice + ./.github/workflows/write_logfiles.csh + cd testsuite.${{ matrix.os }} + ./results.csh + - name: successful run + if: ${{ success() }} + run: | + echo "${{ job.name }} PASSED" + - name: trap failure + if: ${{ failure() }} + run: | + echo "${{ job.name }} FAILED" + exit 99 diff --git a/.github/workflows/write_logfiles.csh b/.github/workflows/write_logfiles.csh new file mode 100755 index 000000000..a6777dec6 --- /dev/null +++ b/.github/workflows/write_logfiles.csh @@ -0,0 +1,10 @@ +#!/bin/csh + +#echo "hello" + +foreach logfile (case*/logs/cice.runlog* testsuite.*/*/logs/cice.runlog*) + echo "### ${logfile} ###" + tail -20 $logfile + echo " " +end + diff --git a/README.md b/README.md index a584e8ac9..457714b8a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -[![Build Status](https://travis-ci.org/CICE-Consortium/CICE.svg?branch=master)](https://travis-ci.org/CICE-Consortium/CICE) +[![Travis-CI](https://travis-ci.org/CICE-Consortium/CICE.svg?branch=master)](https://travis-ci.org/CICE-Consortium/CICE) +[![GHActions](https://github.com/CICE-Consortium/CICE/workflows/GHActions/badge.svg)](https://github.com/CICE-Consortium/CICE/actions) [![Documentation Status](https://readthedocs.org/projects/cice-consortium-cice/badge/?version=master)](http://cice-consortium-cice.readthedocs.io/en/master/?badge=master) [![lcov](https://img.shields.io/endpoint?url=https://apcraig.github.io/coverage.json)](https://apcraig.github.io)