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

Add TEST_FILE_DIR option to CMake build, where test data files can be found instead of using FTP. Use this in all CI runs to cache data. #732

Merged
merged 64 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
7a6e5cf
adding developer workflow
edwardhartnett Dec 11, 2022
e07f579
working on developer workflow
edwardhartnett Dec 11, 2022
bbb9b96
working on developer workflow
edwardhartnett Dec 11, 2022
de034d3
working on developer workflow
edwardhartnett Dec 11, 2022
5f0f0c4
more changes
edwardhartnett Dec 11, 2022
b9f458f
more changes
edwardhartnett Dec 11, 2022
7c30a80
more changes
edwardhartnett Dec 11, 2022
51e7ac1
more changes
edwardhartnett Dec 11, 2022
ac6aefd
more changes
edwardhartnett Dec 11, 2022
e171884
more
edwardhartnett Dec 12, 2022
1cffa1a
more
edwardhartnett Dec 12, 2022
b86a6e8
addding debug2
edwardhartnett Dec 12, 2022
b3801ad
addding debug2
edwardhartnett Dec 12, 2022
80891bc
addding debug2
edwardhartnett Dec 12, 2022
354b4f6
more
edwardhartnett Dec 12, 2022
ca86d6f
more
edwardhartnett Dec 12, 2022
504f690
more
edwardhartnett Dec 12, 2022
74b7422
more
edwardhartnett Dec 12, 2022
f8042cf
more
edwardhartnett Dec 12, 2022
b964da7
more
edwardhartnett Dec 12, 2022
08463b5
more
edwardhartnett Dec 12, 2022
59692f5
more
edwardhartnett Dec 12, 2022
058d515
more
edwardhartnett Dec 12, 2022
dfb675e
more
edwardhartnett Dec 12, 2022
924ae49
more
edwardhartnett Dec 12, 2022
ba6bb5c
more
edwardhartnett Dec 12, 2022
a41d195
more
edwardhartnett Dec 12, 2022
c9ce62b
more
edwardhartnett Dec 12, 2022
943e67e
more
edwardhartnett Dec 12, 2022
ca1c232
more
edwardhartnett Dec 12, 2022
d23fb34
more
edwardhartnett Dec 12, 2022
0da10b5
more
edwardhartnett Dec 12, 2022
3790db2
more
edwardhartnett Dec 12, 2022
d3280d8
more
edwardhartnett Dec 12, 2022
c271e78
adding cmake option for local directory for test data
edwardhartnett Dec 12, 2022
0361760
adding data cache to developer CI
edwardhartnett Dec 12, 2022
76d7451
Merge branch 'develop' into ejh_ci_2
edwardhartnett Dec 12, 2022
15871c7
adding data cache to developer CI
edwardhartnett Dec 12, 2022
33656e1
Merge branch 'ejh_ci_2' of github.com:ufs-community/UFS_UTILS into ej…
edwardhartnett Dec 12, 2022
79c49fd
adding data cache to developer CI
edwardhartnett Dec 12, 2022
0f955c6
adding data cache to developer CI
edwardhartnett Dec 12, 2022
a19d64d
adding data cache to developer CI
edwardhartnett Dec 12, 2022
2a489c0
adding data cache to developer CI
edwardhartnett Dec 12, 2022
e8b27dd
adding data cache to developer CI
edwardhartnett Dec 12, 2022
489f0cb
adding data cache to developer CI
edwardhartnett Dec 12, 2022
4a21509
checking data cache to developer CI
edwardhartnett Dec 12, 2022
4228798
checking data cache to developer CI
edwardhartnett Dec 13, 2022
1f4c93b
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
569d973
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
e01edd3
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
2692688
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
04f9f6d
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
8128595
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
4f2ef1f
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
706410e
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
79807de
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
1afaceb
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
80d054f
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
1b2ba36
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
cfafe1b
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
0362ef2
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
1920645
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
02ed98d
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
3f632f3
turning on data cache in all workflows
edwardhartnett Dec 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/debug-docs-test_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ jobs:
path: ufs_utils
submodules: recursive

- name: cache-data
id: cache-data
uses: actions/cache@v2
with:
path: ~/data
key: data-1

