Skip to content

Commit

Permalink
Merge branch 'master' into enable_spelling_check
Browse files Browse the repository at this point in the history
* master: (87 commits)
  Contourf Antialias Fix (SciTools#4150)
  minor tidy of cirrus and nox (SciTools#4152)
  update bug and feature templates (SciTools#4147)
  Update CI environment lockfiles + Cartopy 0.19 changes (SciTools#4125)
  separate arg types from descriptions (SciTools#4100)
  Use assertArrayAllClose for sqrt test (SciTools#4118)
  Removed branch suffix (SciTools#4117)
  Corrected plot_anomaly_log_colouring for new Matplotlib linscale rules. (SciTools#4115)
  replace most recent hashes (SciTools#4112)
  Linkcheck update (SciTools#4104)
  CI lockfiles (SciTools#4108)
  Fix bug in gallery_tests runner (SciTools#4111)
  add logo to conda and pypi badges (SciTools#4088)
  pre-commit-ci update (SciTools#4092)
  Fix cirrus ci and mpl (SciTools#4087)
  Update readme docs stable (SciTools#4089)
  linux kernel version fix for conda 4.10+ (SciTools#4084)
  update docs pypi instructions (SciTools#4077)
  update flake8 pre-commit (SciTools#4067)
  Add GitHub discussions badge (SciTools#4070)
  ...
  • Loading branch information
tkknight committed May 26, 2021
2 parents 18c4259 + aee4ce7 commit 9366e71
Show file tree
Hide file tree
Showing 274 changed files with 13,521 additions and 2,110 deletions.
243 changes: 243 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
# Reference:
# - https://cirrus-ci.org/guide/writing-tasks/
# - 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://hub.docker.com/_/gcc/
# - https://hub.docker.com/_/python/

#
# Global defaults.
#
container:
image: gcc:latest
cpu: 2
memory: 4G


env:
# Skip specific tasks by name. Set to a non-empty string to skip.
SKIP_LINT_TASK: ""
SKIP_TEST_MINIMAL_TASK: ""
SKIP_TEST_FULL_TASK: ""
SKIP_GALLERY_TASK: ""
SKIP_DOCTEST_TASK: ""
SKIP_LINKCHECK_TASK: ""
# Skip task groups by type. Set to a non-empty string to skip.
SKIP_ALL_TEST_TASKS: ""
SKIP_ALL_DOC_TASKS: ""
# Maximum cache period (in weeks) before forcing a new cache upload.
CACHE_PERIOD: "2"
# Increment the build number to force new cartopy cache upload.
CARTOPY_CACHE_BUILD: "0"
# 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 packages to be upgraded/installed.
PIP_CACHE_PACKAGES: "pip setuptools wheel nox"
# Conda packages to be installed.
CONDA_CACHE_PACKAGES: "nox pip"
# Git commit hash for iris test data.
IRIS_TEST_DATA_VERSION: "2.0.0"
# Base directory for the iris-test-data.
IRIS_TEST_DATA_DIR: ${HOME}/iris-test-data


#
# YAML alias for common linux test infra-structure.
#
linux_task_template: &LINUX_TASK_TEMPLATE
auto_cancellation: true
env:
PATH: ${HOME}/miniconda/bin:${PATH}
SITE_CFG: ${CIRRUS_WORKING_DIR}/lib/iris/etc/site.cfg
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}
cartopy_cache:
folder: ${HOME}/.local/share/cartopy
fingerprint_script:
- echo "${CIRRUS_OS}"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${CARTOPY_CACHE_BUILD}"
nox_cache:
folder: ${CIRRUS_WORKING_DIR}/.nox
reupload_on_changes: true
fingerprint_script:
- echo "${CIRRUS_TASK_NAME}"
- echo "${NOX_CACHE_BUILD}"


#
# YAML alias for compute credits.
#
compute_credits_template: &CREDITS_TEMPLATE
# Only use credits for non-DRAFT pull-requests to SciTools/iris master branch by collaborators
use_compute_credits: ${CIRRUS_REPO_FULL_NAME} == "SciTools/iris" && ${CIRRUS_USER_COLLABORATOR} == "true" && ${CIRRUS_PR_DRAFT} == "false" && ${CIRRUS_PR} != ""


#
# YAML alias for the iris-test-data cache.
#
iris_test_data_template: &IRIS_TEST_DATA_TEMPLATE
data_cache:
folder: ${IRIS_TEST_DATA_DIR}
fingerprint_script:
- echo "iris-test-data v${IRIS_TEST_DATA_VERSION}"
populate_script:
- wget --quiet https://github.com/SciTools/iris-test-data/archive/v${IRIS_TEST_DATA_VERSION}.zip -O iris-test-data.zip
- unzip -q iris-test-data.zip
- mv iris-test-data-${IRIS_TEST_DATA_VERSION} ${IRIS_TEST_DATA_DIR}


#
# Linting
#
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
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
- nox --session flake8
- nox --session black


#
# Testing Minimal (Linux)
#
test_minimal_task:
only_if: ${SKIP_TEST_MINIMAL_TASK} == "" && ${SKIP_ALL_TEST_TASKS} == ""
<< : *CREDITS_TEMPLATE
matrix:
env:
PY_VER: 3.6
env:
PY_VER: 3.7
env:
PY_VER: 3.8
name: "${CIRRUS_OS}: py${PY_VER} tests (minimal)"
<< : *LINUX_TASK_TEMPLATE
tests_script:
- export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)"
- echo "[Resources]" > ${SITE_CFG}
- echo "doc_dir = ${CIRRUS_WORKING_DIR}/docs" >> ${SITE_CFG}
- nox --session tests -- --verbose


#
# Testing Full (Linux)
#
test_full_task:
only_if: ${SKIP_TEST_FULL_TASK} == "" && ${SKIP_ALL_TEST_TASKS} == ""
<< : *CREDITS_TEMPLATE
matrix:
env:
PY_VER: 3.6
env:
PY_VER: 3.7
env:
PY_VER: 3.8
name: "${CIRRUS_OS}: py${PY_VER} tests (full)"
container:
image: gcc:latest
cpu: 6
memory: 8G
<< : *IRIS_TEST_DATA_TEMPLATE
<< : *LINUX_TASK_TEMPLATE
tests_script:
- export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)"
- echo "[Resources]" > ${SITE_CFG}
- echo "test_data_dir = ${IRIS_TEST_DATA_DIR}/test_data" >> ${SITE_CFG}
- echo "doc_dir = ${CIRRUS_WORKING_DIR}/docs" >> ${SITE_CFG}
- nox --session tests -- --verbose


#
# Testing Documentation Gallery (Linux)
#
gallery_task:
only_if: ${SKIP_GALLERY_TASK} == "" && ${SKIP_ALL_DOC_TASKS} == ""
<< : *CREDITS_TEMPLATE
env:
PY_VER: 3.8
name: "${CIRRUS_OS}: py${PY_VER} doc tests (gallery)"
<< : *IRIS_TEST_DATA_TEMPLATE
<< : *LINUX_TASK_TEMPLATE
tests_script:
- export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)"
- echo "[Resources]" > ${SITE_CFG}
- echo "test_data_dir = ${IRIS_TEST_DATA_DIR}/test_data" >> ${SITE_CFG}
- echo "doc_dir = ${CIRRUS_WORKING_DIR}/docs" >> ${SITE_CFG}
- nox --session gallery -- --verbose


#
# Testing Documentation (Linux)
#
doctest_task:
only_if: ${SKIP_DOCTEST_TASK} == "" && ${SKIP_ALL_DOC_TASKS} == ""
<< : *CREDITS_TEMPLATE
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:
- export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)"
- echo "[Resources]" > ${SITE_CFG}
- echo "test_data_dir = ${IRIS_TEST_DATA_DIR}/test_data" >> ${SITE_CFG}
- echo "doc_dir = ${CIRRUS_WORKING_DIR}/docs" >> ${SITE_CFG}
- mkdir -p ${MPL_RC_DIR}
- echo "backend : agg" > ${MPL_RC_FILE}
- echo "image.cmap : viridis" >> ${MPL_RC_FILE}
- nox --session doctest -- --verbose


#
# Testing Documentation Link Check (Linux)
#
linkcheck_task:
only_if: ${SKIP_LINKCHECK_TASK} == "" && ${SKIP_ALL_DOC_TASKS} == ""
<< : *CREDITS_TEMPLATE
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)"
- mkdir -p ${MPL_RC_DIR}
- echo "backend : agg" > ${MPL_RC_FILE}
- echo "image.cmap : viridis" >> ${MPL_RC_FILE}
- nox --session linkcheck -- --verbose
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exclude =
.eggs,
build,
compiled_krb,
docs/iris/src/sphinxext/*,
docs/src/sphinxext/*,
tools/*,
#
# ignore auto-generated files
Expand Down
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ Steps to reproduce the behaviour:
<summary>Click to expand <b>this section...</b></summary>

```
Add additional verbose information in a collapsible section.
Please add additional verbose information in this section e.g., code, output, tracebacks, screenshots etc
```
See [here](https://gist.github.com/pierrejoubert73/902cc94d79424356a8d20be2b382e1ab) for further details.
</details>

3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ assignees: ''
<summary>Click to expand <b>this section...</b></summary>

```
Add additional verbose information in a collapsible section.
Please add additional verbose information in this section e.g., references, screenshots, listings etc
```
See [here](https://gist.github.com/pierrejoubert73/902cc94d79424356a8d20be2b382e1ab) for further details.
</details>

77 changes: 77 additions & 0 deletions .github/workflows/refresh-lockfiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# This workflow periodically creates new environment lock files based on the newest
# available packages and dependencies.
#
# Environment specifications are given as conda environment.yml files found in
# `requirements/ci/py**.yml`. These state the pacakges required, the conda channels
# that the packages will be pulled from, and any versions of packages that need to be
# pinned at specific versions.
#
# For environments that have changed, a pull request will be made and submitted
# to the master branch

name: Refresh Lockfiles


on:
workflow_dispatch:
schedule:
# Run once a week on a Saturday night
- cron: 1 0 * * 6


jobs:

gen_lockfiles:
# this is a matrix job: it splits to create new lockfiles for each
# of the CI test python versions.
# this list below should be changed when covering more python versions
# TODO: generate this matrix automatically from the list of available py**.yml files
# ref: https://tomasvotruba.com/blog/2020/11/16/how-to-make-dynamic-matrix-in-github-actions/
runs-on: ubuntu-latest

strategy:
matrix:
python: ['36', '37', '38']

steps:
- uses: actions/checkout@v2
- name: install conda-lock
run: |
source $CONDA/bin/activate base
conda install -y -c conda-forge conda-lock
- name: generate lockfile
run: |
$CONDA/bin/conda-lock lock -p linux-64 -f requirements/ci/py${{matrix.python}}.yml
mv conda-linux-64.lock py${{matrix.python}}-linux-64.lock
- name: output lockfile
uses: actions/upload-artifact@v2
with:
path: py${{matrix.python}}-linux-64.lock

create_pr:
# once the matrix job has completed all the lock files will have been uploaded as artifacts.
# Download the artifacts, add them to the repo, and create a PR.
runs-on: ubuntu-latest
needs: gen_lockfiles

steps:
- uses: actions/checkout@v2
- name: get artifacts
uses: actions/download-artifact@v2
with:
path: artifacts

- name: Update lock files in repo
run: |
cp artifacts/artifact/*.lock requirements/ci/nox.lock
rm -r artifacts
- name: Create Pull Request
uses: peter-evans/create-pull-request@052fc72b4198ba9fbc81b818c6e1859f747d49a8
with:
commit-message: Updated environment lockfiles
delete-branch: true
branch: auto-update-lockfiles
title: Update CI environment lockfiles
body: |
Lockfiles updated to the latest resolvable environment.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var
sdist
develop-eggs
.installed.cfg
.nox

# Installer logs
pip-log.txt
Expand Down Expand Up @@ -55,11 +56,11 @@ lib/iris/tests/results/imagerepo.lock
*.cover

# Auto generated documentation files
docs/iris/src/_build/*
docs/iris/src/generated
docs/src/_build/*
docs/src/generated

# Example test results
docs/iris/iris_image_test_output/
docs/iris_image_test_output/

# Created by editiors
*~
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v2.4.0'
rev: 'v3.4.0'
hooks:
# Prevent giant files from being committed.
- id: check-added-large-files
Expand All @@ -23,8 +23,8 @@ repos:
# Force black to run on whole repo, using settings from pyproject.toml
pass_filenames: false
args: [--config=./pyproject.toml, .]
- repo: https://gitlab.com/pycqa/flake8
rev: '3.8.3'
- repo: https://github.com/PyCQA/flake8
rev: '3.9.0'
hooks:
# Run flake8.
- id: flake8
Expand Down
Loading

0 comments on commit 9366e71

Please sign in to comment.