forked from SciTools/iris-esmf-regrid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.cirrus.yml
139 lines (129 loc) · 4.22 KB
/
.cirrus.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Reference:
# - https://cirrus-ci.org/guide/writing-tasks/
# - https://cirrus-ci.org/guide/linux/
# - https://cirrus-ci.org/guide/macOS/
# - https://cirrus-ci.org/guide/windows/
# - https://hub.docker.com/_/gcc/
# - https://hub.docker.com/_/python/
#
# Global defaults.
#
container:
image: python:3.8
cpu: 2
memory: 4G
env:
# Skip specific tasks by name. Set to a non-empty string to skip.
SKIP_LINT_TASK: ""
SKIP_TEST_TASK: ""
SKIP_BENCHMARK_TASK: ""
# Maximum cache period (in weeks) before forcing a new cache upload.
CACHE_PERIOD: "2"
# Increment the build number to force new conda cache upload.
CONDA_CACHE_BUILD: "0"
# Increment the build number to force new nox cache upload.
NOX_CACHE_BUILD: "0"
# Increment the build number to force new pip cache upload.
PIP_CACHE_BUILD: "0"
# Pip package to be installed.
PIP_CACHE_PACKAGES: "pip setuptools wheel nox pyyaml"
# Conda packages to be installed.
CONDA_CACHE_PACKAGES: "nox pip pyyaml"
#
# YAML alias for common linux test infra-structure.
#
LINUX_CONDA_TEMPLATE: &LINUX_CONDA_TEMPLATE
auto_cancellation: true
container:
image: gcc:latest
env:
PATH: ${HOME}/miniconda/bin:${PATH}
conda_cache:
folder: ${HOME}/miniconda
fingerprint_script:
- wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- echo "${CIRRUS_OS} $(sha256sum miniconda.sh)"
- echo "${CONDA_CACHE_PACKAGES}"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${CONDA_CACHE_BUILD}"
- uname -r
populate_script:
- export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)"
- bash miniconda.sh -b -p ${HOME}/miniconda
- conda config --set always_yes yes --set changeps1 no
- conda config --set show_channel_urls True
- conda config --add channels conda-forge
- conda update --quiet --name base conda
- conda install --quiet --name base ${CONDA_CACHE_PACKAGES}
#
# Linting
#
lint_task:
only_if: ${SKIP_LINT_TASK} == ""
auto_cancellation: true
name: "${CIRRUS_OS}: flake8 and black"
pip_cache:
folder: ~/.cache/pip
fingerprint_script:
- echo "${CIRRUS_TASK_NAME} py${PYTHON_VERSION}"
- echo "${PIP_CACHE_PACKAGES}"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${PIP_CACHE_BUILD}"
lint_script:
- pip list
- python -m pip install --retries 3 --upgrade ${PIP_CACHE_PACKAGES}
- pip list
- nox --session flake8
- nox --session black
#
# Testing (Linux)
#
test_task:
only_if: ${SKIP_TEST_TASK} == ""
auto_cancellation: true
matrix:
env:
PY_VER: "3.6"
env:
PY_VER: "3.7"
env:
PY_VER: "3.8"
COVERAGE: "true"
name: "${CIRRUS_OS}: py${PY_VER} tests"
<< : *LINUX_CONDA_TEMPLATE
nox_cache:
folder: ${CIRRUS_WORKING_DIR}/.nox
reupload_on_changes: true
fingerprint_script:
- echo "${CIRRUS_TASK_NAME}"
- echo "${NOX_CACHE_BUILD}"
- if [ -n "${IRIS_SOURCE}" ]; then echo "${IRIS_SOURCE}"; fi
test_script:
- export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)"
- nox --session tests -- --verbose
#
# Performance Benchmarking (Linux)
#
benchmark_task:
only_if: ${SKIP_BENCHMARK_TASK} == ""
auto_cancellation: true
name: "${CIRRUS_OS}: performance benchmarking"
# Custom clone behaviour to enable ASV to access the PR base branch (if on a
# PR).
clone_script: |
if [ -z "$CIRRUS_PR" ]; then
git clone --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
git reset --hard $CIRRUS_CHANGE_IN_REPO
else
git clone --recursive https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
git fetch origin pull/${CIRRUS_PR}/head:pull/${CIRRUS_PR}
git reset --hard $CIRRUS_CHANGE_IN_REPO
fi
<< : *LINUX_CONDA_TEMPLATE
asv_cache:
folder: ${CIRRUS_WORKING_DIR}/benchmarks/.asv-env
reupload_on_changes: true
fingerprint_script:
- echo "${CIRRUS_TASK_NAME}"
- if [ -n "${IRIS_SOURCE}" ]; then echo "${IRIS_SOURCE}"; fi
benchmarks_script:
- export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)"
- nox --session="benchmarks(ci compare)"