|
| 1 | +version: 2 |
| 2 | + |
| 3 | +checkout: |
| 4 | + post: |
| 5 | + - ./ci-support/checkout_merge_commit.sh |
| 6 | + |
| 7 | +aliases: |
| 8 | + |
| 9 | + - &setup_miniconda |
| 10 | + name: setup_miniconda |
| 11 | + command: | |
| 12 | + mkdir -p workspace |
| 13 | + git clone -b validateNightly git@github.com:CDAT/cdat workspace/cdat |
| 14 | + ls workspace/cdat |
| 15 | + # following will install miniconda3 under $WORKDIR/miniconda/bin |
| 16 | + python workspace/cdat/scripts/install_miniconda.py -w $WORKDIR -p 'py3' |
| 17 | + |
| 18 | + - &create_conda_env |
| 19 | + name: create_conda_env |
| 20 | + command: | |
| 21 | + export PATH=$HOME/project/$WORKDIR/miniconda/bin:$PATH |
| 22 | + conda config --set always_yes yes --set changeps1 no |
| 23 | + conda update -y -q conda |
| 24 | + conda config --set anaconda_upload no |
| 25 | + conda create -n py3 -c cdat/label/unstable -c cdat/label/nightly -c conda-forge -c cdat libcf distarray cdtime libcdms cdat_info numpy esmf esmpy libdrs_f pyopenssl nose requests flake8 myproxyclient "python>3" |
| 26 | + conda create -n py2 -c cdat/label/unstable -c cdat/label/nightly -c conda-forge -c cdat libcf distarray cdtime libcdms cdat_info numpy esmf esmpy libdrs_f pyopenssl nose requests flake8 "python<3" |
| 27 | + if [ $(uname) == "Linux" ]; then |
| 28 | + conda install -n py3 -c cdat/label/unstable -c cdat/label/nightly -c conda-forge gcc_linux-64 |
| 29 | + conda install -n py2 -c cdat/label/unstable -c cdat/label/nightly -c conda-forge gcc_linux-64 |
| 30 | + else |
| 31 | + conda install -n py3 -c cdat/label/unstable -c cdat/label/nightly -c conda-forge gcc |
| 32 | + conda install -n py2 -c cdat/label/unstable -c cdat/label/nightly -c conda-forge gcc |
| 33 | + fi |
| 34 | +
|
| 35 | + - &setup_cdms |
| 36 | + name: setup_cdms |
| 37 | + command: | |
| 38 | + export PATH=$HOME/project/$WORKDIR/miniconda/bin:$PATH |
| 39 | + export UVCDAT_ANONYMOUS_LOG=False |
| 40 | + source activate py3 |
| 41 | + mkdir $HOME/.esg |
| 42 | + echo "Get ESGF certificates" |
| 43 | + echo ${ESGF_PWD} | myproxyclient logon -s esgf-node.llnl.gov -p 7512 -t 12 -S -b -l ${ESGF_USER} -o $HOME/.esg/esgf.cert |
| 44 | + cp tests/dodsrccircleci $HOME/.dodsrc |
| 45 | + echo "Create .dods_cookies" |
| 46 | + curl -L -v -c $HOME/.esg/.dods_cookies --cert $HOME/.esg/esgf.cert --key $HOME/.esg/esgf.cert "https://aims3.llnl.gov/thredds/dodsC/cmip5_css02_data/cmip5/output1/CMCC/CMCC-CM/decadal2005/mon/atmos/Amon/r1i1p1/cct/1/cct_Amon_CMCC-CM_decadal2005_r1i1p1_202601-203512.nc.dds" |
| 47 | + if [ $(uname) == "Linux" ];then |
| 48 | + export LDSHARED="$CC -shared -pthread" |
| 49 | + LDSHARED="$CC -shared -pthread" python setup.py install |
| 50 | + else |
| 51 | + python setup.py install |
| 52 | + fi |
| 53 | + source activate py2 |
| 54 | + rm -rf build |
| 55 | + if [ $(uname) == "Linux" ];then |
| 56 | + export LDSHARED="$CC -shared -pthread" |
| 57 | + LDSHARED="$CC -shared -pthread" python setup.py install |
| 58 | + else |
| 59 | + python setup.py install |
| 60 | + fi |
| 61 | +
|
| 62 | + - &run_cdms_tests |
| 63 | + name: run_cdms_tests |
| 64 | + command: | |
| 65 | + export PATH=$HOME/project/$WORKDIR/miniconda/bin:$PATH |
| 66 | + export UVCDAT_ANONYMOUS_LOG=False |
| 67 | + set -e |
| 68 | + source activate py2 |
| 69 | + python run_tests.py -v2 |
| 70 | + PY2_RESULT=$? |
| 71 | + echo "*** py2 test result: "${PY2_RESULT} |
| 72 | + source activate py3 |
| 73 | + python run_tests.py -v2 |
| 74 | + PY3_RESULT=$? |
| 75 | + echo "*** py3 test result: "${PY3_RESULT} |
| 76 | + echo $PY2_RESULT > $HOME/project/$WORKDIR/py2_result.txt |
| 77 | + echo $PY3_RESULT > $HOME/project/$WORKDIR/py3_result.txt |
| 78 | +
|
| 79 | + - &upload_cdms |
| 80 | + name: upload_cdms |
| 81 | + command: | |
| 82 | + export PATH=$HOME/project/$WORKDIR/miniconda/bin:$PATH |
| 83 | + export LABEL="nightly"; |
| 84 | + # Retrieve results |
| 85 | + PY2_RESULT=$(cat $HOME/project/$WORKDIR/py2_result.txt) |
| 86 | + PY3_RESULT=$(cat $HOME/project/$WORKDIR/py3_result.txt) |
| 87 | + echo "*** CIRCLE BRANCH: "${CIRCLE_BRANCH} |
| 88 | + echo "*** PY2_RESULT: "${PY2_RESULT} |
| 89 | + echo "*** PY3_RESULT: "${PY3_RESULT} |
| 90 | + if [ $PY2_RESULT -eq 0 -a $PY3_RESULT -eq 0 -a $CIRCLE_BRANCH == "master" ]; then bash ./ci-support/conda_upload.sh ; fi |
| 91 | + if [ $PY2_RESULT -eq 0 -a $PY3_RESULT -eq 0 -a $CIRCLE_BRANCH == "master" ]; then conda install -n root conda-build anaconda-client ; fi |
| 92 | + #if [ $PY2_RESULT -eq 0 -a $PY3_RESULT -eq 0 -a $CIRCLE_BRANCH != "master" ]; then |
| 93 | + if [ $CIRCLE_BRANCH != "master" ]; then |
| 94 | + export LABEL="unstable"; |
| 95 | + echo "NOTE: upload LABEL="${LABEL} |
| 96 | + conda install -n root conda-build anaconda-client; |
| 97 | + bash ./ci-support/conda_upload.sh; |
| 98 | + fi |
| 99 | +
|
| 100 | +jobs: |
| 101 | + macos_cdms: |
| 102 | + macos: |
| 103 | + xcode: "9.2.0" |
| 104 | + environment: |
| 105 | + WORKDIR: "workspace/test_macos_cdms" |
| 106 | + steps: |
| 107 | + - checkout |
| 108 | + - run: *setup_miniconda |
| 109 | + - run: *create_conda_env |
| 110 | + - run: *setup_cdms |
| 111 | + - run: *run_cdms_tests |
| 112 | + - run: *upload_cdms |
| 113 | + - store_artifacts: |
| 114 | + path: tests_html |
| 115 | + destination: tests_html |
| 116 | + - store_artifacts: |
| 117 | + path: tests_png |
| 118 | + destination: tests_png |
| 119 | + |
| 120 | + linux_cdms: |
| 121 | + machine: |
| 122 | + image: circleci/classic:latest |
| 123 | + environment: |
| 124 | + WORKDIR: "workspace/test_linux_cdms" |
| 125 | + steps: |
| 126 | + - checkout |
| 127 | + - run: *setup_miniconda |
| 128 | + - run: *create_conda_env |
| 129 | + - run: *setup_cdms |
| 130 | + - run: *run_cdms_tests |
| 131 | + - run: *upload_cdms |
| 132 | + - store_artifacts: |
| 133 | + path: tests_html |
| 134 | + destination: tests_html |
| 135 | + - store_artifacts: |
| 136 | + path: tests_png |
| 137 | + destination: tests_png |
| 138 | + |
| 139 | + |
| 140 | +workflows: |
| 141 | + version: 2 |
| 142 | + cdms_test: |
| 143 | + jobs: |
| 144 | + - macos_cdms |
| 145 | + - linux_cdms |
| 146 | + |
| 147 | + |
0 commit comments