|
| 1 | +# Reference: |
| 2 | +# - https://cirrus-ci.org/guide/writing-tasks/ |
| 3 | +# - https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks |
| 4 | +# - https://cirrus-ci.org/guide/linux/ |
| 5 | +# - https://cirrus-ci.org/guide/macOS/ |
| 6 | +# - https://cirrus-ci.org/guide/windows/ |
| 7 | +# - https://hub.docker.com/_/gcc/ |
| 8 | +# - https://hub.docker.com/_/python/ |
| 9 | + |
| 10 | +# |
| 11 | +# Global defaults. |
| 12 | +# |
| 13 | +container: |
| 14 | + image: python:3.8 |
| 15 | + cpu: 2 |
| 16 | + memory: 4G |
| 17 | + |
| 18 | + |
| 19 | +env: |
| 20 | + # Maximum cache period (in weeks) before forcing a new cache upload. |
| 21 | + CACHE_PERIOD: "2" |
| 22 | + # Increment the build number to force new cartopy cache upload. |
| 23 | + CARTOPY_CACHE_BUILD: "0" |
| 24 | + # Increment the build number to force new conda cache upload. |
| 25 | + CONDA_CACHE_BUILD: "0" |
| 26 | + # Increment the build number to force new nox cache upload. |
| 27 | + NOX_CACHE_BUILD: "0" |
| 28 | + # Increment the build number to force new pip cache upload. |
| 29 | + PIP_CACHE_BUILD: "0" |
| 30 | + # Pip package to be upgraded/installed. |
| 31 | + PIP_CACHE_PACKAGES: "pip setuptools wheel nox" |
| 32 | + # Git commit hash for iris test data. |
| 33 | + IRIS_TEST_DATA_REF: "fffb9b14b9cb472c5eb2ebb7fd19acb7f6414a30" |
| 34 | + # Base directory for the iris-test-data. |
| 35 | + IRIS_TEST_DATA_DIR: ${HOME}/iris-test-data |
| 36 | + |
| 37 | + |
| 38 | +# |
| 39 | +# Linting |
| 40 | +# |
| 41 | +lint_task: |
| 42 | + auto_cancellation: true |
| 43 | + name: "${CIRRUS_OS}: flake8 and black" |
| 44 | + pip_cache: |
| 45 | + folder: ~/.cache/pip |
| 46 | + fingerprint_script: |
| 47 | + - echo "${CIRRUS_TASK_NAME}" |
| 48 | + - echo "$(date +%Y).$(($(date +%U) / ${CACHE_PERIOD})):${PIP_CACHE_BUILD} ${PIP_CACHE_PACKAGES}" |
| 49 | + lint_script: |
| 50 | + - pip list |
| 51 | + - python -m pip install --retries 3 --upgrade ${PIP_CACHE_PACKAGES} |
| 52 | + - pip list |
| 53 | + - nox --session flake8 |
| 54 | + - nox --session black |
| 55 | + |
| 56 | + |
| 57 | +# |
| 58 | +# YAML alias for common linux test infra-structure. |
| 59 | +# |
| 60 | +linux_task_template: &LINUX_TASK_TEMPLATE |
| 61 | + auto_cancellation: true |
| 62 | + env: |
| 63 | + IRIS_REPO_DIR: ${CIRRUS_WORKING_DIR} |
| 64 | + PATH: ${HOME}/miniconda/bin:${PATH} |
| 65 | + SITE_CFG: ${CIRRUS_WORKING_DIR}/lib/iris/etc/site.cfg |
| 66 | + conda_cache: |
| 67 | + folder: ${HOME}/miniconda |
| 68 | + fingerprint_script: |
| 69 | + - wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh |
| 70 | + - echo "${CIRRUS_OS} $(sha256sum miniconda.sh)" |
| 71 | + - echo "$(date +%Y).$(($(date +%U) / ${CACHE_PERIOD})):${CONDA_CACHE_BUILD}" |
| 72 | + populate_script: |
| 73 | + - bash miniconda.sh -b -p ${HOME}/miniconda |
| 74 | + - conda config --set always_yes yes --set changeps1 no |
| 75 | + - conda config --set show_channel_urls True |
| 76 | + - conda config --add channels conda-forge |
| 77 | + - conda update --quiet --name base conda |
| 78 | + - conda install --quiet --name base nox pip |
| 79 | + cartopy_cache: |
| 80 | + folder: ${HOME}/.local/share/cartopy |
| 81 | + fingerprint_script: |
| 82 | + - echo "${CIRRUS_OS}" |
| 83 | + - echo "$(date +%Y).$(($(date +%U) / ${CACHE_PERIOD})):${CARTOPY_CACHE_BUILD}" |
| 84 | + nox_cache: |
| 85 | + folder: ${CIRRUS_WORKING_DIR}/.nox |
| 86 | + fingerprint_script: |
| 87 | + - echo "${CIRRUS_TASK_NAME}" |
| 88 | + - echo "$(date +%Y).$(($(date +%U) / ${CACHE_PERIOD})):${NOX_CACHE_BUILD}" |
| 89 | + - sha256sum ${CIRRUS_WORKING_DIR}/requirements/ci/py$(echo ${PY_VER} | tr -d ".").yml |
| 90 | + |
| 91 | + |
| 92 | +# |
| 93 | +# Testing Minimal (Linux) |
| 94 | +# |
| 95 | +linux_minimal_task: |
| 96 | + matrix: |
| 97 | + env: |
| 98 | + PY_VER: 3.6 |
| 99 | + env: |
| 100 | + PY_VER: 3.7 |
| 101 | + name: "${CIRRUS_OS}: py${PY_VER} tests (minimal)" |
| 102 | + container: |
| 103 | + image: gcc:latest |
| 104 | + cpu: 2 |
| 105 | + memory: 4G |
| 106 | + << : *LINUX_TASK_TEMPLATE |
| 107 | + tests_script: |
| 108 | + - echo "[Resources]" > ${SITE_CFG} |
| 109 | + - echo "doc_dir = ${CIRRUS_WORKING_DIR}/docs/iris" >> ${SITE_CFG} |
| 110 | + - nox --session tests |
| 111 | + |
| 112 | + |
| 113 | +# |
| 114 | +# Testing Full (Linux) |
| 115 | +# |
| 116 | +linux_task: |
| 117 | + matrix: |
| 118 | + env: |
| 119 | + PY_VER: 3.6 |
| 120 | + env: |
| 121 | + PY_VER: 3.7 |
| 122 | + name: "${CIRRUS_OS}: py${PY_VER} tests (full)" |
| 123 | + container: |
| 124 | + image: gcc:latest |
| 125 | + cpu: 6 |
| 126 | + memory: 8G |
| 127 | + data_cache: |
| 128 | + folder: ${IRIS_TEST_DATA_DIR} |
| 129 | + fingerprint_script: |
| 130 | + - echo "${IRIS_TEST_DATA_REF}" |
| 131 | + populate_script: |
| 132 | + - wget --quiet https://github.com/SciTools/iris-test-data/archive/${IRIS_TEST_DATA_REF}.zip -O iris-test-data.zip |
| 133 | + - unzip -q iris-test-data.zip |
| 134 | + - mv iris-test-data-$(echo "${IRIS_TEST_DATA_REF}" | sed "s/^v//") ${IRIS_TEST_DATA_DIR} |
| 135 | + << : *LINUX_TASK_TEMPLATE |
| 136 | + tests_script: |
| 137 | + - echo "[Resources]" > ${SITE_CFG} |
| 138 | + - echo "test_data_dir = ${IRIS_TEST_DATA_DIR}/test_data" >> ${SITE_CFG} |
| 139 | + - echo "doc_dir = ${CIRRUS_WORKING_DIR}/docs/iris" >> ${SITE_CFG} |
| 140 | + - nox --session tests |
| 141 | + |
| 142 | + |
| 143 | +# |
| 144 | +# Testing Documentation Gallery (Linux) |
| 145 | +# |
| 146 | +gallery_task: |
| 147 | + matrix: |
| 148 | + env: |
| 149 | + PY_VER: 3.6 |
| 150 | + env: |
| 151 | + PY_VER: 3.7 |
| 152 | + name: "${CIRRUS_OS}: py${PY_VER} doc tests (gallery)" |
| 153 | + container: |
| 154 | + image: gcc:latest |
| 155 | + cpu: 2 |
| 156 | + memory: 4G |
| 157 | + data_cache: |
| 158 | + folder: ${IRIS_TEST_DATA_DIR} |
| 159 | + fingerprint_script: |
| 160 | + - echo "${IRIS_TEST_DATA_REF}" |
| 161 | + populate_script: |
| 162 | + - wget --quiet https://github.com/SciTools/iris-test-data/archive/${IRIS_TEST_DATA_REF}.zip -O iris-test-data.zip |
| 163 | + - unzip -q iris-test-data.zip |
| 164 | + - mv iris-test-data-$(echo "${IRIS_TEST_DATA_REF}" | sed "s/^v//") ${IRIS_TEST_DATA_DIR} |
| 165 | + << : *LINUX_TASK_TEMPLATE |
| 166 | + tests_script: |
| 167 | + - echo "[Resources]" > ${SITE_CFG} |
| 168 | + - echo "test_data_dir = ${IRIS_TEST_DATA_DIR}/test_data" >> ${SITE_CFG} |
| 169 | + - echo "doc_dir = ${CIRRUS_WORKING_DIR}/docs/iris" >> ${SITE_CFG} |
| 170 | + - nox --session gallery |
| 171 | + |
| 172 | + |
| 173 | +# |
| 174 | +# Testing Documentation (Linux) |
| 175 | +# |
| 176 | +doctest_task: |
| 177 | + matrix: |
| 178 | + env: |
| 179 | + PY_VER: 3.7 |
| 180 | + name: "${CIRRUS_OS}: py${PY_VER} doc tests" |
| 181 | + container: |
| 182 | + image: gcc:latest |
| 183 | + cpu: 2 |
| 184 | + memory: 4G |
| 185 | + env: |
| 186 | + MPL_RC_DIR: ${HOME}/.config/matplotlib |
| 187 | + MPL_RC_FILE: ${HOME}/.config/matplotlib/matplotlibrc |
| 188 | + data_cache: |
| 189 | + folder: ${IRIS_TEST_DATA_DIR} |
| 190 | + fingerprint_script: |
| 191 | + - echo "${IRIS_TEST_DATA_REF}" |
| 192 | + populate_script: |
| 193 | + - wget --quiet https://github.com/SciTools/iris-test-data/archive/${IRIS_TEST_DATA_REF}.zip -O iris-test-data.zip |
| 194 | + - unzip -q iris-test-data.zip |
| 195 | + - mv iris-test-data-$(echo "${IRIS_TEST_DATA_REF}" | sed "s/^v//") ${IRIS_TEST_DATA_DIR} |
| 196 | + << : *LINUX_TASK_TEMPLATE |
| 197 | + tests_script: |
| 198 | + - echo "[Resources]" > ${SITE_CFG} |
| 199 | + - echo "test_data_dir = ${IRIS_TEST_DATA_DIR}/test_data" >> ${SITE_CFG} |
| 200 | + - echo "doc_dir = ${CIRRUS_WORKING_DIR}/docs/iris" >> ${SITE_CFG} |
| 201 | + - mkdir -p ${MPL_RC_DIR} |
| 202 | + - echo "backend : agg" > ${MPL_RC_FILE} |
| 203 | + - echo "image.cmap : viridis" >> ${MPL_RC_FILE} |
| 204 | + - nox --session doctest |
| 205 | + |
| 206 | + |
| 207 | +# |
| 208 | +# Testing Documentation Link Check (Linux) |
| 209 | +# |
| 210 | +link_task: |
| 211 | + matrix: |
| 212 | + env: |
| 213 | + PY_VER: 3.7 |
| 214 | + name: "${CIRRUS_OS}: py${PY_VER} doc link check" |
| 215 | + container: |
| 216 | + image: gcc:latest |
| 217 | + cpu: 2 |
| 218 | + memory: 4G |
| 219 | + env: |
| 220 | + MPL_RC_DIR: ${HOME}/.config/matplotlib |
| 221 | + MPL_RC_FILE: ${HOME}/.config/matplotlib/matplotlibrc |
| 222 | + << : *LINUX_TASK_TEMPLATE |
| 223 | + tests_script: |
| 224 | + - mkdir -p ${MPL_RC_DIR} |
| 225 | + - echo "backend : agg" > ${MPL_RC_FILE} |
| 226 | + - echo "image.cmap : viridis" >> ${MPL_RC_FILE} |
| 227 | + - nox --session linkcheck |
0 commit comments