-
Notifications
You must be signed in to change notification settings - Fork 31
/
.cirrus.yml
101 lines (94 loc) · 3.21 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
# Reference:
# - https://cirrus-ci.org/guide/writing-tasks/
# - https://cirrus-ci.org/guide/linux/
# - https://hub.docker.com/_/gcc/
# - https://hub.docker.com/_/python/
#
# Global defaults.
#
container:
image: python:latest
cpu: 2
memory: 4G
env:
# Maximum cache period (in weeks) before forcing a new cache upload.
CACHE_PERIOD: "2"
# Increment the build number to force new mambaforge cache upload.
MAMBA_CACHE_BUILD: "0"
# Increment the build number to force new mint cache upload.
NCTA_CACHE_BUILD: "0"
# Base environment conda packages to be installed
MAMBA_CACHE_PACKAGES: "pip conda-lock"
# Increment the build number to forve new pip cache upload.
PIP_CACHE_BUILD: "0"
# Linting packages to be installed.
PIP_CACHE_PACKAGES: "black flake8 isort"
#
# Linting
#
lint_task:
auto_cancellation: true
name: "${CIRRUS_OS}: linting"
pip_cache:
folder: ~/.cache/pip
fingerprint_script:
- echo "${CIRRUS_TASK_NAME} py${PYTHON_VERSION}"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${PIP_CACHE_BUILD} ${PIP_CACHE_PACKAGES}"
lint_script:
- pip list
- python -m pip install --retries 3 --upgrade ${PIP_CACHE_PACKAGES}
- pip list
- black --check ${CIRRUS_WORKING_DIR}
- flake8 ${CIRRUS_WORKING_DIR}
- isort --check ${CIRRUS_WORKING_DIR}
#
# Testing (Linux)
#
linux_task:
auto_cancellation: true
matrix:
env:
PY_VER: "3.7"
env:
PY_VER: "3.8"
env:
PY_VER: "3.9"
COVERAGE: "codecov"
name: "${CIRRUS_OS}: py${PY_VER}"
container:
image: gcc:latest
env:
PATH: ${HOME}/mambaforge/bin:${PATH}
mamba_cache:
folder: ${HOME}/mambaforge
fingerprint_script:
- wget --quiet https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O mambaforge.sh
- echo "${CIRRUS_OS} $(sha256sum mambaforge.sh)"
- echo "${MAMBA_CACHE_PACKAGES}"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${MAMBA_CACHE_BUILD}"
populate_script:
- bash mambaforge.sh -b -p ${HOME}/mambaforge
- conda config --set always_yes yes --set changeps1 no
- conda config --set show_channel_urls True
- conda config --add channels conda-forge
- conda install --quiet --name base ${MAMBA_CACHE_PACKAGES}
check_script:
- conda info --all
- conda list --name base
ncta_cache:
folder: ${HOME}/mambaforge/envs/py${PY_VER}
fingerprint_script:
- echo "${CIRRUS_OS} py${PY_VER} tests"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${NCTA_CACHE_BUILD}"
- cat ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
populate_script:
- conda-lock -k explicit --mamba --platform linux-64 --file ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
- mamba create --name py${PY_VER} --quiet --file conda-linux-64.lock
- cp conda-linux-64.lock ${HOME}/mambaforge/envs/py${PY_VER}
test_script:
- cat ${HOME}/mambaforge/envs/py${PY_VER}/conda-linux-64.lock >&2
- source ${HOME}/mambaforge/etc/profile.d/conda.sh >/dev/null 2>&1
- conda activate py${PY_VER} >/dev/null 2>&1
- pip install --no-deps --editable .
- pytest --cov-report=xml --cov
- ${COVERAGE}