Skip to content

Commit c82dc37

Browse files
authored
minor tidy of cirrus and nox (#4152)
1 parent 18d5629 commit c82dc37

File tree

2 files changed

+16
-35
lines changed

2 files changed

+16
-35
lines changed

.cirrus.yml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
# - https://cirrus-ci.org/guide/writing-tasks/#environment-variables
44
# - https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
55
# - https://cirrus-ci.org/guide/linux/
6-
# - https://cirrus-ci.org/guide/macOS/
7-
# - https://cirrus-ci.org/guide/windows/
86
# - https://hub.docker.com/_/gcc/
97
# - https://hub.docker.com/_/python/
108

119
#
1210
# Global defaults.
1311
#
1412
container:
15-
image: python:3.8
13+
image: gcc:latest
1614
cpu: 2
1715
memory: 4G
1816

@@ -84,6 +82,7 @@ linux_task_template: &LINUX_TASK_TEMPLATE
8482
- echo "${CIRRUS_TASK_NAME}"
8583
- echo "${NOX_CACHE_BUILD}"
8684

85+
8786
#
8887
# YAML alias for compute credits.
8988
#
@@ -113,6 +112,10 @@ lint_task:
113112
only_if: ${SKIP_LINT_TASK} == ""
114113
<< : *CREDITS_TEMPLATE
115114
auto_cancellation: true
115+
container:
116+
image: python:3.8
117+
cpu: 2
118+
memory: 4G
116119
name: "${CIRRUS_OS}: flake8 and black"
117120
pip_cache:
118121
folder: ~/.cache/pip
@@ -141,10 +144,6 @@ test_minimal_task:
141144
env:
142145
PY_VER: 3.8
143146
name: "${CIRRUS_OS}: py${PY_VER} tests (minimal)"
144-
container:
145-
image: gcc:latest
146-
cpu: 2
147-
memory: 4G
148147
<< : *LINUX_TASK_TEMPLATE
149148
tests_script:
150149
- export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)"
@@ -187,14 +186,9 @@ test_full_task:
187186
gallery_task:
188187
only_if: ${SKIP_GALLERY_TASK} == "" && ${SKIP_ALL_DOC_TASKS} == ""
189188
<< : *CREDITS_TEMPLATE
190-
matrix:
191-
env:
192-
PY_VER: 3.8
189+
env:
190+
PY_VER: 3.8
193191
name: "${CIRRUS_OS}: py${PY_VER} doc tests (gallery)"
194-
container:
195-
image: gcc:latest
196-
cpu: 2
197-
memory: 4G
198192
<< : *IRIS_TEST_DATA_TEMPLATE
199193
<< : *LINUX_TASK_TEMPLATE
200194
tests_script:
@@ -211,17 +205,11 @@ gallery_task:
211205
doctest_task:
212206
only_if: ${SKIP_DOCTEST_TASK} == "" && ${SKIP_ALL_DOC_TASKS} == ""
213207
<< : *CREDITS_TEMPLATE
214-
matrix:
215-
env:
216-
PY_VER: 3.8
217-
name: "${CIRRUS_OS}: py${PY_VER} doc tests"
218-
container:
219-
image: gcc:latest
220-
cpu: 2
221-
memory: 4G
222208
env:
209+
PY_VER: 3.8
223210
MPL_RC_DIR: ${HOME}/.config/matplotlib
224211
MPL_RC_FILE: ${HOME}/.config/matplotlib/matplotlibrc
212+
name: "${CIRRUS_OS}: py${PY_VER} doc tests"
225213
<< : *IRIS_TEST_DATA_TEMPLATE
226214
<< : *LINUX_TASK_TEMPLATE
227215
tests_script:
@@ -241,17 +229,11 @@ doctest_task:
241229
linkcheck_task:
242230
only_if: ${SKIP_LINKCHECK_TASK} == "" && ${SKIP_ALL_DOC_TASKS} == ""
243231
<< : *CREDITS_TEMPLATE
244-
matrix:
245-
env:
246-
PY_VER: 3.8
247-
name: "${CIRRUS_OS}: py${PY_VER} doc link check"
248-
container:
249-
image: gcc:latest
250-
cpu: 2
251-
memory: 4G
252232
env:
233+
PY_VER: 3.8
253234
MPL_RC_DIR: ${HOME}/.config/matplotlib
254235
MPL_RC_FILE: ${HOME}/.config/matplotlib/matplotlibrc
236+
name: "${CIRRUS_OS}: py${PY_VER} doc link check"
255237
<< : *LINUX_TASK_TEMPLATE
256238
tests_script:
257239
- export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)"

noxfile.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ def venv_populated(session: nox.sessions.Session) -> bool:
5050
def venv_changed(session: nox.sessions.Session) -> bool:
5151
"""Returns True if the installed session is different to that specified
5252
in the lockfile."""
53+
changed = False
5354
cache = session_cachefile(session)
5455
lockfile = session_lockfile(session)
5556
if cache.is_file():
5657
with open(lockfile, "rb") as fi:
5758
expected = hashlib.sha256(fi.read()).hexdigest()
5859
with open(cache, "r") as fi:
5960
actual = fi.read()
60-
return actual != expected
61-
else:
62-
return False
61+
changed = actual != expected
62+
return changed
6363

6464

6565
def cache_venv(session: nox.sessions.Session) -> None:
@@ -140,7 +140,7 @@ def prepare_venv(session: nox.sessions.Session) -> None:
140140
session.virtualenv.reuse_existing = _re_orig
141141
cache_venv(session)
142142

143-
logger.debug(f"Environment {venv_dir} up to date")
143+
logger.debug(f"Environment {venv_dir} is up to date")
144144

145145
cache_cartopy(session)
146146

@@ -210,7 +210,6 @@ def tests(session: nox.sessions.Session):
210210
"""
211211
prepare_venv(session)
212212
session.install("--no-deps", "--editable", ".")
213-
214213
session.run(
215214
"python",
216215
"-m",

0 commit comments

Comments
 (0)