Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor tidy of cirrus and nox #4152

Merged
merged 1 commit into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 12 additions & 30 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
# - https://cirrus-ci.org/guide/writing-tasks/#environment-variables
# - https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-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
image: gcc:latest
cpu: 2
memory: 4G

Expand Down Expand Up @@ -84,6 +82,7 @@ linux_task_template: &LINUX_TASK_TEMPLATE
- echo "${CIRRUS_TASK_NAME}"
- echo "${NOX_CACHE_BUILD}"


#
# YAML alias for compute credits.
#
Expand Down Expand Up @@ -113,6 +112,10 @@ lint_task:
only_if: ${SKIP_LINT_TASK} == ""
<< : *CREDITS_TEMPLATE
auto_cancellation: true
container:
image: python:3.8
cpu: 2
memory: 4G
name: "${CIRRUS_OS}: flake8 and black"
pip_cache:
folder: ~/.cache/pip
Expand Down Expand Up @@ -141,10 +144,6 @@ test_minimal_task:
env:
PY_VER: 3.8
name: "${CIRRUS_OS}: py${PY_VER} tests (minimal)"
container:
image: gcc:latest
cpu: 2
memory: 4G
<< : *LINUX_TASK_TEMPLATE
tests_script:
- export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)"
Expand Down Expand Up @@ -187,14 +186,9 @@ test_full_task:
gallery_task:
only_if: ${SKIP_GALLERY_TASK} == "" && ${SKIP_ALL_DOC_TASKS} == ""
<< : *CREDITS_TEMPLATE
matrix:
env:
PY_VER: 3.8
env:
PY_VER: 3.8
name: "${CIRRUS_OS}: py${PY_VER} doc tests (gallery)"
container:
image: gcc:latest
cpu: 2
memory: 4G
<< : *IRIS_TEST_DATA_TEMPLATE
<< : *LINUX_TASK_TEMPLATE
tests_script:
Expand All @@ -211,17 +205,11 @@ gallery_task:
doctest_task:
only_if: ${SKIP_DOCTEST_TASK} == "" && ${SKIP_ALL_DOC_TASKS} == ""
<< : *CREDITS_TEMPLATE
matrix:
env:
PY_VER: 3.8
name: "${CIRRUS_OS}: py${PY_VER} doc tests"
container:
image: gcc:latest
cpu: 2
memory: 4G
env:
PY_VER: 3.8
MPL_RC_DIR: ${HOME}/.config/matplotlib
MPL_RC_FILE: ${HOME}/.config/matplotlib/matplotlibrc
name: "${CIRRUS_OS}: py${PY_VER} doc tests"
<< : *IRIS_TEST_DATA_TEMPLATE
<< : *LINUX_TASK_TEMPLATE
tests_script:
Expand All @@ -241,17 +229,11 @@ doctest_task:
linkcheck_task:
only_if: ${SKIP_LINKCHECK_TASK} == "" && ${SKIP_ALL_DOC_TASKS} == ""
<< : *CREDITS_TEMPLATE
matrix:
env:
PY_VER: 3.8
name: "${CIRRUS_OS}: py${PY_VER} doc link check"
container:
image: gcc:latest
cpu: 2
memory: 4G
env:
PY_VER: 3.8
MPL_RC_DIR: ${HOME}/.config/matplotlib
MPL_RC_FILE: ${HOME}/.config/matplotlib/matplotlibrc
name: "${CIRRUS_OS}: py${PY_VER} doc link check"
<< : *LINUX_TASK_TEMPLATE
tests_script:
- export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)"
Expand Down
9 changes: 4 additions & 5 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ def venv_populated(session: nox.sessions.Session) -> bool:
def venv_changed(session: nox.sessions.Session) -> bool:
"""Returns True if the installed session is different to that specified
in the lockfile."""
changed = False
cache = session_cachefile(session)
lockfile = session_lockfile(session)
if cache.is_file():
with open(lockfile, "rb") as fi:
expected = hashlib.sha256(fi.read()).hexdigest()
with open(cache, "r") as fi:
actual = fi.read()
return actual != expected
else:
return False
changed = actual != expected
return changed


def cache_venv(session: nox.sessions.Session) -> None:
Expand Down Expand Up @@ -140,7 +140,7 @@ def prepare_venv(session: nox.sessions.Session) -> None:
session.virtualenv.reuse_existing = _re_orig
cache_venv(session)

logger.debug(f"Environment {venv_dir} up to date")
logger.debug(f"Environment {venv_dir} is up to date")

cache_cartopy(session)

Expand Down Expand Up @@ -210,7 +210,6 @@ def tests(session: nox.sessions.Session):
"""
prepare_venv(session)
session.install("--no-deps", "--editable", ".")

session.run(
"python",
"-m",
Expand Down