From 271daf5eaf5a4470a3fb0ff6fbd85234c9e38db6 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Fri, 14 Jan 2022 09:01:50 +0000 Subject: [PATCH 01/20] adopt ci gha --- .cirrus.yml | 198 ------------------------ .github/workflows/ci-docs-linkcheck.yml | 96 ++++++++++++ .github/workflows/ci-docs-tests.yml | 167 ++++++++++++++++++++ .github/workflows/ci-tests.yml | 151 ++++++++++++++++++ docs/src/whatsnew/latest.rst | 2 +- 5 files changed, 415 insertions(+), 199 deletions(-) delete mode 100644 .cirrus.yml create mode 100644 .github/workflows/ci-docs-linkcheck.yml create mode 100644 .github/workflows/ci-docs-tests.yml create mode 100644 .github/workflows/ci-tests.yml diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index cbc8a146ef..0000000000 --- a/.cirrus.yml +++ /dev/null @@ -1,198 +0,0 @@ -# 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_TASK: "" - SKIP_DOCTEST_TASK: "" - SKIP_LINKCHECK_TASK: "" - # Skip task groups by type. Set to a non-empty string to skip. - 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: "3" - # 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: "2" - # Increment the build number to force new pip cache upload. - PIP_CACHE_BUILD: "0" - # Pip packages to be upgraded/installed. - PIP_CACHE_PACKAGES: "nox pip pyyaml setuptools wheel" - # Conda packages to be installed. - CONDA_CACHE_PACKAGES: "nox pip" - # Git commit hash for iris test data. - IRIS_TEST_DATA_VERSION: "2.9" - # 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: - - 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}" - populate_script: - - conda create --quiet --name cartopy-cache cartopy - - source ${HOME}/miniconda/etc/profile.d/conda.sh >/dev/null 2>&1 - - conda activate cartopy-cache >/dev/null 2>&1 - - cd $(mktemp -d) - - wget --quiet https://raw.githubusercontent.com/SciTools/cartopy/v0.20.0/tools/cartopy_feature_download.py - - python cartopy_feature_download.py physical --output ${HOME}/.local/share/cartopy --no-warn - - conda deactivate >/dev/null 2>&1 - 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 - # Restrict where compute credits are used. - 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 -# -task: - only_if: ${SKIP_LINT_TASK} == "" - << : *CREDITS_TEMPLATE - auto_cancellation: true - container: - image: python:3.8 - cpu: 2 - memory: 4G - name: "${CIRRUS_OS}: pre-commit hooks" - 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}" - precommit_script: - - pip list - - python -m pip install --retries 3 --upgrade ${PIP_CACHE_PACKAGES} - - pip list - - nox --session precommit - - -# -# Testing (Linux) -# -task: - only_if: ${SKIP_TEST_TASK} == "" - << : *CREDITS_TEMPLATE - matrix: - env: - PY_VER: 3.8 - name: "${CIRRUS_OS}: py${PY_VER} tests" - container: - image: gcc:latest - cpu: 6 - memory: 8G - << : *IRIS_TEST_DATA_TEMPLATE - << : *LINUX_TASK_TEMPLATE - tests_script: - - 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 - - -# -# Documentation Testing and Gallery (Linux) -# -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} doctests and gallery" - << : *IRIS_TEST_DATA_TEMPLATE - << : *LINUX_TASK_TEMPLATE - tests_script: - - 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 - - -# -# Documentation Link Check (Linux) -# -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} link check" - << : *LINUX_TASK_TEMPLATE - tests_script: - - mkdir -p ${MPL_RC_DIR} - - echo "backend : agg" > ${MPL_RC_FILE} - - echo "image.cmap : viridis" >> ${MPL_RC_FILE} - - nox --session linkcheck -- --verbose diff --git a/.github/workflows/ci-docs-linkcheck.yml b/.github/workflows/ci-docs-linkcheck.yml new file mode 100644 index 0000000000..803ee416ec --- /dev/null +++ b/.github/workflows/ci-docs-linkcheck.yml @@ -0,0 +1,96 @@ +# reference: +# - https://github.com/actions/cache +# - https://github.com/actions/checkout +# - https://github.com/marketplace/actions/setup-miniconda + +name: ci-docs-linkcheck + +on: + push: + branches: + - "*" + + pull_request: + branches: + - "*" + +jobs: + tests: + name: ${{ matrix.os }} ${{ matrix.python-version }} + + runs-on: ${{ matrix.os }} + + defaults: + run: + shell: bash -l {0} + + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest"] + python-version: ["3.8"] + include: + - os: ubuntu-latest + lock-file: requirements/ci/nox.lock/py38-linux-64.lock + + env: + ENV_NAME: "iris-ci" + + steps: + - name: "Checkout" + uses: actions/checkout@v2 + + - name: "Conda package cache" + uses: actions/cache@v2 + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + LOCK_FILE: ${{ matrix.lock-file }} + with: + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-conda-pkgs-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + + - name: "Conda install" + uses: conda-incubator/setup-miniconda@v2 + with: + miniforge-variant: Mambaforge + miniforge-version: latest + use-mamba: true + activate-environment: ${{ env.ENV_NAME }} + auto-update-conda: false + use-only-tar-bz2: true + + - name: "Conda environment cache" + uses: actions/cache@v2 + id: conda-env-cache + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + LOCK_FILE: ${{ matrix.lock-file }} + with: + path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} + key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + + - name: "Conda environment update" + if: steps.conda-env-cache.outputs.cache-hit != 'true' + run: | + mamba install --name ${{ env.ENV_NAME }} --file ${{ matrix.lock-file }} + + - name: "Conda info" + run: | + conda info + conda list + + - name: "Iris install" + run: | + python -m pip install --no-deps -e . + + - name: "Iris import" + run: | + python -c "import iris; print(f'Iris v{iris.__version__}')" + + - name: "Iris linkcheck" + run: | + cd docs + make clean + make linkcheck diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml new file mode 100644 index 0000000000..719ce2cbc4 --- /dev/null +++ b/.github/workflows/ci-docs-tests.yml @@ -0,0 +1,167 @@ +# reference: +# - https://github.com/actions/cache +# - https://github.com/actions/checkout +# - https://github.com/marketplace/actions/setup-miniconda + +name: ci-docs-tests + +on: + push: + branches: + - "*" + + pull_request: + branches: + - "*" + +jobs: + tests: + name: ${{ matrix.os }} ${{ matrix.python-version }} + + runs-on: ${{ matrix.os }} + + defaults: + run: + shell: bash -l {0} + + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest"] + python-version: ["3.8"] + include: + - os: ubuntu-latest + lock-file: requirements/ci/nox.lock/py38-linux-64.lock + + env: + IRIS_TEST_DATA_VERSION: "2.5" + ENV_NAME: "iris-ci" + # https://github.com/numpy/numpy/pull/19478 + NPY_DISABLE_CPU_FEATURES: "AVX512F,AVX512CD,AVX512VL,AVX512BW,AVX512DQ,AVX512_SKX" + + steps: + - name: "Checkout" + uses: actions/checkout@v2 + + - name: "Environment configure" + env: + # Maximum cache period (in weeks) before forcing a cache refresh. + CACHE_WEEKS: 2 + run: | + echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV} + + - name: "Data cache" + uses: actions/cache@v2 + id: data-cache + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + with: + path: ~/iris-test-data + key: ${{ runner.os }}-iris-test-data-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} + + - name: "Data cache populate" + if: steps.data-cache.outputs.cache-hit != 'true' + run: | + wget --quiet https://github.com/SciTools/iris-test-data/archive/v${{ env.IRIS_TEST_DATA_VERSION }}.zip -O iris-test-data.zip + unzip -q iris-test-data.zip + mv iris-test-data-${{ env.IRIS_TEST_DATA_VERSION }} ${HOME}/iris-test-data + + - name: "Conda package cache" + uses: actions/cache@v2 + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + LOCK_FILE: ${{ matrix.lock-file }} + with: + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-conda-pkgs-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + + - name: "Conda install" + uses: conda-incubator/setup-miniconda@v2 + with: + miniforge-variant: Mambaforge + miniforge-version: latest + use-mamba: true + activate-environment: ${{ env.ENV_NAME }} + auto-update-conda: false + use-only-tar-bz2: true + + - name: "Conda environment cache" + uses: actions/cache@v2 + id: conda-env-cache + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + LOCK_FILE: ${{ matrix.lock-file }} + with: + path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} + key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + + - name: "Conda environment update" + if: steps.conda-env-cache.outputs.cache-hit != 'true' + run: | + mamba install --name ${{ env.ENV_NAME }} --file ${{ matrix.lock-file }} + + - name: "Conda info" + run: | + conda info + conda list + + - name: "Cartopy cache" + uses: actions/cache@v2 + id: cartopy-cache + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + with: + path: ~/.local/share/cartopy + key: ${{ runner.os }}-cartopy-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + + - name: "Cartopy cache populate" + if: steps.cartopy-cache.outputs.cache-hit != 'true' + env: + CARTOPY_SHARE_DIR: ~/.local/share/cartopy + CARTOPY_FEATURE: https://raw.githubusercontent.com/SciTools/cartopy/v0.20.0/tools/cartopy_feature_download.py + run: | + wget --quiet ${CARTOPY_FEATURE} + mkdir -p ${CARTOPY_SHARE_DIR} + # Requires a pre-installed version of cartopy within the environment. + python cartopy_feature_download.py physical --output ${CARTOPY_SHARE_DIR} --no-warn + + - name: "Iris install" + run: | + python -m pip install --no-deps -e . + + - name: "Iris configure" + env: + SITE_CFG: lib/iris/etc/site.cfg + MPL_RC: ${HOME}/.config/matplotlib/matplotlibrc + run: | + mkdir -p $(dirname ${SITE_CFG}) + echo ${SITE_CFG} + echo "[Resources]" >> ${SITE_CFG} + echo "test_data_dir = ${HOME}/iris-test-data/test_data" >> ${SITE_CFG} + echo "doc_dir = ${GITHUB_WORKSPACE}/docs" >> ${SITE_CFG} + cat ${SITE_CFG} + mkdir -p $(dirname ${MPL_RC}) + echo ${MPL_RC} + echo "backend : agg" >> ${MPL_RC} + echo "image.cmap : viridis" >> ${MPL_RC} + cat ${MPL_RC} + + - name: "Iris import" + run: | + python -c "import iris; print(f'Iris v{iris.__version__}')" + + - name: "Iris doctests" + run: | + cd docs + make clean + make html + make doctest + + - name: "Iris gallery tests" + run: | + cd docs + python -m iris.tests.runner --gallery-tests diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml new file mode 100644 index 0000000000..34438f3227 --- /dev/null +++ b/.github/workflows/ci-tests.yml @@ -0,0 +1,151 @@ +# reference: +# - https://github.com/actions/cache +# - https://github.com/actions/checkout +# - https://github.com/marketplace/actions/setup-miniconda + +name: ci-tests + +on: + push: + branches: + - "*" + + pull_request: + branches: + - "*" + +jobs: + tests: + name: ${{ matrix.os }} ${{ matrix.python-version }} + + runs-on: ${{ matrix.os }} + + defaults: + run: + shell: bash -l {0} + + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest"] + python-version: ["3.8"] + include: + - os: ubuntu-latest + lock-file: requirements/ci/nox.lock/py38-linux-64.lock + + env: + IRIS_TEST_DATA_VERSION: "2.5" + ENV_NAME: "iris-ci" + # https://github.com/numpy/numpy/pull/19478 + NPY_DISABLE_CPU_FEATURES: "AVX512F,AVX512CD,AVX512VL,AVX512BW,AVX512DQ,AVX512_SKX" + + steps: + - name: "Checkout" + uses: actions/checkout@v2 + + - name: "Environment configure" + env: + # Maximum cache period (in weeks) before forcing a cache refresh. + CACHE_WEEKS: 2 + run: | + echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV} + + - name: "Data cache" + uses: actions/cache@v2 + id: data-cache + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + with: + path: ~/iris-test-data + key: ${{ runner.os }}-iris-test-data-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} + + - name: "Data cache populate" + if: steps.data-cache.outputs.cache-hit != 'true' + run: | + wget --quiet https://github.com/SciTools/iris-test-data/archive/v${{ env.IRIS_TEST_DATA_VERSION }}.zip -O iris-test-data.zip + unzip -q iris-test-data.zip + mv iris-test-data-${{ env.IRIS_TEST_DATA_VERSION }} ${HOME}/iris-test-data + + - name: "Conda package cache" + uses: actions/cache@v2 + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + LOCK_FILE: ${{ matrix.lock-file }} + with: + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-conda-pkgs-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + + - name: "Conda install" + uses: conda-incubator/setup-miniconda@v2 + with: + miniforge-variant: Mambaforge + miniforge-version: latest + use-mamba: true + activate-environment: ${{ env.ENV_NAME }} + auto-update-conda: false + use-only-tar-bz2: true + + - name: "Conda environment cache" + uses: actions/cache@v2 + id: conda-env-cache + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + LOCK_FILE: ${{ matrix.lock-file }} + with: + path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} + key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + + - name: "Conda environment update" + if: steps.conda-env-cache.outputs.cache-hit != 'true' + run: | + mamba install --name ${{ env.ENV_NAME }} --file ${{ matrix.lock-file }} + + - name: "Conda info" + run: | + conda info + conda list + + - name: "Cartopy cache" + uses: actions/cache@v2 + id: cartopy-cache + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + with: + path: ~/.local/share/cartopy + key: ${{ runner.os }}-cartopy-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + + - name: "Cartopy cache populate" + if: steps.cartopy-cache.outputs.cache-hit != 'true' + env: + CARTOPY_SHARE_DIR: ~/.local/share/cartopy + CARTOPY_FEATURE: https://raw.githubusercontent.com/SciTools/cartopy/v0.20.0/tools/cartopy_feature_download.py + run: | + wget --quiet ${CARTOPY_FEATURE} + mkdir -p ${CARTOPY_SHARE_DIR} + # Requires a pre-installed version of cartopy within the environment. + python cartopy_feature_download.py physical --output ${CARTOPY_SHARE_DIR} --no-warn + + - name: "Iris install" + run: | + python -m pip install --no-deps -e . + + - name: "Iris configure" + env: + SITE_CFG: lib/iris/etc/site.cfg + run: | + echo "[Resources]" >> ${SITE_CFG} + echo "test_data_dir = ${HOME}/iris-test-data/test_data" >> ${SITE_CFG} + echo "doc_dir = ${GITHUB_WORKSPACE}/docs" >> ${SITE_CFG} + cat ${SITE_CFG} + + - name: "Iris import" + run: | + python -c "import iris; print(f'Iris v{iris.__version__}')" + + - name: "Iris test" + run: | + python -m iris.tests.runner --default-tests --system-tests diff --git a/docs/src/whatsnew/latest.rst b/docs/src/whatsnew/latest.rst index e7edafb58d..c1e8404e2a 100644 --- a/docs/src/whatsnew/latest.rst +++ b/docs/src/whatsnew/latest.rst @@ -222,4 +222,4 @@ This document explains the changes made to Iris for this release Whatsnew resources in alphabetical order: .. _Cell Boundaries: https://cfconventions.org/Data/cf-conventions/cf-conventions-1.9/cf-conventions.html#cell-boundaries -.. _PyData Sphinx Theme: https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html \ No newline at end of file +.. _PyData Sphinx Theme: https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html From 632990eee9110802136bde25da6a2182553d6069 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Tue, 14 Jun 2022 14:59:05 +0100 Subject: [PATCH 02/20] bump iris-test-data to latest version --- .github/workflows/ci-docs-tests.yml | 2 +- .github/workflows/ci-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index 719ce2cbc4..fd5ce6bfdc 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -34,7 +34,7 @@ jobs: lock-file: requirements/ci/nox.lock/py38-linux-64.lock env: - IRIS_TEST_DATA_VERSION: "2.5" + IRIS_TEST_DATA_VERSION: "2.9" ENV_NAME: "iris-ci" # https://github.com/numpy/numpy/pull/19478 NPY_DISABLE_CPU_FEATURES: "AVX512F,AVX512CD,AVX512VL,AVX512BW,AVX512DQ,AVX512_SKX" diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 34438f3227..6f955d984c 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -34,7 +34,7 @@ jobs: lock-file: requirements/ci/nox.lock/py38-linux-64.lock env: - IRIS_TEST_DATA_VERSION: "2.5" + IRIS_TEST_DATA_VERSION: "2.9" ENV_NAME: "iris-ci" # https://github.com/numpy/numpy/pull/19478 NPY_DISABLE_CPU_FEATURES: "AVX512F,AVX512CD,AVX512VL,AVX512BW,AVX512DQ,AVX512_SKX" From 55155ba48d3d499f76c23c3fa44af2acb9d88941 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Wed, 15 Jun 2022 12:02:09 +0100 Subject: [PATCH 03/20] ci noxify --- .github/workflows/ci-docs-linkcheck.yml | 74 +++++++++++--------- .github/workflows/ci-docs-tests.yml | 89 +++++++++++-------------- .github/workflows/ci-tests.yml | 83 +++++++++++------------ 3 files changed, 121 insertions(+), 125 deletions(-) diff --git a/.github/workflows/ci-docs-linkcheck.yml b/.github/workflows/ci-docs-linkcheck.yml index 803ee416ec..ac877d5557 100644 --- a/.github/workflows/ci-docs-linkcheck.yml +++ b/.github/workflows/ci-docs-linkcheck.yml @@ -16,7 +16,7 @@ on: jobs: tests: - name: ${{ matrix.os }} ${{ matrix.python-version }} + name: "linkcheck ${{ matrix.os }} ${{ matrix.python-version }}" runs-on: ${{ matrix.os }} @@ -25,72 +25,84 @@ jobs: shell: bash -l {0} strategy: - fail-fast: false matrix: os: ["ubuntu-latest"] python-version: ["3.8"] - include: - - os: ubuntu-latest - lock-file: requirements/ci/nox.lock/py38-linux-64.lock env: - ENV_NAME: "iris-ci" + ENV_NAME: "ci-docs-linkcheck" steps: - - name: "Checkout" - uses: actions/checkout@v2 + - name: "checkout" + uses: actions/checkout@v3 - - name: "Conda package cache" - uses: actions/cache@v2 + - name: "environment configure" + env: + # Maximum cache period (in weeks) before forcing a cache refresh. + CACHE_WEEKS: 2 + run: | + echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV} + echo "LOCK_FILE=requirements/ci/nox.lock/py$(echo ${{ matrix.python-version }} | tr -d '.')-linux-64.lock" >> ${GITHUB_ENV} + + - name: "conda package cache" + uses: actions/cache@v3 env: # Increment the build number to force a cache refresh. CACHE_BUILD: 0 - LOCK_FILE: ${{ matrix.lock-file }} with: path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-pkgs-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + key: dummy-${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - name: "Conda install" + - name: "conda install" uses: conda-incubator/setup-miniconda@v2 with: - miniforge-variant: Mambaforge miniforge-version: latest - use-mamba: true + channels: conda-forge,defaults activate-environment: ${{ env.ENV_NAME }} auto-update-conda: false use-only-tar-bz2: true - - name: "Conda environment cache" - uses: actions/cache@v2 + - name: "conda environment cache" + uses: actions/cache@v3 id: conda-env-cache env: # Increment the build number to force a cache refresh. CACHE_BUILD: 0 - LOCK_FILE: ${{ matrix.lock-file }} with: path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} - key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - name: "Conda environment update" + - name: "conda environment update" if: steps.conda-env-cache.outputs.cache-hit != 'true' run: | - mamba install --name ${{ env.ENV_NAME }} --file ${{ matrix.lock-file }} + conda install --quiet --name ${{ env.ENV_NAME }} nox pip - - name: "Conda info" + - name: "conda info" run: | conda info conda list - - name: "Iris install" - run: | - python -m pip install --no-deps -e . + - name: "nox cache" + uses: actions/cache@v3 + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + with: + path: ${{ github.workspace }}/.nox + key: dummy-${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} - - name: "Iris import" + - name: "iris configure" + env: + MPL_RC: ${HOME}/.config/matplotlib/matplotlibrc run: | - python -c "import iris; print(f'Iris v{iris.__version__}')" + mkdir -p $(dirname ${MPL_RC}) + echo ${MPL_RC} + echo "backend : agg" >> ${MPL_RC} + echo "image.cmap : viridis" >> ${MPL_RC} + cat ${MPL_RC} - - name: "Iris linkcheck" + - name: "iris linkcheck" + env: + PY_VER: ${{ matrix.python-version }} run: | - cd docs - make clean - make linkcheck + nox --session linkcheck -- --verbose diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index fd5ce6bfdc..1d6633a543 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -16,7 +16,7 @@ on: jobs: tests: - name: ${{ matrix.os }} ${{ matrix.python-version }} + name: "doctests ${{ matrix.os }} ${{ matrix.python-version }}" runs-on: ${{ matrix.os }} @@ -25,100 +25,92 @@ jobs: shell: bash -l {0} strategy: - fail-fast: false matrix: os: ["ubuntu-latest"] python-version: ["3.8"] - include: - - os: ubuntu-latest - lock-file: requirements/ci/nox.lock/py38-linux-64.lock env: IRIS_TEST_DATA_VERSION: "2.9" - ENV_NAME: "iris-ci" - # https://github.com/numpy/numpy/pull/19478 - NPY_DISABLE_CPU_FEATURES: "AVX512F,AVX512CD,AVX512VL,AVX512BW,AVX512DQ,AVX512_SKX" + ENV_NAME: "ci-docs-tests" steps: - - name: "Checkout" - uses: actions/checkout@v2 + - name: "checkout" + uses: actions/checkout@v3 - - name: "Environment configure" + - name: "environment configure" env: # Maximum cache period (in weeks) before forcing a cache refresh. CACHE_WEEKS: 2 run: | echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV} + echo "LOCK_FILE=requirements/ci/nox.lock/py$(echo ${{ matrix.python-version }} | tr -d '.')-linux-64.lock" >> ${GITHUB_ENV} - - name: "Data cache" - uses: actions/cache@v2 + - name: "data cache" + uses: actions/cache@v3 id: data-cache env: # Increment the build number to force a cache refresh. CACHE_BUILD: 0 with: path: ~/iris-test-data - key: ${{ runner.os }}-iris-test-data-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} + key: dummy-${{ runner.os }}-iris-test-data-${{ env.ENV_NAME }}-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} - - name: "Data cache populate" + - name: "data cache populate" if: steps.data-cache.outputs.cache-hit != 'true' run: | wget --quiet https://github.com/SciTools/iris-test-data/archive/v${{ env.IRIS_TEST_DATA_VERSION }}.zip -O iris-test-data.zip unzip -q iris-test-data.zip mv iris-test-data-${{ env.IRIS_TEST_DATA_VERSION }} ${HOME}/iris-test-data - - name: "Conda package cache" - uses: actions/cache@v2 + - name: "conda package cache" + uses: actions/cache@v3 env: # Increment the build number to force a cache refresh. CACHE_BUILD: 0 - LOCK_FILE: ${{ matrix.lock-file }} with: path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-pkgs-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + key: dummy-${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - name: "Conda install" + - name: "conda install" uses: conda-incubator/setup-miniconda@v2 with: - miniforge-variant: Mambaforge miniforge-version: latest - use-mamba: true + channels: conda-forge,defaults activate-environment: ${{ env.ENV_NAME }} auto-update-conda: false use-only-tar-bz2: true - - name: "Conda environment cache" - uses: actions/cache@v2 + - name: "conda environment cache" + uses: actions/cache@v3 id: conda-env-cache env: # Increment the build number to force a cache refresh. CACHE_BUILD: 0 - LOCK_FILE: ${{ matrix.lock-file }} with: path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} - key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + key: dummy-${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - name: "Conda environment update" + - name: "conda environment update" if: steps.conda-env-cache.outputs.cache-hit != 'true' run: | - mamba install --name ${{ env.ENV_NAME }} --file ${{ matrix.lock-file }} + conda install --quiet --name ${{ env.ENV_NAME }} cartopy nox pip - - name: "Conda info" + - name: "conda info" run: | conda info conda list - - name: "Cartopy cache" - uses: actions/cache@v2 + - name: "cartopy cache" + uses: actions/cache@v3 id: cartopy-cache env: # Increment the build number to force a cache refresh. CACHE_BUILD: 0 with: path: ~/.local/share/cartopy - key: ${{ runner.os }}-cartopy-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + key: dummy-${{ runner.os }}-cartopy-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - name: "Cartopy cache populate" + - name: "cartopy cache populate" if: steps.cartopy-cache.outputs.cache-hit != 'true' env: CARTOPY_SHARE_DIR: ~/.local/share/cartopy @@ -129,11 +121,16 @@ jobs: # Requires a pre-installed version of cartopy within the environment. python cartopy_feature_download.py physical --output ${CARTOPY_SHARE_DIR} --no-warn - - name: "Iris install" - run: | - python -m pip install --no-deps -e . + - name: "nox cache" + uses: actions/cache@v3 + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + with: + path: ${{ github.workspace }}/.nox + key: dummy-${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} - - name: "Iris configure" + - name: "iris configure" env: SITE_CFG: lib/iris/etc/site.cfg MPL_RC: ${HOME}/.config/matplotlib/matplotlibrc @@ -150,18 +147,8 @@ jobs: echo "image.cmap : viridis" >> ${MPL_RC} cat ${MPL_RC} - - name: "Iris import" - run: | - python -c "import iris; print(f'Iris v{iris.__version__}')" - - - name: "Iris doctests" - run: | - cd docs - make clean - make html - make doctest - - - name: "Iris gallery tests" + - name: "iris doctests and gallery" + env: + PY_VER: ${{ matrix.python-version }} run: | - cd docs - python -m iris.tests.runner --gallery-tests + nox --session doctest -- --verbose diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 6f955d984c..8c73e482ec 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -16,7 +16,7 @@ on: jobs: tests: - name: ${{ matrix.os }} ${{ matrix.python-version }} + name: "tests ${{ matrix.os }} ${{ matrix.python-version }}" runs-on: ${{ matrix.os }} @@ -25,100 +25,92 @@ jobs: shell: bash -l {0} strategy: - fail-fast: false matrix: os: ["ubuntu-latest"] python-version: ["3.8"] - include: - - os: ubuntu-latest - lock-file: requirements/ci/nox.lock/py38-linux-64.lock env: IRIS_TEST_DATA_VERSION: "2.9" - ENV_NAME: "iris-ci" - # https://github.com/numpy/numpy/pull/19478 - NPY_DISABLE_CPU_FEATURES: "AVX512F,AVX512CD,AVX512VL,AVX512BW,AVX512DQ,AVX512_SKX" + ENV_NAME: "ci-tests" steps: - - name: "Checkout" - uses: actions/checkout@v2 + - name: "checkout" + uses: actions/checkout@v3 - - name: "Environment configure" + - name: "environment configure" env: # Maximum cache period (in weeks) before forcing a cache refresh. CACHE_WEEKS: 2 run: | echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV} + echo "LOCK_FILE=requirements/ci/nox.lock/py$(echo ${{ matrix.python-version }} | tr -d '.')-linux-64.lock" >> ${GITHUB_ENV} - - name: "Data cache" - uses: actions/cache@v2 + - name: "data cache" + uses: actions/cache@v3 id: data-cache env: # Increment the build number to force a cache refresh. CACHE_BUILD: 0 with: path: ~/iris-test-data - key: ${{ runner.os }}-iris-test-data-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} + key: dummy-${{ runner.os }}-iris-test-data-${{ env.ENV_NAME }}-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} - - name: "Data cache populate" + - name: "data cache populate" if: steps.data-cache.outputs.cache-hit != 'true' run: | wget --quiet https://github.com/SciTools/iris-test-data/archive/v${{ env.IRIS_TEST_DATA_VERSION }}.zip -O iris-test-data.zip unzip -q iris-test-data.zip mv iris-test-data-${{ env.IRIS_TEST_DATA_VERSION }} ${HOME}/iris-test-data - - name: "Conda package cache" - uses: actions/cache@v2 + - name: "conda package cache" + uses: actions/cache@v3 env: # Increment the build number to force a cache refresh. CACHE_BUILD: 0 - LOCK_FILE: ${{ matrix.lock-file }} with: path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-pkgs-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + key: dummy-${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - name: "Conda install" + - name: "conda install" uses: conda-incubator/setup-miniconda@v2 with: - miniforge-variant: Mambaforge miniforge-version: latest - use-mamba: true + channels: conda-forge,defaults activate-environment: ${{ env.ENV_NAME }} auto-update-conda: false use-only-tar-bz2: true - - name: "Conda environment cache" - uses: actions/cache@v2 + - name: "conda environment cache" + uses: actions/cache@v3 id: conda-env-cache env: # Increment the build number to force a cache refresh. CACHE_BUILD: 0 - LOCK_FILE: ${{ matrix.lock-file }} with: path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} - key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + key: dummy-${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - name: "Conda environment update" + - name: "conda environment update" if: steps.conda-env-cache.outputs.cache-hit != 'true' run: | - mamba install --name ${{ env.ENV_NAME }} --file ${{ matrix.lock-file }} + conda install --quiet --name ${{ env.ENV_NAME }} cartopy nox pip - - name: "Conda info" + - name: "conda info" run: | conda info conda list - - name: "Cartopy cache" - uses: actions/cache@v2 + - name: "cartopy cache" + uses: actions/cache@v3 id: cartopy-cache env: # Increment the build number to force a cache refresh. CACHE_BUILD: 0 with: path: ~/.local/share/cartopy - key: ${{ runner.os }}-cartopy-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + key: dummy-${{ runner.os }}-cartopy-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - name: "Cartopy cache populate" + - name: "cartopy cache populate" if: steps.cartopy-cache.outputs.cache-hit != 'true' env: CARTOPY_SHARE_DIR: ~/.local/share/cartopy @@ -129,23 +121,28 @@ jobs: # Requires a pre-installed version of cartopy within the environment. python cartopy_feature_download.py physical --output ${CARTOPY_SHARE_DIR} --no-warn - - name: "Iris install" - run: | - python -m pip install --no-deps -e . + - name: "nox cache" + uses: actions/cache@v3 + env: + # Increment the build number to force a cache refresh. + CACHE_BUILD: 0 + with: + path: ${{ github.workspace }}/.nox + key: dummy-${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} - - name: "Iris configure" + - name: "iris configure" env: SITE_CFG: lib/iris/etc/site.cfg run: | + mkdir -p $(dirname ${SITE_CFG}) + echo ${SITE_CFG} echo "[Resources]" >> ${SITE_CFG} echo "test_data_dir = ${HOME}/iris-test-data/test_data" >> ${SITE_CFG} echo "doc_dir = ${GITHUB_WORKSPACE}/docs" >> ${SITE_CFG} cat ${SITE_CFG} - - name: "Iris import" - run: | - python -c "import iris; print(f'Iris v{iris.__version__}')" - - - name: "Iris test" + - name: "iris tests" + env: + PY_VER: ${{ matrix.python-version }} run: | - python -m iris.tests.runner --default-tests --system-tests + nox --session tests -- --verbose From 362e270f0c9d934198e741633c16aa02f592f0da Mon Sep 17 00:00:00 2001 From: Bill Little Date: Wed, 15 Jun 2022 16:06:43 +0100 Subject: [PATCH 04/20] remove dummy cache key name --- .github/workflows/ci-docs-linkcheck.yml | 4 ++-- .github/workflows/ci-docs-tests.yml | 10 +++++----- .github/workflows/ci-tests.yml | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-docs-linkcheck.yml b/.github/workflows/ci-docs-linkcheck.yml index ac877d5557..eae70e0650 100644 --- a/.github/workflows/ci-docs-linkcheck.yml +++ b/.github/workflows/ci-docs-linkcheck.yml @@ -51,7 +51,7 @@ jobs: CACHE_BUILD: 0 with: path: ~/conda_pkgs_dir - key: dummy-${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + key: ${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - name: "conda install" uses: conda-incubator/setup-miniconda@v2 @@ -89,7 +89,7 @@ jobs: CACHE_BUILD: 0 with: path: ${{ github.workspace }}/.nox - key: dummy-${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} - name: "iris configure" env: diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index 1d6633a543..b2d3197a6c 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -53,7 +53,7 @@ jobs: CACHE_BUILD: 0 with: path: ~/iris-test-data - key: dummy-${{ runner.os }}-iris-test-data-${{ env.ENV_NAME }}-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} + key: ${{ runner.os }}-iris-test-data-${{ env.ENV_NAME }}-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} - name: "data cache populate" if: steps.data-cache.outputs.cache-hit != 'true' @@ -69,7 +69,7 @@ jobs: CACHE_BUILD: 0 with: path: ~/conda_pkgs_dir - key: dummy-${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + key: ${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - name: "conda install" uses: conda-incubator/setup-miniconda@v2 @@ -88,7 +88,7 @@ jobs: CACHE_BUILD: 0 with: path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} - key: dummy-${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - name: "conda environment update" if: steps.conda-env-cache.outputs.cache-hit != 'true' @@ -108,7 +108,7 @@ jobs: CACHE_BUILD: 0 with: path: ~/.local/share/cartopy - key: dummy-${{ runner.os }}-cartopy-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + key: ${{ runner.os }}-cartopy-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - name: "cartopy cache populate" if: steps.cartopy-cache.outputs.cache-hit != 'true' @@ -128,7 +128,7 @@ jobs: CACHE_BUILD: 0 with: path: ${{ github.workspace }}/.nox - key: dummy-${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} - name: "iris configure" env: diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 8c73e482ec..c094ea090d 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -53,7 +53,7 @@ jobs: CACHE_BUILD: 0 with: path: ~/iris-test-data - key: dummy-${{ runner.os }}-iris-test-data-${{ env.ENV_NAME }}-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} + key: ${{ runner.os }}-iris-test-data-${{ env.ENV_NAME }}-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} - name: "data cache populate" if: steps.data-cache.outputs.cache-hit != 'true' @@ -69,7 +69,7 @@ jobs: CACHE_BUILD: 0 with: path: ~/conda_pkgs_dir - key: dummy-${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + key: ${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - name: "conda install" uses: conda-incubator/setup-miniconda@v2 @@ -88,7 +88,7 @@ jobs: CACHE_BUILD: 0 with: path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} - key: dummy-${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - name: "conda environment update" if: steps.conda-env-cache.outputs.cache-hit != 'true' @@ -108,7 +108,7 @@ jobs: CACHE_BUILD: 0 with: path: ~/.local/share/cartopy - key: dummy-${{ runner.os }}-cartopy-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + key: ${{ runner.os }}-cartopy-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - name: "cartopy cache populate" if: steps.cartopy-cache.outputs.cache-hit != 'true' @@ -128,7 +128,7 @@ jobs: CACHE_BUILD: 0 with: path: ${{ github.workspace }}/.nox - key: dummy-${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} - name: "iris configure" env: From 8c8cb333d1c2e13fc38a3827b3eccfbfeecfa557 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Wed, 15 Jun 2022 16:08:19 +0100 Subject: [PATCH 05/20] remove precommit nox task --- noxfile.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/noxfile.py b/noxfile.py index 7919dfdfde..0de7b3a63c 100755 --- a/noxfile.py +++ b/noxfile.py @@ -173,41 +173,6 @@ def prepare_venv(session: nox.sessions.Session) -> None: ) -@nox.session -def precommit(session: nox.sessions.Session): - """ - Perform pre-commit hooks of iris codebase. - - Parameters - ---------- - session: object - A `nox.sessions.Session` object. - - """ - import yaml - - # Pip install the session requirements. - session.install("pre-commit") - - # Load the pre-commit configuration YAML file. - with open(".pre-commit-config.yaml", "r") as fi: - config = yaml.load(fi, Loader=yaml.FullLoader) - - # List of pre-commit hook ids that we don't want to run. - excluded = ["no-commit-to-branch"] - - # Enumerate the ids of pre-commit hooks we do want to run. - ids = [ - hook["id"] - for entry in config["repos"] - for hook in entry["hooks"] - if hook["id"] not in excluded - ] - - # Execute the pre-commit hooks. - [session.run("pre-commit", "run", "--all-files", id) for id in ids] - - @nox.session(python=PY_VER, venv_backend="conda") def tests(session: nox.sessions.Session): """ From 0cf86c37d365fb912c21cb5b13e5f050ac5d2756 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Wed, 15 Jun 2022 16:32:23 +0100 Subject: [PATCH 06/20] added whatsnew entry --- docs/src/whatsnew/latest.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/src/whatsnew/latest.rst b/docs/src/whatsnew/latest.rst index c1e8404e2a..ff737d104a 100644 --- a/docs/src/whatsnew/latest.rst +++ b/docs/src/whatsnew/latest.rst @@ -210,6 +210,9 @@ This document explains the changes made to Iris for this release #. `@wjbenfold`_ made :func:`iris.tests.stock.simple_1d` respect the ``with_bounds`` argument. (:pull:`4658`) +#. `@bjlittle`_ migrated to GitHub Actions for Continuous-Integration. + (:pull:`4503`) + .. comment Whatsnew author names (@github name) in alphabetical order. Note that, From 3e1e69713834e912d2228deb4fea376a7a41fc87 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 09:00:53 +0100 Subject: [PATCH 07/20] remove mpl cfg for linkcheck --- .github/workflows/ci-docs-linkcheck.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/ci-docs-linkcheck.yml b/.github/workflows/ci-docs-linkcheck.yml index eae70e0650..8ef4da9a3c 100644 --- a/.github/workflows/ci-docs-linkcheck.yml +++ b/.github/workflows/ci-docs-linkcheck.yml @@ -91,16 +91,6 @@ jobs: path: ${{ github.workspace }}/.nox key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} - - name: "iris configure" - env: - MPL_RC: ${HOME}/.config/matplotlib/matplotlibrc - run: | - mkdir -p $(dirname ${MPL_RC}) - echo ${MPL_RC} - echo "backend : agg" >> ${MPL_RC} - echo "image.cmap : viridis" >> ${MPL_RC} - cat ${MPL_RC} - - name: "iris linkcheck" env: PY_VER: ${{ matrix.python-version }} From 4a7fdf042b6198fd8e9d2d63bda7fd5cc2b85ac0 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 11:56:38 +0100 Subject: [PATCH 08/20] trial composite nox-cache --- .github/workflows/ci-docs-linkcheck.yml | 9 +++----- .github/workflows/ci-docs-tests.yml | 9 +++----- .github/workflows/ci-tests.yml | 9 +++----- .../workflows/composite/nox-cache/action.yml | 21 +++++++++++++++++++ 4 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/composite/nox-cache/action.yml diff --git a/.github/workflows/ci-docs-linkcheck.yml b/.github/workflows/ci-docs-linkcheck.yml index 8ef4da9a3c..9c13a27a0b 100644 --- a/.github/workflows/ci-docs-linkcheck.yml +++ b/.github/workflows/ci-docs-linkcheck.yml @@ -83,13 +83,10 @@ jobs: conda list - name: "nox cache" - uses: actions/cache@v3 - env: - # Increment the build number to force a cache refresh. - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/nox-cache with: - path: ${{ github.workspace }}/.nox - key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + # Increment the build number to force a cache refresh. + cache_build: 0 - name: "iris linkcheck" env: diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index b2d3197a6c..7a0dc10055 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -122,13 +122,10 @@ jobs: python cartopy_feature_download.py physical --output ${CARTOPY_SHARE_DIR} --no-warn - name: "nox cache" - uses: actions/cache@v3 - env: - # Increment the build number to force a cache refresh. - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/nox-cache with: - path: ${{ github.workspace }}/.nox - key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + # Increment the build number to force a cache refresh. + cache_build: 0 - name: "iris configure" env: diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index c094ea090d..0724ca1b20 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -122,13 +122,10 @@ jobs: python cartopy_feature_download.py physical --output ${CARTOPY_SHARE_DIR} --no-warn - name: "nox cache" - uses: actions/cache@v3 - env: - # Increment the build number to force a cache refresh. - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/nox-cache with: - path: ${{ github.workspace }}/.nox - key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.LOCK_FILE) }} + # Increment the build number to force a cache refresh. + cache_build: 0 - name: "iris configure" env: diff --git a/.github/workflows/composite/nox-cache/action.yml b/.github/workflows/composite/nox-cache/action.yml new file mode 100644 index 0000000000..eb2ccb88bb --- /dev/null +++ b/.github/workflows/composite/nox-cache/action.yml @@ -0,0 +1,21 @@ +name: "nox cache" +description: "cache the nox test environments" + +# +# Assumes the environment contains the following variables: +# - ENV_NAME +# - LOCK_FILE +# +inputs: + cache_build: + description: "nox cache version build number" + required: false + default: "0" + +runs: + using: "composite" + steps: + - uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/.nox + key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ inputs.cache_build }}-${{ hashFiles(env.LOCK_FILE) }} \ No newline at end of file From 008df065288e936aa5391cdf66b8835117797fc2 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 12:54:36 +0100 Subject: [PATCH 09/20] composite iris-data-cache action --- .github/workflows/ci-docs-tests.yml | 18 +++-------- .github/workflows/ci-tests.yml | 18 +++-------- .../composite/iris-data-cache/action.yml | 32 +++++++++++++++++++ .../workflows/composite/nox-cache/action.yml | 2 +- 4 files changed, 41 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/composite/iris-data-cache/action.yml diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index 7a0dc10055..da85eaf80c 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -46,21 +46,11 @@ jobs: echo "LOCK_FILE=requirements/ci/nox.lock/py$(echo ${{ matrix.python-version }} | tr -d '.')-linux-64.lock" >> ${GITHUB_ENV} - name: "data cache" - uses: actions/cache@v3 - id: data-cache - env: - # Increment the build number to force a cache refresh. - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/iris-data-cache with: - path: ~/iris-test-data - key: ${{ runner.os }}-iris-test-data-${{ env.ENV_NAME }}-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} - - - name: "data cache populate" - if: steps.data-cache.outputs.cache-hit != 'true' - run: | - wget --quiet https://github.com/SciTools/iris-test-data/archive/v${{ env.IRIS_TEST_DATA_VERSION }}.zip -O iris-test-data.zip - unzip -q iris-test-data.zip - mv iris-test-data-${{ env.IRIS_TEST_DATA_VERSION }} ${HOME}/iris-test-data + # Increment the build number to force a cache refresh. + cache_build: 0 + version: ${{ env.IRIS_TEST_DATA_VERSION }} - name: "conda package cache" uses: actions/cache@v3 diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 0724ca1b20..83015aefe5 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -46,21 +46,11 @@ jobs: echo "LOCK_FILE=requirements/ci/nox.lock/py$(echo ${{ matrix.python-version }} | tr -d '.')-linux-64.lock" >> ${GITHUB_ENV} - name: "data cache" - uses: actions/cache@v3 - id: data-cache - env: - # Increment the build number to force a cache refresh. - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/iris-data-cache with: - path: ~/iris-test-data - key: ${{ runner.os }}-iris-test-data-${{ env.ENV_NAME }}-v${{ env.IRIS_TEST_DATA_VERSION }}-b${{ env.CACHE_BUILD }} - - - name: "data cache populate" - if: steps.data-cache.outputs.cache-hit != 'true' - run: | - wget --quiet https://github.com/SciTools/iris-test-data/archive/v${{ env.IRIS_TEST_DATA_VERSION }}.zip -O iris-test-data.zip - unzip -q iris-test-data.zip - mv iris-test-data-${{ env.IRIS_TEST_DATA_VERSION }} ${HOME}/iris-test-data + # Increment the build number to force a cache refresh. + cache_build: 0 + version: ${{ env.IRIS_TEST_DATA_VERSION }} - name: "conda package cache" uses: actions/cache@v3 diff --git a/.github/workflows/composite/iris-data-cache/action.yml b/.github/workflows/composite/iris-data-cache/action.yml new file mode 100644 index 0000000000..53d2bb3265 --- /dev/null +++ b/.github/workflows/composite/iris-data-cache/action.yml @@ -0,0 +1,32 @@ +name: "iris-data-cache" +description: "cache the iris test data" + +# +# Assumes the environment contains the following variables: +# - ENV_NAME +# - HOME +# +inputs: + cache_build: + description: "data cache version build number" + required: false + default: "0" + version: + description: "iris test data version" + required: true + +runs: + using: "composite" + steps: + - uses: actions/cache@v3 + id: data-cache + with: + path: ~/iris-test-data + key: ${{ runner.os }}-iris-test-data-${{ env.ENV_NAME }}-v${{ inputs.version }}-b${{ inputs.cache_build }} + + - if: steps.data-cache.outputs.cache-hit != 'true' + run: | + wget --quiet https://github.com/SciTools/iris-test-data/archive/v${{ inputs.version }}.zip -O iris-test-data.zip + unzip -q iris-test-data.zip + mv iris-test-data-${{ inputs.version }} ${HOME}/iris-test-data + shell: bash diff --git a/.github/workflows/composite/nox-cache/action.yml b/.github/workflows/composite/nox-cache/action.yml index eb2ccb88bb..7ca51b3585 100644 --- a/.github/workflows/composite/nox-cache/action.yml +++ b/.github/workflows/composite/nox-cache/action.yml @@ -18,4 +18,4 @@ runs: - uses: actions/cache@v3 with: path: ${{ github.workspace }}/.nox - key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ inputs.cache_build }}-${{ hashFiles(env.LOCK_FILE) }} \ No newline at end of file + key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ inputs.cache_build }}-${{ hashFiles(env.LOCK_FILE) }} From 1b4ef905fde261ec77d86d3305b6fbfe9fc7b46c Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 14:23:27 +0100 Subject: [PATCH 10/20] composite conda-env-cache action --- .github/workflows/ci-docs-linkcheck.yml | 18 +++------- .github/workflows/ci-docs-tests.yml | 20 +++-------- .github/workflows/ci-tests.yml | 20 +++-------- .../composite/conda-env-cache/action.yml | 33 +++++++++++++++++++ .../composite/iris-data-cache/action.yml | 6 ++-- .../workflows/composite/nox-cache/action.yml | 2 +- 6 files changed, 49 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/composite/conda-env-cache/action.yml diff --git a/.github/workflows/ci-docs-linkcheck.yml b/.github/workflows/ci-docs-linkcheck.yml index 9c13a27a0b..87ccf6a4d9 100644 --- a/.github/workflows/ci-docs-linkcheck.yml +++ b/.github/workflows/ci-docs-linkcheck.yml @@ -47,7 +47,6 @@ jobs: - name: "conda package cache" uses: actions/cache@v3 env: - # Increment the build number to force a cache refresh. CACHE_BUILD: 0 with: path: ~/conda_pkgs_dir @@ -63,19 +62,11 @@ jobs: use-only-tar-bz2: true - name: "conda environment cache" - uses: actions/cache@v3 - id: conda-env-cache - env: - # Increment the build number to force a cache refresh. - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/conda-env-cache with: - path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} - key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - - name: "conda environment update" - if: steps.conda-env-cache.outputs.cache-hit != 'true' - run: | - conda install --quiet --name ${{ env.ENV_NAME }} nox pip + cache_build: 0 + cache_period: ${{ env.CACHE_PERIOD }} + install_packages: "nox pip" - name: "conda info" run: | @@ -85,7 +76,6 @@ jobs: - name: "nox cache" uses: ./.github/workflows/composite/nox-cache with: - # Increment the build number to force a cache refresh. cache_build: 0 - name: "iris linkcheck" diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index da85eaf80c..c63f6b4c1e 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -48,14 +48,12 @@ jobs: - name: "data cache" uses: ./.github/workflows/composite/iris-data-cache with: - # Increment the build number to force a cache refresh. cache_build: 0 version: ${{ env.IRIS_TEST_DATA_VERSION }} - name: "conda package cache" uses: actions/cache@v3 env: - # Increment the build number to force a cache refresh. CACHE_BUILD: 0 with: path: ~/conda_pkgs_dir @@ -71,19 +69,11 @@ jobs: use-only-tar-bz2: true - name: "conda environment cache" - uses: actions/cache@v3 - id: conda-env-cache - env: - # Increment the build number to force a cache refresh. - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/conda-env-cache with: - path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} - key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - - name: "conda environment update" - if: steps.conda-env-cache.outputs.cache-hit != 'true' - run: | - conda install --quiet --name ${{ env.ENV_NAME }} cartopy nox pip + cache_build: 0 + cache_period: ${{ env.CACHE_PERIOD }} + install_packages: "cartopy nox pip" - name: "conda info" run: | @@ -94,7 +84,6 @@ jobs: uses: actions/cache@v3 id: cartopy-cache env: - # Increment the build number to force a cache refresh. CACHE_BUILD: 0 with: path: ~/.local/share/cartopy @@ -114,7 +103,6 @@ jobs: - name: "nox cache" uses: ./.github/workflows/composite/nox-cache with: - # Increment the build number to force a cache refresh. cache_build: 0 - name: "iris configure" diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 83015aefe5..0d0fb61e11 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -48,14 +48,12 @@ jobs: - name: "data cache" uses: ./.github/workflows/composite/iris-data-cache with: - # Increment the build number to force a cache refresh. cache_build: 0 version: ${{ env.IRIS_TEST_DATA_VERSION }} - name: "conda package cache" uses: actions/cache@v3 env: - # Increment the build number to force a cache refresh. CACHE_BUILD: 0 with: path: ~/conda_pkgs_dir @@ -71,19 +69,11 @@ jobs: use-only-tar-bz2: true - name: "conda environment cache" - uses: actions/cache@v3 - id: conda-env-cache - env: - # Increment the build number to force a cache refresh. - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/conda-env-cache with: - path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} - key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - - name: "conda environment update" - if: steps.conda-env-cache.outputs.cache-hit != 'true' - run: | - conda install --quiet --name ${{ env.ENV_NAME }} cartopy nox pip + cache_build: 0 + cache_period: ${{ env.CACHE_PERIOD }} + install_packages: "cartopy nox pip" - name: "conda info" run: | @@ -94,7 +84,6 @@ jobs: uses: actions/cache@v3 id: cartopy-cache env: - # Increment the build number to force a cache refresh. CACHE_BUILD: 0 with: path: ~/.local/share/cartopy @@ -114,7 +103,6 @@ jobs: - name: "nox cache" uses: ./.github/workflows/composite/nox-cache with: - # Increment the build number to force a cache refresh. cache_build: 0 - name: "iris configure" diff --git a/.github/workflows/composite/conda-env-cache/action.yml b/.github/workflows/composite/conda-env-cache/action.yml new file mode 100644 index 0000000000..d73b8420a5 --- /dev/null +++ b/.github/workflows/composite/conda-env-cache/action.yml @@ -0,0 +1,33 @@ +name: "conda-env-cache" +description: "create and cache the conda environment" + +# +# Assumes the environment contains the following variables: +# - CONDA +# - ENV_NAME +# +inputs: + cache_build: + description: "conda environment cache build number" + required: false + default: "0" + cache_period: + description: "conda environment cache timestamp" + required: true + install_packages: + description: "conda packages to install into environment" + required: true + +runs: + using: "composite" + steps: + - uses: actions/cache@v3 + id: conda-env-cache + with: + path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} + key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }} + + - if: steps.conda-env-cache.outputs.cache-hit != 'true' + shell: bash + run: | + conda install --quiet --name ${{ env.ENV_NAME }} ${{ inputs.install_packages }} diff --git a/.github/workflows/composite/iris-data-cache/action.yml b/.github/workflows/composite/iris-data-cache/action.yml index 53d2bb3265..e4635eda64 100644 --- a/.github/workflows/composite/iris-data-cache/action.yml +++ b/.github/workflows/composite/iris-data-cache/action.yml @@ -1,5 +1,5 @@ name: "iris-data-cache" -description: "cache the iris test data" +description: "create and cache the iris test data" # # Assumes the environment contains the following variables: @@ -8,7 +8,7 @@ description: "cache the iris test data" # inputs: cache_build: - description: "data cache version build number" + description: "data cache build number" required: false default: "0" version: @@ -25,8 +25,8 @@ runs: key: ${{ runner.os }}-iris-test-data-${{ env.ENV_NAME }}-v${{ inputs.version }}-b${{ inputs.cache_build }} - if: steps.data-cache.outputs.cache-hit != 'true' + shell: bash run: | wget --quiet https://github.com/SciTools/iris-test-data/archive/v${{ inputs.version }}.zip -O iris-test-data.zip unzip -q iris-test-data.zip mv iris-test-data-${{ inputs.version }} ${HOME}/iris-test-data - shell: bash diff --git a/.github/workflows/composite/nox-cache/action.yml b/.github/workflows/composite/nox-cache/action.yml index 7ca51b3585..49d5565e54 100644 --- a/.github/workflows/composite/nox-cache/action.yml +++ b/.github/workflows/composite/nox-cache/action.yml @@ -8,7 +8,7 @@ description: "cache the nox test environments" # inputs: cache_build: - description: "nox cache version build number" + description: "nox cache build number" required: false default: "0" From 2a2178bd423eaf845033d25eed04e54ad9670453 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 14:50:49 +0100 Subject: [PATCH 11/20] composite conda-pkg-cache action --- .github/workflows/ci-docs-linkcheck.yml | 8 +++--- .github/workflows/ci-docs-tests.yml | 8 +++--- .github/workflows/ci-tests.yml | 8 +++--- .../composite/conda-pkg-cache/action.yml | 26 +++++++++++++++++++ 4 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/composite/conda-pkg-cache/action.yml diff --git a/.github/workflows/ci-docs-linkcheck.yml b/.github/workflows/ci-docs-linkcheck.yml index 87ccf6a4d9..bac1855067 100644 --- a/.github/workflows/ci-docs-linkcheck.yml +++ b/.github/workflows/ci-docs-linkcheck.yml @@ -45,12 +45,10 @@ jobs: echo "LOCK_FILE=requirements/ci/nox.lock/py$(echo ${{ matrix.python-version }} | tr -d '.')-linux-64.lock" >> ${GITHUB_ENV} - name: "conda package cache" - uses: actions/cache@v3 - env: - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/conda-pkg-cache with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + cache_build: 0 + cache_period: ${{ env.CACHE_PERIOD }} - name: "conda install" uses: conda-incubator/setup-miniconda@v2 diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index c63f6b4c1e..49d867a79e 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -52,12 +52,10 @@ jobs: version: ${{ env.IRIS_TEST_DATA_VERSION }} - name: "conda package cache" - uses: actions/cache@v3 - env: - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/conda-pkg-cache with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + cache_build: 0 + cache_period: ${{ env.CACHE_PERIOD }} - name: "conda install" uses: conda-incubator/setup-miniconda@v2 diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 0d0fb61e11..aad14ae68c 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -52,12 +52,10 @@ jobs: version: ${{ env.IRIS_TEST_DATA_VERSION }} - name: "conda package cache" - uses: actions/cache@v3 - env: - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/conda-pkg-cache with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} + cache_build: 0 + cache_period: ${{ env.CACHE_PERIOD }} - name: "conda install" uses: conda-incubator/setup-miniconda@v2 diff --git a/.github/workflows/composite/conda-pkg-cache/action.yml b/.github/workflows/composite/conda-pkg-cache/action.yml new file mode 100644 index 0000000000..87b65e38ff --- /dev/null +++ b/.github/workflows/composite/conda-pkg-cache/action.yml @@ -0,0 +1,26 @@ +name: "conda-pkg-cache" +description: "cache the conda environment packages" +branding: + icon: "file-text" + color: "purple" + +# +# Assumes the environment contains the following variables: +# - ENV_NAME +# +inputs: + cache_build: + description: "conda environment cache build number" + required: false + default: "0" + cache_period: + description: "conda environment cache timestamp" + required: true + +runs: + using: "composite" + steps: + - uses: actions/cache@v3 + with: + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }} From 4a0f80064ecf25066ad8f1b1d219923061be9d82 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 15:17:12 +0100 Subject: [PATCH 12/20] composite cartopy-cache action --- .github/workflows/ci-docs-tests.yml | 20 ++--------- .github/workflows/ci-tests.yml | 20 ++--------- .../composite/cartopy-cache/action.yml | 35 +++++++++++++++++++ .../composite/conda-pkg-cache/action.yml | 3 -- 4 files changed, 41 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/composite/cartopy-cache/action.yml diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index 49d867a79e..ee3186e95f 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -79,24 +79,10 @@ jobs: conda list - name: "cartopy cache" - uses: actions/cache@v3 - id: cartopy-cache - env: - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/cartopy-cache with: - path: ~/.local/share/cartopy - key: ${{ runner.os }}-cartopy-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - - name: "cartopy cache populate" - if: steps.cartopy-cache.outputs.cache-hit != 'true' - env: - CARTOPY_SHARE_DIR: ~/.local/share/cartopy - CARTOPY_FEATURE: https://raw.githubusercontent.com/SciTools/cartopy/v0.20.0/tools/cartopy_feature_download.py - run: | - wget --quiet ${CARTOPY_FEATURE} - mkdir -p ${CARTOPY_SHARE_DIR} - # Requires a pre-installed version of cartopy within the environment. - python cartopy_feature_download.py physical --output ${CARTOPY_SHARE_DIR} --no-warn + cache_build: 0 + cache_period: ${{ env.CACHE_PERIOD }} - name: "nox cache" uses: ./.github/workflows/composite/nox-cache diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index aad14ae68c..5815dc7e5c 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -79,24 +79,10 @@ jobs: conda list - name: "cartopy cache" - uses: actions/cache@v3 - id: cartopy-cache - env: - CACHE_BUILD: 0 + uses: ./.github/workflows/composite/cartopy-cache with: - path: ~/.local/share/cartopy - key: ${{ runner.os }}-cartopy-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }} - - - name: "cartopy cache populate" - if: steps.cartopy-cache.outputs.cache-hit != 'true' - env: - CARTOPY_SHARE_DIR: ~/.local/share/cartopy - CARTOPY_FEATURE: https://raw.githubusercontent.com/SciTools/cartopy/v0.20.0/tools/cartopy_feature_download.py - run: | - wget --quiet ${CARTOPY_FEATURE} - mkdir -p ${CARTOPY_SHARE_DIR} - # Requires a pre-installed version of cartopy within the environment. - python cartopy_feature_download.py physical --output ${CARTOPY_SHARE_DIR} --no-warn + cache_build: 0 + cache_period: ${{ env.CACHE_PERIOD }} - name: "nox cache" uses: ./.github/workflows/composite/nox-cache diff --git a/.github/workflows/composite/cartopy-cache/action.yml b/.github/workflows/composite/cartopy-cache/action.yml new file mode 100644 index 0000000000..826543cb59 --- /dev/null +++ b/.github/workflows/composite/cartopy-cache/action.yml @@ -0,0 +1,35 @@ +name: "cartopy-cache" +description: "create and cache cartopy assets" + +# +# Assumes the environment contains the following variables: +# - ENV_NAME +# +inputs: + cache_build: + description: "conda environment cache build number" + required: false + default: "0" + cache_period: + description: "conda environment cache timestamp" + required: true + +runs: + using: "composite" + steps: + - uses: actions/cache@v3 + id: cartopy-cache + with: + path: ~/.local/share/cartopy + key: ${{ runner.os }}-cartopy-${{ env.ENV_NAME }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }} + + - if: steps.cartopy-cache.outputs.cache-hit != 'true' + env: + CARTOPY_SHARE_DIR: ~/.local/share/cartopy + CARTOPY_FEATURE: https://raw.githubusercontent.com/SciTools/cartopy/v0.20.0/tools/cartopy_feature_download.py + shell: bash + run: | + wget --quiet ${CARTOPY_FEATURE} + mkdir -p ${CARTOPY_SHARE_DIR} + # Requires a pre-installed version of cartopy within the environment. + python cartopy_feature_download.py physical --output ${CARTOPY_SHARE_DIR} --no-warn diff --git a/.github/workflows/composite/conda-pkg-cache/action.yml b/.github/workflows/composite/conda-pkg-cache/action.yml index 87b65e38ff..05c80db5ce 100644 --- a/.github/workflows/composite/conda-pkg-cache/action.yml +++ b/.github/workflows/composite/conda-pkg-cache/action.yml @@ -1,8 +1,5 @@ name: "conda-pkg-cache" description: "cache the conda environment packages" -branding: - icon: "file-text" - color: "purple" # # Assumes the environment contains the following variables: From 4cf89d61e945ca06afb3744dcb74ed2aa60eb9c8 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 15:28:59 +0100 Subject: [PATCH 13/20] required lock-file composite action input --- .github/workflows/ci-docs-linkcheck.yml | 4 ++-- .github/workflows/ci-docs-tests.yml | 4 ++-- .github/workflows/ci-tests.yml | 4 ++-- .github/workflows/composite/nox-cache/action.yml | 5 +++++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-docs-linkcheck.yml b/.github/workflows/ci-docs-linkcheck.yml index bac1855067..5c64726a2b 100644 --- a/.github/workflows/ci-docs-linkcheck.yml +++ b/.github/workflows/ci-docs-linkcheck.yml @@ -8,8 +8,7 @@ name: ci-docs-linkcheck on: push: branches: - - "*" - + - "*" pull_request: branches: - "*" @@ -75,6 +74,7 @@ jobs: uses: ./.github/workflows/composite/nox-cache with: cache_build: 0 + lock_file: ${{ env.LOCK_FILE }} - name: "iris linkcheck" env: diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index ee3186e95f..0eb2768bef 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -8,8 +8,7 @@ name: ci-docs-tests on: push: branches: - - "*" - + - "*" pull_request: branches: - "*" @@ -88,6 +87,7 @@ jobs: uses: ./.github/workflows/composite/nox-cache with: cache_build: 0 + lock_file: ${{ env.LOCK_FILE }} - name: "iris configure" env: diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 5815dc7e5c..ffccbaf8a1 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -8,8 +8,7 @@ name: ci-tests on: push: branches: - - "*" - + - "*" pull_request: branches: - "*" @@ -88,6 +87,7 @@ jobs: uses: ./.github/workflows/composite/nox-cache with: cache_build: 0 + lock_file: ${{ env.LOCK_FILE }} - name: "iris configure" env: diff --git a/.github/workflows/composite/nox-cache/action.yml b/.github/workflows/composite/nox-cache/action.yml index 49d5565e54..c201ed5954 100644 --- a/.github/workflows/composite/nox-cache/action.yml +++ b/.github/workflows/composite/nox-cache/action.yml @@ -11,11 +11,16 @@ inputs: description: "nox cache build number" required: false default: "0" + lock_file: + description: "conda-lock environment requirements filename" + required: true runs: using: "composite" steps: - uses: actions/cache@v3 + env: + LOCK_FILE: ${{ inputs.lock_file }} with: path: ${{ github.workspace }}/.nox key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ inputs.cache_build }}-${{ hashFiles(env.LOCK_FILE) }} From adb510fa4c33b6b74271750999d0a3ad3a55988b Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 16:17:34 +0100 Subject: [PATCH 14/20] review action --- .github/workflows/ci-docs-tests.yml | 1 + .github/workflows/ci-tests.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index 0eb2768bef..a782b90d5a 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -89,6 +89,7 @@ jobs: cache_build: 0 lock_file: ${{ env.LOCK_FILE }} + # TODO: drop use of site.cfg and explicit use of mplrc - name: "iris configure" env: SITE_CFG: lib/iris/etc/site.cfg diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index ffccbaf8a1..a55e03cf95 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -89,6 +89,7 @@ jobs: cache_build: 0 lock_file: ${{ env.LOCK_FILE }} + # TODO: drop use of site.cfg and explicit use of mplrc - name: "iris configure" env: SITE_CFG: lib/iris/etc/site.cfg From f5936a02bddc286e84c5d50274e791c0556aa121 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 18:00:07 +0100 Subject: [PATCH 15/20] review action --- .github/workflows/ci-docs-linkcheck.yml | 8 ++++++-- .github/workflows/ci-docs-tests.yml | 8 ++++++-- .github/workflows/ci-tests.yml | 9 +++++++-- .github/workflows/composite/nox-cache/action.yml | 1 - 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-docs-linkcheck.yml b/.github/workflows/ci-docs-linkcheck.yml index 5c64726a2b..cf43f92c1b 100644 --- a/.github/workflows/ci-docs-linkcheck.yml +++ b/.github/workflows/ci-docs-linkcheck.yml @@ -8,10 +8,14 @@ name: ci-docs-linkcheck on: push: branches: - - "*" + - "main" + - "v*x" + tags: + - "v*" pull_request: branches: - - "*" + - "*" + workflow_dispatch: jobs: tests: diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index a782b90d5a..59b7592d1f 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -8,10 +8,14 @@ name: ci-docs-tests on: push: branches: - - "*" + - "main" + - "v*x" + tags: + - "v*" pull_request: branches: - - "*" + - "*" + workflow_dispatch: jobs: tests: diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index a55e03cf95..d0714462c4 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -8,10 +8,14 @@ name: ci-tests on: push: branches: - - "*" + - "main" + - "v*x" + tags: + - "v*" pull_request: branches: - - "*" + - "*" + workflow_dispatch: jobs: tests: @@ -24,6 +28,7 @@ jobs: shell: bash -l {0} strategy: + fail-fast: false matrix: os: ["ubuntu-latest"] python-version: ["3.8"] diff --git a/.github/workflows/composite/nox-cache/action.yml b/.github/workflows/composite/nox-cache/action.yml index c201ed5954..73c0233de5 100644 --- a/.github/workflows/composite/nox-cache/action.yml +++ b/.github/workflows/composite/nox-cache/action.yml @@ -4,7 +4,6 @@ description: "cache the nox test environments" # # Assumes the environment contains the following variables: # - ENV_NAME -# - LOCK_FILE # inputs: cache_build: From 9bb2654ee2fa01aa5dd4315fd718be2654c90e53 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 19:16:40 +0100 Subject: [PATCH 16/20] nox inputs.lock_file --- .github/workflows/composite/nox-cache/action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/composite/nox-cache/action.yml b/.github/workflows/composite/nox-cache/action.yml index 73c0233de5..7005b12f04 100644 --- a/.github/workflows/composite/nox-cache/action.yml +++ b/.github/workflows/composite/nox-cache/action.yml @@ -18,8 +18,6 @@ runs: using: "composite" steps: - uses: actions/cache@v3 - env: - LOCK_FILE: ${{ inputs.lock_file }} with: path: ${{ github.workspace }}/.nox - key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ inputs.cache_build }}-${{ hashFiles(env.LOCK_FILE) }} + key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ inputs.cache_build }}-${{ hashFiles( inputs.lock_file ) }} From 4dde00181503e4146a0ec42f653294a40e242446 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 21:24:54 +0100 Subject: [PATCH 17/20] env_name composite action input --- .github/workflows/ci-docs-linkcheck.yml | 3 +++ .github/workflows/ci-docs-tests.yml | 5 +++++ .github/workflows/ci-tests.yml | 5 +++++ .github/workflows/composite/cartopy-cache/action.yml | 9 ++++----- .github/workflows/composite/conda-env-cache/action.yml | 10 ++++++---- .github/workflows/composite/conda-pkg-cache/action.yml | 9 ++++----- .github/workflows/composite/iris-data-cache/action.yml | 6 ++++-- .github/workflows/composite/nox-cache/action.yml | 9 ++++----- 8 files changed, 35 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci-docs-linkcheck.yml b/.github/workflows/ci-docs-linkcheck.yml index cf43f92c1b..ed5b691a3c 100644 --- a/.github/workflows/ci-docs-linkcheck.yml +++ b/.github/workflows/ci-docs-linkcheck.yml @@ -52,6 +52,7 @@ jobs: with: cache_build: 0 cache_period: ${{ env.CACHE_PERIOD }} + env_name: ${{ env.ENV_NAME }} - name: "conda install" uses: conda-incubator/setup-miniconda@v2 @@ -67,6 +68,7 @@ jobs: with: cache_build: 0 cache_period: ${{ env.CACHE_PERIOD }} + env_name: ${{ env.ENV_NAME }} install_packages: "nox pip" - name: "conda info" @@ -78,6 +80,7 @@ jobs: uses: ./.github/workflows/composite/nox-cache with: cache_build: 0 + env_name: ${{ env.ENV_NAME }} lock_file: ${{ env.LOCK_FILE }} - name: "iris linkcheck" diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index 59b7592d1f..dddc74171e 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -52,6 +52,7 @@ jobs: uses: ./.github/workflows/composite/iris-data-cache with: cache_build: 0 + env_name: ${{ env.ENV_NAME }} version: ${{ env.IRIS_TEST_DATA_VERSION }} - name: "conda package cache" @@ -59,6 +60,7 @@ jobs: with: cache_build: 0 cache_period: ${{ env.CACHE_PERIOD }} + env_name: ${{ env.ENV_NAME }} - name: "conda install" uses: conda-incubator/setup-miniconda@v2 @@ -74,6 +76,7 @@ jobs: with: cache_build: 0 cache_period: ${{ env.CACHE_PERIOD }} + env_name: ${{ env.ENV_NAME }} install_packages: "cartopy nox pip" - name: "conda info" @@ -86,11 +89,13 @@ jobs: with: cache_build: 0 cache_period: ${{ env.CACHE_PERIOD }} + env_name: ${{ env.ENV_NAME }} - name: "nox cache" uses: ./.github/workflows/composite/nox-cache with: cache_build: 0 + env_name: ${{ env.ENV_NAME }} lock_file: ${{ env.LOCK_FILE }} # TODO: drop use of site.cfg and explicit use of mplrc diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index d0714462c4..56eb3c96e0 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -53,6 +53,7 @@ jobs: uses: ./.github/workflows/composite/iris-data-cache with: cache_build: 0 + env_name: ${{ env.ENV_NAME }} version: ${{ env.IRIS_TEST_DATA_VERSION }} - name: "conda package cache" @@ -60,6 +61,7 @@ jobs: with: cache_build: 0 cache_period: ${{ env.CACHE_PERIOD }} + env_name: ${{ env.ENV_NAME }} - name: "conda install" uses: conda-incubator/setup-miniconda@v2 @@ -75,6 +77,7 @@ jobs: with: cache_build: 0 cache_period: ${{ env.CACHE_PERIOD }} + env_name: ${{ env.ENV_NAME }} install_packages: "cartopy nox pip" - name: "conda info" @@ -87,11 +90,13 @@ jobs: with: cache_build: 0 cache_period: ${{ env.CACHE_PERIOD }} + env_name: ${{ env.ENV_NAME }} - name: "nox cache" uses: ./.github/workflows/composite/nox-cache with: cache_build: 0 + env_name: ${{ env.ENV_NAME }} lock_file: ${{ env.LOCK_FILE }} # TODO: drop use of site.cfg and explicit use of mplrc diff --git a/.github/workflows/composite/cartopy-cache/action.yml b/.github/workflows/composite/cartopy-cache/action.yml index 826543cb59..35a90736bc 100644 --- a/.github/workflows/composite/cartopy-cache/action.yml +++ b/.github/workflows/composite/cartopy-cache/action.yml @@ -1,10 +1,6 @@ name: "cartopy-cache" description: "create and cache cartopy assets" -# -# Assumes the environment contains the following variables: -# - ENV_NAME -# inputs: cache_build: description: "conda environment cache build number" @@ -13,6 +9,9 @@ inputs: cache_period: description: "conda environment cache timestamp" required: true + env_name: + description: "environment name" + required: true runs: using: "composite" @@ -21,7 +20,7 @@ runs: id: cartopy-cache with: path: ~/.local/share/cartopy - key: ${{ runner.os }}-cartopy-${{ env.ENV_NAME }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }} + key: ${{ runner.os }}-cartopy-${{ inputs.env_name }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }} - if: steps.cartopy-cache.outputs.cache-hit != 'true' env: diff --git a/.github/workflows/composite/conda-env-cache/action.yml b/.github/workflows/composite/conda-env-cache/action.yml index d73b8420a5..6bfd6fff90 100644 --- a/.github/workflows/composite/conda-env-cache/action.yml +++ b/.github/workflows/composite/conda-env-cache/action.yml @@ -4,7 +4,6 @@ description: "create and cache the conda environment" # # Assumes the environment contains the following variables: # - CONDA -# - ENV_NAME # inputs: cache_build: @@ -14,6 +13,9 @@ inputs: cache_period: description: "conda environment cache timestamp" required: true + env_name: + description: "environment name" + required: true install_packages: description: "conda packages to install into environment" required: true @@ -24,10 +26,10 @@ runs: - uses: actions/cache@v3 id: conda-env-cache with: - path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }} - key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }} + path: ${{ env.CONDA }}/envs/${{ inputs.env_name }} + key: ${{ runner.os }}-conda-env-${{ inputs.env_name }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }} - if: steps.conda-env-cache.outputs.cache-hit != 'true' shell: bash run: | - conda install --quiet --name ${{ env.ENV_NAME }} ${{ inputs.install_packages }} + conda install --quiet --name ${{ inputs.env_name }} ${{ inputs.install_packages }} diff --git a/.github/workflows/composite/conda-pkg-cache/action.yml b/.github/workflows/composite/conda-pkg-cache/action.yml index 05c80db5ce..4472d7e415 100644 --- a/.github/workflows/composite/conda-pkg-cache/action.yml +++ b/.github/workflows/composite/conda-pkg-cache/action.yml @@ -1,10 +1,6 @@ name: "conda-pkg-cache" description: "cache the conda environment packages" -# -# Assumes the environment contains the following variables: -# - ENV_NAME -# inputs: cache_build: description: "conda environment cache build number" @@ -13,6 +9,9 @@ inputs: cache_period: description: "conda environment cache timestamp" required: true + env_name: + description: "environment name" + required: true runs: using: "composite" @@ -20,4 +19,4 @@ runs: - uses: actions/cache@v3 with: path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }} + key: ${{ runner.os }}-conda-pkgs-${{ inputs.env_name }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }} diff --git a/.github/workflows/composite/iris-data-cache/action.yml b/.github/workflows/composite/iris-data-cache/action.yml index e4635eda64..c4db8856d2 100644 --- a/.github/workflows/composite/iris-data-cache/action.yml +++ b/.github/workflows/composite/iris-data-cache/action.yml @@ -3,7 +3,6 @@ description: "create and cache the iris test data" # # Assumes the environment contains the following variables: -# - ENV_NAME # - HOME # inputs: @@ -11,6 +10,9 @@ inputs: description: "data cache build number" required: false default: "0" + env_name: + description: "environment name" + required: true version: description: "iris test data version" required: true @@ -22,7 +24,7 @@ runs: id: data-cache with: path: ~/iris-test-data - key: ${{ runner.os }}-iris-test-data-${{ env.ENV_NAME }}-v${{ inputs.version }}-b${{ inputs.cache_build }} + key: ${{ runner.os }}-iris-test-data-${{ inputs.env_name }}-v${{ inputs.version }}-b${{ inputs.cache_build }} - if: steps.data-cache.outputs.cache-hit != 'true' shell: bash diff --git a/.github/workflows/composite/nox-cache/action.yml b/.github/workflows/composite/nox-cache/action.yml index 7005b12f04..9d92ad7226 100644 --- a/.github/workflows/composite/nox-cache/action.yml +++ b/.github/workflows/composite/nox-cache/action.yml @@ -1,15 +1,14 @@ name: "nox cache" description: "cache the nox test environments" -# -# Assumes the environment contains the following variables: -# - ENV_NAME -# inputs: cache_build: description: "nox cache build number" required: false default: "0" + env_name: + description: "environment name" + required: true lock_file: description: "conda-lock environment requirements filename" required: true @@ -20,4 +19,4 @@ runs: - uses: actions/cache@v3 with: path: ${{ github.workspace }}/.nox - key: ${{ runner.os }}-nox-${{ env.ENV_NAME }}-py${{ matrix.python-version }}-b${{ inputs.cache_build }}-${{ hashFiles( inputs.lock_file ) }} + key: ${{ runner.os }}-nox-${{ inputs.env_name }}-py${{ matrix.python-version }}-b${{ inputs.cache_build }}-${{ hashFiles(inputs.lock_file) }} From 831679f499f75ee6814ea654fb30b1527ebcb480 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 21:32:13 +0100 Subject: [PATCH 18/20] replace HOME with tilde usage --- .github/workflows/composite/iris-data-cache/action.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/composite/iris-data-cache/action.yml b/.github/workflows/composite/iris-data-cache/action.yml index c4db8856d2..7bf72fae8b 100644 --- a/.github/workflows/composite/iris-data-cache/action.yml +++ b/.github/workflows/composite/iris-data-cache/action.yml @@ -1,10 +1,6 @@ name: "iris-data-cache" description: "create and cache the iris test data" -# -# Assumes the environment contains the following variables: -# - HOME -# inputs: cache_build: description: "data cache build number" @@ -31,4 +27,4 @@ runs: run: | wget --quiet https://github.com/SciTools/iris-test-data/archive/v${{ inputs.version }}.zip -O iris-test-data.zip unzip -q iris-test-data.zip - mv iris-test-data-${{ inputs.version }} ${HOME}/iris-test-data + mv iris-test-data-${{ inputs.version }} ~/iris-test-data From 5f33f5e6a33f4076dd608084cd6cac820286e892 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 16 Jun 2022 21:56:07 +0100 Subject: [PATCH 19/20] cancel in-progress workflow jobs --- .github/workflows/ci-docs-linkcheck.yml | 4 ++++ .github/workflows/ci-docs-tests.yml | 4 ++++ .github/workflows/ci-tests.yml | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/.github/workflows/ci-docs-linkcheck.yml b/.github/workflows/ci-docs-linkcheck.yml index ed5b691a3c..cf67e99129 100644 --- a/.github/workflows/ci-docs-linkcheck.yml +++ b/.github/workflows/ci-docs-linkcheck.yml @@ -17,6 +17,10 @@ on: - "*" workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: tests: name: "linkcheck ${{ matrix.os }} ${{ matrix.python-version }}" diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index dddc74171e..faadf56204 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -17,6 +17,10 @@ on: - "*" workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: tests: name: "doctests ${{ matrix.os }} ${{ matrix.python-version }}" diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 56eb3c96e0..fbe738067c 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -17,6 +17,10 @@ on: - "*" workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: tests: name: "tests ${{ matrix.os }} ${{ matrix.python-version }}" From 2961b02cadb9ea045f589249d245475bba0c48f6 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Fri, 17 Jun 2022 10:30:47 +0100 Subject: [PATCH 20/20] refresh-lockfiles gha note --- .github/workflows/refresh-lockfiles.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/refresh-lockfiles.yml b/.github/workflows/refresh-lockfiles.yml index 1f41c8c265..f93858e03d 100644 --- a/.github/workflows/refresh-lockfiles.yml +++ b/.github/workflows/refresh-lockfiles.yml @@ -93,7 +93,11 @@ jobs: body: | Lockfiles updated to the latest resolvable environment. - If the CI test suite fails, create a new branch based of this pull request and add the required fixes to that branch. + ### If the CI tasks fail, create a new branch based on this PR and add the required fixes to that branch. + + ### If the PR CI tasks have not run, please close and re-open this PR to trigger them. + + Reference: create-pull-request GHA [triggering further workflow runs](https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs) labels: | New: Pull Request Bot