- name: build
run: |
export ESMFMKFILE=~/esmf/lib/esmf.mk
Expand All @@ -109,7 +116,7 @@ jobs:
export CXX=mpicxx
export FC=mpifort
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64"
cmake .. -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs' -DCMAKE_BUILD_TYPE=Debug -DENABLE_DOCS=On -DCMAKE_Fortran_FLAGS="-g -fprofile-arcs -ftest-coverage -O0"
cmake -DTEST_FILE_DIR=/home/runner/data -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs' -DCMAKE_BUILD_TYPE=Debug -DENABLE_DOCS=On ..
make -j2

- name: test
Expand Down
26 changes: 22 additions & 4 deletions .github/workflows/developer.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# UFS_UTILS test workflow.
#
# This workflow tests all developer options - address santizer,
# warning check, documentation check, and test code coverage.
# This workflow tests all developer options including
# documentation check, and test code coverage.
#
# Ed Hartnett 12/11/22
name: developer
Expand Down Expand Up @@ -326,15 +326,21 @@ jobs:
path: ufs_utils
submodules: true

- name: cache-data
id: cache-data
uses: actions/cache@v2
with:
path: ~/data
key: data-1

- name: build
run: |
set -x
cd ufs_utils
mkdir build
doxygen --version
export ESMFMKFILE=~/esmf/lib/esmf.mk
cd build
cmake .. -DFTP_TEST_FILES=ON -DTEST_FILE_DIR=/home/runner/data -DENABLE_DOCS=On -DJasper_ROOT=~/jasper -DCMAKE_PREFIX_PATH="~/g2c;~/bacio;~/g2;~/w3nco;~/sfcio;~/sigio;~/nemsio;~/sp;~/ip" -DCMAKE_Fortran_FLAGS="-g -fprofile-arcs -ftest-coverage -O0" -DCMAKE_C_FLAGS="-g -fprofile-arcs -ftest-coverage -O0" -DCMAKE_BUILD_TYPE=Debug
cmake -DTEST_FILE_DIR=/home/runner/data -DENABLE_DOCS=On -DCMAKE_PREFIX_PATH="~/jasper;~/g2c;~/bacio;~/g2;~/w3nco;~/sfcio;~/sigio;~/nemsio;~/sp;~/ip" -DCMAKE_Fortran_FLAGS="-g -fprofile-arcs -ftest-coverage -O0" -DCMAKE_C_FLAGS="-g -fprofile-arcs -ftest-coverage -O0" -DCMAKE_BUILD_TYPE=Debug ..
make -j2 VERBOSE=1

- name: test
Expand All @@ -343,6 +349,18 @@ jobs:
ctest --verbose --rerun-failed --output-on-failure
gcovr --root .. -v --html-details --exclude ../tests --exclude CMakeFiles --print-summary -o test-coverage.html &> /dev/null

- name: cache-data
if: steps.cache-data.outputs.cache-hit != 'true'
run: |
mkdir ~/data
cp ufs_utils/build/tests/chgres_cube/data/* ~/data
cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data
cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data
cp ufs_utils/tests/filter_topo/data/* ~/data
cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data
cp ufs_utils/tests/chgres_cube/data/* ~/data
ls -l ~/data

- name: upload-test-coverage
uses: actions/upload-artifact@v2
with:
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- README.md

# Use custom shell with -l so .bash_profile is sourced which loads intel/oneapi/setvars.sh
# without having to do it in manually every step
# without having to do it in manually every step.
defaults:
run:
shell: bash -leo pipefail {0}
Expand Down Expand Up @@ -166,16 +166,36 @@ jobs:
path: ufs_utils
submodules: recursive

- name: cache-data
id: cache-data
uses: actions/cache@v2
with:
path: ~/data
key: data-1

- name: build
run: |
export ESMFMKFILE=~/esmf/lib/esmf.mk
cd ufs_utils
mkdir build && cd build
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64"
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH='~;~/jasper;~/nceplibs;~/netcdf'
cmake -DTEST_FILE_DIR=/home/runner/data -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH='~;~/jasper;~/nceplibs;~/netcdf' ..
make -j2

- name: test
run: |
cd ufs_utils/build
ctest --rerun-failed --output-on-failure

- name: cache-data
if: steps.cache-data.outputs.cache-hit != 'true'
run: |
mkdir ~/data
cp ufs_utils/build/tests/chgres_cube/data/* ~/data
cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data
cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data
cp ufs_utils/tests/filter_topo/data/* ~/data
cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data
cp ufs_utils/tests/chgres_cube/data/* ~/data
ls -l ~/data

22 changes: 21 additions & 1 deletion .github/workflows/linux-mac-nceplibs-mpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ jobs:
path: ufs_utils
submodules: recursive

- name: cache-data
id: cache-data
uses: actions/cache@v2
with:
path: ~/data
key: data-2

- name: build
run: |
export ESMFMKFILE=~/esmf/lib/esmf.mk
Expand All @@ -227,7 +234,7 @@ jobs:
export FC=mpifort
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64"
export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64"
cmake .. -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs;~/netcdf'
cmake -DTEST_FILE_DIR=/home/runner/data -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs;~/netcdf' ..
make -j2

- name: test
Expand All @@ -236,3 +243,16 @@ jobs:
# Oversubscribe for OpenMPI to run more processes than CPUs
export OMPI_MCA_rmaps_base_oversubscribe=1
ctest --rerun-failed --output-on-failure

- name: cache-data
if: steps.cache-data.outputs.cache-hit != 'true'
run: |
mkdir ~/data
cp ufs_utils/build/tests/chgres_cube/data/* ~/data
cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data
cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data
cp ufs_utils/tests/filter_topo/data/* ~/data
cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data
cp ufs_utils/tests/chgres_cube/data/* ~/data
ls -l ~/data

23 changes: 22 additions & 1 deletion .github/workflows/netcdf-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ jobs:
path: ufs_utils
submodules: recursive

- name: cache-data
id: cache-data
uses: actions/cache@v2
with:
path: ~/data
key: data-1

- name: build
run: |
export ESMFMKFILE=~/esmf/lib/esmf.mk
Expand All @@ -160,11 +167,25 @@ jobs:
export CXX=mpicxx
export FC=mpifort
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64"
cmake .. -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs;~/netcdf' -DCMAKE_BUILD_TYPE=Debug
cmake -DTEST_FILE_DIR=/home/runner/work/UFS_UTILS/UFS_UTILS/data -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs;~/netcdf' -DCMAKE_BUILD_TYPE=Debug ..
make -j2

- name: test
run: |
cd ufs_utils/build
# export LSAN_OPTIONS=suppressions=LSanSuppress.supp
ctest --rerun-failed --output-on-failure

- name: cache-data
if: steps.cache-data.outputs.cache-hit != 'true'
run: |
mkdir ~/data
cp ufs_utils/build/tests/chgres_cube/data/* ~/data
cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data
cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data
cp ufs_utils/tests/filter_topo/data/* ~/data
cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data
cp ufs_utils/tests/chgres_cube/data/* ~/data
ls -l ~/data


2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# User options.
option(OPENMP "use OpenMP threading" ON)
option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF)
SET(TEST_FILE_DIR "." CACHE STRING "Check this directory for test files before using FTP.")

# Set the build type.
if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$")
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE
Expand Down
24 changes: 17 additions & 7 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,29 @@
#
# Ed Hartnett 2/11/21

# This function is used to download unit test data.
# It takes two arguments, the URL and the file to
# be downloaded.

# Some test files are large and are kept on the NOAA EMC FTP
# site. This function is used to download such test data. It takes two
# arguments, the URL and the file to be downloaded.
function(PULL_DATA THE_URL THE_FILE)
# If the TEST_FILE_DIR was specified, look for our test data files
# there before FTPing them. Developers can keep all test files on
# their machines, and save the time of downloading them every time.
message(STATUS "TEST_FILE_DIR ${TEST_FILE_DIR} THE_FILE ${THE_FILE}")
if(NOT ${TEST_FILE_DIR} STREQUAL ".")
if (EXISTS ${TEST_FILE_DIR}/${THE_FILE})
message(STATUS "Copying file ${TEST_FILE_DIR}/${THE_FILE} to test data directory.")
FILE(COPY ${TEST_FILE_DIR}/${THE_FILE}
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/data)
endif()
endif()
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/data/${THE_FILE}")
message(STATUS "Downloading file ${CMAKE_CURRENT_BINARY_DIR}/data/${THE_FILE}.")
file(DOWNLOAD
${THE_URL}/${THE_FILE}
${CMAKE_CURRENT_BINARY_DIR}/data/${THE_FILE}
SHOW_PROGRESS
STATUS status
INACTIVITY_TIMEOUT 120
)
INACTIVITY_TIMEOUT 30
)
list(GET status 0 status_num)
if(NOT status_num EQUAL 0 OR NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/data/${THE_FILE}")
message(FATAL_ERROR "Could not download ${THE_FILE}")
Expand Down