Skip to content

Commit

Permalink
Merge pull request #1 from esmf-org/feature/v1.1
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
uturuncoglu authored Apr 7, 2023
2 parents 141bcf6 + a9f2600 commit 89147e9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ The action mainly includes following features:

## What's New

### v1
### v1.1

* Added caching support for dependency installations, inputs and baseline
* Added support to use `Baseline Change` label for PRs to pass baseline checking against the existing one
* Both driver and component could have multiple `input` section in test definition `.yml` files
* Artifacts name can be given as an argument. This is expecially useful for settin up GitHub Action matrix.
* Minor fix is applied to `get_input.py` script to find `botocore.exceptions`.
* The run step is modified to output ESMF PET logs in case of error in the component testing.
* Default `architecture` is changed from `x86_64_v4` to `x86_64` to make it more generic.

## Usage

Expand All @@ -41,8 +42,9 @@ Create components `.yml` file in your repositories under `.github/workflows/test
### Inputs

* `app_install_dir` - An optional path of installation directory for test configuration. The default value is set to `${{ github.workspace }}/app`.
* `architecture` - An optional value for Spack target architecture. The default value is set to `x86_64_v4`.
* `architecture` - An optional value for Spack target architecture. The default value is set to `x86_64`.
* `artifacts_files` - A optional list of files, directories, and wildcard patterns to save specified files as artifacts. The default value is set to `None` and the action will not save any artifacts after action ends.
* `artifacts_name` - A optional string for artifact name. This is expecially useful for using matix in the component GitHub Action. The default value is set to `artifacts for ${{ github.workflow }}`.
* `artifacts_retention_period` - An optional number to specify artifacts retention period. The default value is set to 2-days.
* `baseline_files` - A optional list of files, directories, and wildcard patterns to be used as a baseline. The default value is set to `None` and the action will not create baseline to check it in later runs.
* `cache_input_file_list` - A optional list of files, directories, and wildcard patterns to cache input files. The default value is set to `None`.
Expand Down Expand Up @@ -93,6 +95,7 @@ jobs:
matrix:
os: [ubuntu-22.04]
test: [test_datm_lnd]
esmf: [develop, 8.5.0b10]

env:
# set token to access gh command
Expand All @@ -107,9 +110,10 @@ jobs:
steps:
# test component
- name: Test Component
uses: esmf-org/nuopc-comp-testing@v1.0.0
uses: esmf-org/nuopc-comp-testing@v1.1.0
with:
app_install_dir: ${{ env.APP_INSTALL_DIR }}
artifacts_name: artifacts for ${{ matrix.test }} ${{ matrix.os }} esmf@${{ matrix.esmf }}
artifacts_files: |
${{ env.APP_INSTALL_DIR }}/run/PET*
${{ env.APP_INSTALL_DIR }}/run/*.txt
Expand All @@ -128,23 +132,24 @@ jobs:
cd ${{ env.APP_INSTALL_DIR }}/noahmp
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=${{ env.APP_INSTALL_DIR }} -DOPENMP=ON ../
cmake -DCMAKE_INSTALL_PREFIX=${{ env.APP_INSTALL_DIR }} ../
make
make install
component_module_name: lnd_comp_nuopc
data_component_name: datm
dependencies: |
[email protected]
[email protected]
[email protected]+parallelio
[email protected]+pnetcdf
esmf@${{ matrix.esmf }}+parallelio~xerces~pnetcdf
[email protected]+pnetcdf
dependencies_install_dir: ${{ env.DEP_INSTALL_DIR }}
test_definition: ${{ env.APP_INSTALL_DIR }}/noahmp/.github/workflows/tests/${{ matrix.test }}.yaml
```
The GitHub Action will run when: (1) direct push to `develop` branch, (2) pull request to `develop` branch and, (3) scheduled on Monday and Friday (required to prevent auto-removing cache entries after 7-days and only runs for default branch) and (4) manually triggered.

The action includes single test called as `test_datm_lnd` but it is also possible to define series of test using different YAML file for test configuration.

The action test the component against two different version of ESMF library (develop branch and 8.5.0b10 tag) as seperate jobs.

##### Top-level YAML file for driver (.github/workflows/tests/test_datm_lnd.yaml)

Expand Down
16 changes: 12 additions & 4 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ inputs:
architecture:
description: spack target architecture
required: false
default: x86_64_v4
default: x86_64
artifacts_files:
description: list of files that will be pushed to artifacts
required: false
default: None
artifacts_name:
description: artifact name
required: false
default: artifacts for ${{ github.workflow }}
artifacts_retention_period:
description: custom retention period for individual artifacts
required: false
Expand Down Expand Up @@ -66,7 +70,7 @@ runs:
sudo apt-get -qq install tar unzip file gringo
sudo apt-get -qq install build-essential binutils-dev gfortran
sudo apt-get -qq install python3-dev python3-pip python3-boto3 python3-yaml
sudo apt-get -qq install wget awscli ca-certificates gh
sudo apt-get -qq install wget awscli ca-certificates gh libxml2-dev
pip3 install --target ~/.local botocore
shell: bash

Expand Down Expand Up @@ -181,13 +185,17 @@ runs:
export PATH=${{ inputs.dependencies_install_dir }}/view/bin:$PATH
cd ${{ inputs.app_install_dir }}/run
mpirun --oversubscribe -np 6 --allow-run-as-root ${{ inputs.app_install_dir }}/build/esmx 2>&1 | tee out_err.txt
shell: bash
if [ $? -ne 0 ]; then
echo "Component did not run successfully! Partial output from PET log files: "
tail -n 50 PET*
fi
shell: bash {0}

# upload model artifacts to check it later
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts for ${{ github.workflow }}
name: ${{ inputs.artifacts_name }}
path: ${{ inputs.artifacts_files }}
retention-days: ${{ inputs.artifacts_retention_period }}

Expand Down
1 change: 1 addition & 0 deletions scripts/get_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import hashlib
import ftplib
import boto3
import botocore.exceptions
from botocore import UNSIGNED
from botocore.client import Config

Expand Down

0 comments on commit 89147e9

Please sign in to comment.