Skip to content

Commit

Permalink
Merge branch 'FEATURE_pytest_conversion' into pytest-conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
trexfeathers authored Oct 31, 2024
2 parents f2b77e9 + 00f0e0c commit 79c7fc0
Show file tree
Hide file tree
Showing 495 changed files with 33,968 additions and 20,144 deletions.
13 changes: 9 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
directories:
- "/"
- "/.github/workflows/composite/*"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
# Check later in the week - the upstream dependabot check in `workflows` runs deliberately early in the week.
# Therefore allowing time for the `workflows` update to be merged-and-released first.
interval: "weekly"
day: "thursday"
time: "01:00"
timezone: "Europe/London"
labels:
- "New: Pull Request"
- "Bot"
9 changes: 9 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# benchmark_this automatically triggers the benchmark workflow when added by
# a user. No triggering happens when GitHub Actions adds the label (this
# avoids security vulnerabilities), so alternative triggers for the below
# files are therefore included in workflows/benchmarks_run.yml. Automatic
# labelling is still included here to make it easier to search pull requests,
# and to reinforce the culture of using this label.
benchmark_this:
- changed-files:
- any-glob-to-any-file: ['requirements/locks/*.lock', "setup.py"]
5 changes: 5 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@

---
[Consult Iris pull request check list]( https://scitools-iris.readthedocs.io/en/latest/developers_guide/contributing_pull_request_checklist.html)

---
Add any of the below labels to trigger actions on this PR:

- https://github.com/SciTools/iris/labels/benchmark_this
55 changes: 43 additions & 12 deletions .github/workflows/benchmarks_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,51 @@ on:
required: false
type: string
pull_request:
types: [labeled]
# Add the `labeled` type to the default list.
types: [labeled, opened, synchronize, reopened]

jobs:
pre-checks:
runs-on: ubuntu-latest
if: github.repository == 'SciTools/iris'
outputs:
overnight: ${{ steps.overnight.outputs.check }}
branch: ${{ steps.branch.outputs.check }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- id: files-changed
uses: marceloprado/has-changed-path@df1b7a3161b8fb9fd8c90403c66a9e66dfde50cb
with:
# SEE ALSO .github/labeler.yml .
paths: requirements/locks/*.lock setup.py
- id: overnight
if: github.event_name != 'pull_request'
run: echo "check=true" >> "$GITHUB_OUTPUT"
- id: branch
if: >
github.event_name == 'pull_request'
&&
(
steps.files-changed.outputs.changed == 'true'
||
github.event.label.name == 'benchmark_this'
)
run: echo "check=true" >> "$GITHUB_OUTPUT"


benchmark:
if: >
github.repository == 'SciTools/iris' &&
(github.event_name != 'pull_request' ||
github.event.label.name == 'benchmark_this')
runs-on: ubuntu-latest
needs: pre-checks
if: >
needs.pre-checks.outputs.overnight == 'true' ||
needs.pre-checks.outputs.branch == 'true'
env:
IRIS_TEST_DATA_LOC_PATH: benchmarks
IRIS_TEST_DATA_PATH: benchmarks/iris-test-data
IRIS_TEST_DATA_VERSION: "2.22"
IRIS_TEST_DATA_VERSION: "2.28"
# Lets us manually bump the cache to rebuild
ENV_CACHE_BUILD: "0"
TEST_DATA_CACHE_BUILD: "2"
Expand All @@ -40,9 +71,9 @@ jobs:
with:
fetch-depth: 0

- name: Install ASV & Nox
- name: Install Nox
run: |
pip install asv nox
pip install nox
- name: Cache environment directories
id: cache-env-dir
Expand Down Expand Up @@ -76,16 +107,16 @@ jobs:
echo "OVERRIDE_TEST_DATA_REPOSITORY=${GITHUB_WORKSPACE}/${IRIS_TEST_DATA_PATH}/test_data" >> $GITHUB_ENV
- name: Benchmark this pull request
if: ${{ github.event.label.name == 'benchmark_this' }}
if: needs.pre-checks.outputs.branch == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
run: |
python benchmarks/bm_runner.py branch origin/${{ github.base_ref }}
nox -s benchmarks -- branch origin/${{ github.base_ref }}
- name: Run overnight benchmarks
id: overnight
if: ${{ github.event_name != 'pull_request' }}
if: needs.pre-checks.outputs.overnight == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -97,7 +128,7 @@ jobs:
if [ "$first_commit" != "" ]
then
python benchmarks/bm_runner.py overnight $first_commit
nox -s benchmarks -- overnight $first_commit
fi
- name: Warn of failure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ concurrency:
jobs:
manifest:
name: "check-manifest"
uses: scitools/workflows/.github/workflows/ci-manifest.yml@2023.12.1
uses: scitools/workflows/.github/workflows/ci-manifest.yml@2024.10.2
32 changes: 18 additions & 14 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,23 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.11"]
python-version: ["3.12"]
session: ["doctest", "gallery", "linkcheck"]
include:
- os: "ubuntu-latest"
python-version: "3.11"
python-version: "3.12"
session: "tests"
coverage: "--coverage"
- os: "ubuntu-latest"
python-version: "3.10"
python-version: "3.11"
session: "tests"
- os: "ubuntu-latest"
python-version: "3.9"
python-version: "3.10"
session: "tests"

env:
IRIS_TEST_DATA_VERSION: "2.22"
# NOTE: IRIS_TEST_DATA_VERSION is also set in benchmarks_run.yml
IRIS_TEST_DATA_VERSION: "2.28"
ENV_NAME: "ci-tests"

steps:
Expand All @@ -68,30 +69,29 @@ jobs:
- name: "data cache"
uses: ./.github/workflows/composite/iris-data-cache
with:
cache_build: 0
cache_build: 6
env_name: ${{ env.ENV_NAME }}
version: ${{ env.IRIS_TEST_DATA_VERSION }}

- name: "conda package cache"
uses: ./.github/workflows/composite/conda-pkg-cache
with:
cache_build: 0
cache_build: 6
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}

- name: "conda install"
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
channels: conda-forge,defaults
channels: conda-forge
activate-environment: ${{ env.ENV_NAME }}
auto-update-conda: false
use-only-tar-bz2: true

- name: "conda environment cache"
uses: ./.github/workflows/composite/conda-env-cache
with:
cache_build: 0
cache_build: 6
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}
install_packages: "cartopy nox pip"
Expand All @@ -104,14 +104,14 @@ jobs:
- name: "cartopy cache"
uses: ./.github/workflows/composite/cartopy-cache
with:
cache_build: 0
cache_build: 6
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}

- name: "nox cache"
uses: ./.github/workflows/composite/nox-cache
with:
cache_build: 2
cache_build: 6
env_name: ${{ env.ENV_NAME }}
lock_file: ${{ env.LOCK_FILE }}

Expand All @@ -136,9 +136,13 @@ jobs:
- name: "iris ${{ matrix.session }}"
env:
PY_VER: ${{ matrix.python-version }}
# Force coloured output on GitHub Actions.
PY_COLORS: "1"
run: |
nox --session ${{ matrix.session }} -- --verbose ${{ matrix.coverage }}
- name: Upload coverage report
uses: codecov/codecov-action@v3
- name: "upload coverage report"
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ci-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
session: ["wheel"]
env:
ENV_NAME: "ci-wheels"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/composite/cartopy-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/cache@v3
- uses: actions/cache@v4
id: cartopy-cache
with:
path: ~/.local/share/cartopy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/composite/conda-env-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/cache@v3
- uses: actions/cache@v4
id: conda-env-cache
with:
path: ${{ env.CONDA }}/envs/${{ inputs.env_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/composite/conda-pkg-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-pkgs-${{ inputs.env_name }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }}
2 changes: 1 addition & 1 deletion .github/workflows/composite/iris-data-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/cache@v3
- uses: actions/cache@v4
id: data-cache
with:
path: ~/iris-test-data
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/composite/nox-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.nox
key: ${{ runner.os }}-nox-${{ inputs.env_name }}-s${{ matrix.session }}-py${{ matrix.python-version }}-b${{ inputs.cache_build }}-${{ hashFiles(inputs.lock_file) }}
15 changes: 15 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Reference
# - https://github.com/actions/labeler

name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
2 changes: 1 addition & 1 deletion .github/workflows/refresh-lockfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ on:

jobs:
refresh_lockfiles:
uses: scitools/workflows/.github/workflows/refresh-lockfiles.yml@2023.12.1
uses: scitools/workflows/.github/workflows/refresh-lockfiles.yml@2024.10.2
secrets: inherit
25 changes: 20 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ minimum_pre_commit_version: 1.21.0

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
# Prevent giant files from being committed.
- id: check-added-large-files
Expand All @@ -29,7 +29,7 @@ repos:
- id: no-commit-to-branch

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.13"
rev: "v0.7.1"
hooks:
- id: ruff
types: [file, python]
Expand All @@ -38,20 +38,20 @@ repos:
types: [file, python]

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
rev: "v2.3.0"
hooks:
- id: codespell
types_or: [asciidoc, python, markdown, rst]
additional_dependencies: [tomli]

- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
types: [file, python]

- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
rev: 1.19.1
hooks:
- id: blacken-docs
types: [file, rst]
Expand All @@ -61,3 +61,18 @@ repos:
hooks:
- id: sort-all
types: [file, python]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.13.0'
hooks:
- id: mypy
additional_dependencies:
- 'types-requests'
exclude: 'noxfile\.py|docs/src/conf\.py'

- repo: https://github.com/numpy/numpydoc
rev: v1.8.0
hooks:
- id: numpydoc-validation
exclude: "^lib/iris/tests/|docs/gallery_code/"
types: [file, python]
Loading

0 comments on commit 79c7fc0

Please sign in to comment.