-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from esmf-org/feature/v1.2
bring new features
- Loading branch information
Showing
6 changed files
with
109 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,12 +22,14 @@ The action mainly includes following features: | |
|
||
## What's New | ||
|
||
### v1.1 | ||
### v1.2 | ||
|
||
* 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. | ||
* The extra `mpirun` arguments now need to be passed with `mpirun_arg` input argument. | ||
* A new `debug` argument is added to the action that allow to create ssh connection to the runner for debugging (uses mxschmitt/action-tmate@v3). | ||
* Now uses authoritative [Spack repository](https://github.com/spack/spack.git). | ||
* Spack now uses `curl` to download packages and timeout limit is increased to 60 s to prevent fetching issues | ||
* Spack now could use system installed packages (`spack external find`). | ||
* Fixed following issue/s: https://github.com/esmf-org/nuopc-comp-testing/issues/2 | ||
|
||
## Usage | ||
|
||
|
@@ -52,8 +54,10 @@ Create components `.yml` file in your repositories under `.github/workflows/test | |
* `component_build` - The list of shell commands to build the component. This is required since the GitHub Action do not know anything about the component build system and requirements. | ||
* `component_module_name` - The Fortran module name of the component that will be tested. This argument is currently required but it would be a part of the user provided YAML files. | ||
* `data_component_name` - The optional name of data component that will be used to force the component. The valid values are `datm` (default), `dice`, `dlnd`, `docn`, `drof` and `dwav`. It would be a part of the user provided YAML files in the future. | ||
* `debug` - The optional argument for debugging purpose. It triggers extra output and also create ssh connection to the runner for debugging (uses [mxschmitt/action-tmate@v3](https://github.com/mxschmitt/action-tmate)). | ||
* `dependencies` - The list of dependencies that are used to build the application. Since Spack is used to install dependencies, the given packages need to be part of the Spack distribution. The list of packages can be seen in [here](https://packages.spack.io). The ESMF package (`[email protected]+parallelio`) needs to be added to the list. | ||
* `dependencies_install_dir` - An optional path of installation directory for dependencies. The default value is set to `~/.spack-ci`. | ||
* `mpirun_arg` - The required argument to be passed to `mpirun` command. For example `--oversubscribe -np 6 --mca btl_tcp_if_include eth0` can be passed to run test case on 6 processor (`--oversubscribe` is required for the jobs that needs to be run more then 2 processor and `--mca btl_tcp_if_include eth0` is required to overcome hanging issue of collective communication under GitHub runners). | ||
* `test_definition` - The top level YAML file that describes the test. This is required. | ||
|
||
#### Environment Variables | ||
|
@@ -110,7 +114,7 @@ jobs: | |
steps: | ||
# test component | ||
- name: Test Component | ||
uses: esmf-org/nuopc-comp-testing@v1.1.0 | ||
uses: esmf-org/nuopc-comp-testing@v1.2.0 | ||
with: | ||
app_install_dir: ${{ env.APP_INSTALL_DIR }} | ||
artifacts_name: artifacts for ${{ matrix.test }} ${{ matrix.os }} esmf@${{ matrix.esmf }} | ||
|
@@ -138,10 +142,9 @@ jobs: | |
component_module_name: lnd_comp_nuopc | ||
data_component_name: datm | ||
dependencies: | | ||
[email protected] | ||
esmf@${{ matrix.esmf }}+parallelio~xerces~pnetcdf | ||
[email protected]+pnetcdf | ||
esmf@${{ matrix.esmf }}+external-parallelio | ||
dependencies_install_dir: ${{ env.DEP_INSTALL_DIR }} | ||
mpirun_args: --oversubscribe -np 6 --mca btl_tcp_if_include eth0 | ||
test_definition: ${{ env.APP_INSTALL_DIR }}/noahmp/.github/workflows/tests/${{ matrix.test }}.yaml | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,10 @@ inputs: | |
cache_input_file_list: | ||
description: list of input files that needs to be cached | ||
required: false | ||
compiler: | ||
description: compiler that will be used | ||
required: false | ||
default: [email protected] | ||
component_name: | ||
description: component name | ||
required: false | ||
|
@@ -43,13 +47,20 @@ inputs: | |
description: data component name | ||
required: false | ||
default: datm | ||
debug: | ||
description: enable debug capability | ||
required: false | ||
default: OFF | ||
dependencies: | ||
description: list of packages to install | ||
required: true | ||
dependencies_install_dir: | ||
description: spack dependency installation directory | ||
required: false | ||
default: ~/.spack-ci | ||
mpirun_args: | ||
description: atguments that will be used in mpirun command | ||
required: true | ||
test_definition: | ||
description: YAML file that describes the test | ||
required: true | ||
|
@@ -77,9 +88,11 @@ runs: | |
# concretize dependencies | ||
- name: Concretize Spack Environment Using YAML Specification | ||
run: | | ||
echo "${{ inputs.dependencies }}" | ||
$GITHUB_ACTION_PATH/scripts/concretize_deps.sh \ | ||
-a ${{ inputs.architecture }} \ | ||
-d $(echo "${{ inputs.dependencies }}" | awk '$1=$1' RS= OFS=,) \ | ||
-c ${{ inputs.compiler }} \ | ||
-d "$(echo "${{ inputs.dependencies }}" | sed -z 's/\n/:/g' | sed 's/:$//')" \ | ||
-i ${{ inputs.dependencies_install_dir }} \ | ||
-r $GITHUB_WORKSPACE | ||
shell: bash | ||
|
@@ -97,7 +110,8 @@ runs: | |
- name: Install Dependencies with Spack | ||
run: | | ||
$GITHUB_ACTION_PATH/scripts/install_deps.sh \ | ||
-r $GITHUB_WORKSPACE | ||
-i "${{ inputs.dependencies_install_dir }}" \ | ||
-r "$GITHUB_WORKSPACE" | ||
shell: bash | ||
|
||
# checkout data models | ||
|
@@ -179,21 +193,30 @@ runs: | |
python3 $GITHUB_ACTION_PATH/scripts/gen_config.py --ifile ${{ inputs.test_definition }} | ||
shell: bash | ||
|
||
# used to debug run and allow ssh just before running the model | ||
- name: Setup tmate session to allow ssh connection | ||
if: ${{ inputs.debug == 'ON' }} | ||
uses: mxschmitt/action-tmate@v3 | ||
|
||
# run application | ||
- name: Run Application | ||
run: | | ||
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 | ||
if [ $? -ne 0 ]; then | ||
mpirun ${{ inputs.mpirun_args }} ${{ inputs.app_install_dir }}/build/esmx >& out_err.txt | ||
cat out_err.txt | ||
exc=$? | ||
if [ $exc -ne 0 ]; then | ||
echo "Component did not run successfully! Partial output from PET log files: " | ||
tail -n 50 PET* | ||
exit $exc | ||
fi | ||
shell: bash {0} | ||
|
||
# upload model artifacts to check it later | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v3 | ||
if: ${{ always() }} | ||
with: | ||
name: ${{ inputs.artifacts_name }} | ||
path: ${{ inputs.artifacts_files }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# get arguments | ||
while getopts a:d:i:r: flag | ||
while getopts a:c:d:i:r: flag | ||
do | ||
case "${flag}" in | ||
a) arch=${OPTARG};; | ||
d) deps=${OPTARG};; | ||
c) comp=${OPTARG};; | ||
d) deps="${OPTARG}";; | ||
i) install_dir=${OPTARG};; | ||
r) run_dir=${OPTARG};; | ||
esac | ||
|
@@ -30,21 +31,32 @@ if [[ -z "$run_dir" || ! -z `echo $run_dir | grep '^-'` ]]; then | |
fi | ||
|
||
if [[ -z "$arch" || ! -z `echo $arch | grep '^-'` ]]; then | ||
arch="x86_64_v4" | ||
arch="x86_64" | ||
fi | ||
|
||
if [[ -z "$comp" || ! -z `echo $comp | grep '^-'` ]]; then | ||
comp="[email protected]" | ||
fi | ||
|
||
# print out arguments | ||
echo "Target Architecture: $arch" | ||
echo "Compiler: $comp" | ||
echo "Dependencies: $deps"; | ||
echo "Install Directory: $install_dir"; | ||
echo "Run Directory: $run_dir"; | ||
|
||
# go to directory | ||
cd $run_dir | ||
|
||
# checkout spack | ||
# checkout spack and setup to use it | ||
echo "::group::Checkout Spack" | ||
git clone -b jcsda_emc_spack_stack https://github.com/NOAA-EMC/spack.git | ||
git clone https://github.com/spack/spack.git | ||
. spack/share/spack/setup-env.sh | ||
echo "::endgroup::" | ||
|
||
# find compilers | ||
spack compiler find | ||
cat ~/.spack/linux/compilers.yaml | ||
echo "::endgroup::" | ||
|
||
# create spack.yaml | ||
|
@@ -56,30 +68,47 @@ echo " granularity: generic" >> spack.yaml | |
echo " host_compatible: false" >> spack.yaml | ||
echo " unify: when_possible" >> spack.yaml | ||
echo " specs:" >> spack.yaml | ||
IFS=', ' read -r -a array <<< "$deps" | ||
IFS=':' read -r -a array <<< "$deps" | ||
for d in "${array[@]}" | ||
do | ||
echo " - $d target=$arch" >> spack.yaml | ||
echo " - $d %$comp target=$arch" >> spack.yaml | ||
done | ||
echo " packages:" >> spack.yaml | ||
echo " all:" >> spack.yaml | ||
# following is required to build same optimized spack for different github action runners | ||
# spack arch --known-targets command can be used to list known targets | ||
echo " target: ['$arch']" >> spack.yaml | ||
# following fixes compiler version | ||
echo " compiler: [[email protected]]" >> spack.yaml | ||
echo " compiler: [$comp]" >> spack.yaml | ||
echo " view: $install_dir/view" >> spack.yaml | ||
echo " config:" >> spack.yaml | ||
echo " source_cache: $install_dir/source_cache" >> spack.yaml | ||
echo " misc_cache: $install_dir/misc_cache" >> spack.yaml | ||
echo " test_cache: $install_dir/test_cache" >> spack.yaml | ||
echo " install_tree:" >> spack.yaml | ||
echo " root: $install_dir/opt" >> spack.yaml | ||
echo " install_missing_compilers: true" >> spack.yaml | ||
cat spack.yaml | ||
echo "::endgroup::" | ||
|
||
# find external tools | ||
echo "::group::Find Externals" | ||
spack external find | ||
echo "::endgroup::" | ||
|
||
# create config file (to fix FetchError issue) | ||
echo "::group::Create config.yaml" | ||
echo "config:" > ~/.spack/config.yaml | ||
echo " url_fetch_method: curl" >> ~/.spack/config.yaml | ||
echo " connect_timeout: 60" >> ~/.spack/config.yaml | ||
cat ~/.spack/config.yaml | ||
echo "::endgroup::" | ||
|
||
# concretize spack environment | ||
echo "::group::Concretize Spack Environment Using YAML Specification" | ||
. spack/share/spack/setup-env.sh | ||
spack --color always -e $run_dir/. concretize -f | ||
exc=$? | ||
if [ $exc -ne 0 ]; then | ||
echo "Error in concretizing dependencies! exit code is $exc ..." | ||
exit $exc | ||
fi | ||
echo "::endgroup::" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters