forked from NOAA-GFDL/MDTF-diagnostics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
81 lines (69 loc) · 2.81 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# This Travis-CI file only runs unit tests on the MDTF code.
# It does not make use of external test data and does not test the scientific
# content of individual diagnostics.
# Config validator: https://config.travis-ci.com/explore
jobs:
include:
- os: linux
dist: xenial # default
language: shell # synonym for "minimal". Use instead of "python" to save disk space; all software installed through conda
python: '3.7' # doesn't matter, conda python used instead of system
env:
- MINICONDA_INSTALLER="https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh"
- os: osx
osx_image: xcode12.2
env:
- MINICONDA_INSTALLER="https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh"
before_install:
# TRAVIS_BUILD_DIR = abs path to checked-out repo
- BUILD_PARENT="$( cd "$( dirname "$TRAVIS_BUILD_DIR" )" >/dev/null 2>&1 && pwd )"
- POD_OUTPUT="${BUILD_PARENT}/wkdir/MDTF_NCAR-CAM5.timeslice_2000_2003"
- echo "$TRAVIS_BUILD_DIR" # debug
- echo "$BUILD_PARENT"
- echo "$POD_OUTPUT"
- cd "$BUILD_PARENT"
install:
# miniconda setup taken from official guide at
# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/use-conda-with-travis-ci.html
# - sudo apt update
- wget $MINICONDA_INSTALLER -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- source "$HOME/miniconda/etc/profile.d/conda.sh"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
# MDTF-specific setup:
# install all conda envs used by package and PODs
- $TRAVIS_BUILD_DIR/src/conda/conda_env_setup.sh --all --conda_root "$HOME/miniconda"
- df -h # Log space remaining for data
# attempt FTP data fetch for EOF_500hPa
# allow 20 min for transfer before timeout; Travis only allots 50 min for everything
- curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --disable-epsv --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/pub/thomas.jackson/travis_test.tar --output travis_test.tar
- tar -xvf travis_test.tar
- mkdir wkdir
- pwd # debug
- ls # debug
- ls -R travis_test
- df -h # Log space remaining
before_script:
- cd "$TRAVIS_BUILD_DIR"
- pwd # debug
- ls #debug
script:
# trivial check that install script worked
- ./mdtf --version
# run unit tests
- conda activate _MDTF_base
- python -m unittest discover
# try running EOF_500hPa and example PODs
- ./mdtf -v -f "${TRAVIS_BUILD_DIR}/tests/travis_test.jsonc"
# EOF_500hPa
- ls "${POD_OUTPUT}/EOF_500hPa/obs"
- ls "${POD_OUTPUT}/EOF_500hPa/model"
- cat "${POD_OUTPUT}/EOF_500hPa/EOF_500hPa.log"
# example
- ls "${POD_OUTPUT}/example/obs"
- ls "${POD_OUTPUT}/example/model"
- cat "${POD_OUTPUT}/example/example.log"