Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into lazy-vegfrac
Browse files Browse the repository at this point in the history
  • Loading branch information
bouweandela committed Sep 26, 2024
2 parents 801e5f8 + 4b0dd41 commit 0763861
Show file tree
Hide file tree
Showing 564 changed files with 29,760 additions and 23,675 deletions.
70 changes: 50 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
version: 2.1

orbs:
coverage-reporter: codacy/coverage-reporter@13.16.5
codecov: codecov/codecov@3.2.5
coverage-reporter: codacy/coverage-reporter@14.0.0
codecov: codecov/codecov@4.1.0

commands:
check_changes:
Expand All @@ -28,7 +28,6 @@ commands:
mkdir -p test-reports
. /opt/conda/etc/profile.d/conda.sh
conda activate esmvaltool
flake8 -j 4
pytest -n 4 --junitxml=test-reports/report.xml
esmvaltool version
- store_test_results:
Expand All @@ -48,8 +47,15 @@ commands:
test_installation_from_source:
parameters:
extra:
description: pip "extra"s to install
type: string
default: "test"
flags:
description: pip install flags
type: string
default: ""
upstream_packages:
description: List of packages that will be installed with pip.
type: string
default: ""
steps:
Expand All @@ -74,20 +80,25 @@ commands:
- r-yaml
- ncl
" >> environment.yml
# Installation of development version of packages requires compilers
if [[ "<< parameters.upstream_packages >>" ]]; then
echo " - compilers" >> environment.yml
fi
# Install
. /opt/conda/etc/profile.d/conda.sh
mkdir /logs
mamba env create >> /logs/conda.txt 2>&1
mamba env create |& tee /logs/conda.txt
git stash # Restore repository state to get clean version number.
conda activate esmvaltool
pip install << parameters.flags >> ".[<<parameters.extra>>]"> /logs/install.txt 2>&1
pip install << parameters.flags >> ".[<<parameters.extra>>]" << parameters.upstream_packages >> |& tee /logs/install.txt
- run:
name: Log versions
command: |
. /opt/conda/etc/profile.d/conda.sh
conda activate esmvaltool
dpkg -l > /logs/versions.txt
conda env export > /logs/environment.yml
pip freeze > /logs/requirements.txt
dpkg -l | tee /logs/versions.txt
conda env export | tee /logs/environment.yml
pip freeze | tee /logs/requirements.txt
- test_and_report
- save_cache:
key: install-<< parameters.extra >>-{{ .Branch }}-{{ checksum "cache_key.txt" }}
Expand Down Expand Up @@ -116,7 +127,7 @@ jobs:
. /opt/conda/etc/profile.d/conda.sh
mkdir /logs
conda activate esmvaltool
pip install .[test] > /logs/install.txt 2>&1
pip install .[test] |& tee -a /logs/install.txt
- test_and_report
- save_cache:
key: test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
Expand All @@ -141,8 +152,7 @@ jobs:
- image: condaforge/mambaforge
resource_class: large
steps:
- test_installation_from_source:
extra: test
- test_installation_from_source

test_installation_from_source_develop_mode:
# Test development installation
Expand All @@ -154,6 +164,25 @@ jobs:
extra: develop
flags: "--editable"

test_with_upstream_developments:
# Test with development versions of upstream packages
docker:
- image: condaforge/mambaforge
resource_class: large
steps:
- test_installation_from_source:
upstream_packages: >-
git+https://github.com/esgf/esgf-pyclient
git+https://github.com/euro-cordex/py-cordex
git+https://github.com/SciTools/cartopy
git+https://github.com/SciTools/cf-units
git+https://github.com/SciTools/iris
git+https://github.com/SciTools/iris-grib
git+https://github.com/SciTools/nc-time-axis
git+https://github.com/SciTools-incubator/iris-esmf-regrid
git+https://github.com/SciTools-incubator/python-stratify
git+https://github.com/Toblerity/Fiona
test_installation_from_conda:
# Test conda package installation
working_directory: /esmvaltool
Expand All @@ -167,14 +196,13 @@ jobs:
set -x
# Install prerequisites
mkdir /logs
# conda update -y conda > /logs/conda.txt 2>&1
# Create and activate conda environment
mamba create -y --name esmvaltool 'python=3.11'
set +x; conda activate esmvaltool; set -x
# Install
mamba install -y esmvalcore
# Log versions
conda env export > /logs/environment.yml
conda env export | tee /logs/environment.yml
# Test installation
esmvaltool version
Expand All @@ -194,9 +222,9 @@ jobs:
conda activate esmvaltool
pip install .[doc]
# Log versions
dpkg -l > /logs/versions.txt
conda env export > /logs/environment.yml
pip freeze > /logs/requirements.txt
dpkg -l | tee /logs/versions.txt
conda env export | tee /logs/environment.yml
pip freeze | tee /logs/requirements.txt
# Test building documentation
MPLBACKEND=Agg sphinx-build -W doc doc/build
- store_artifacts:
Expand All @@ -206,8 +234,9 @@ workflows:
commit:
jobs:
- run_tests
- test_installation_from_source_test_mode
- test_installation_from_source_develop_mode
- test_installation_from_source_test_mode
- test_with_upstream_developments

nightly:
triggers:
Expand All @@ -218,8 +247,9 @@ workflows:
only:
- main
jobs:
- run_tests
- test_installation_from_source_test_mode
- build_documentation
- test_installation_from_source_develop_mode
- run_tests
- test_installation_from_conda
- test_installation_from_source_develop_mode
- test_installation_from_source_test_mode
- test_with_upstream_developments
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ indent_size = 2

[*.{md,Rmd}]
trim_trailing_whitespace = false

2 changes: 0 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
esmvalcore/cmor @jvegasbsc
.github/workflows @valeriupredoi

2 changes: 0 additions & 2 deletions .github/workflows/create-condalock-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ jobs:
run: |
esmvaltool --help
esmvaltool version
- name: Run flake8
run: flake8
- name: Run pytests
run: pytest -n 2 -m "not installation"
# Automated PR
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/install-from-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
# fail-fast set to False allows all other tests
# in the workflow to run regardless of any fail
fail-fast: false
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
runs-on: "macos-latest"
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
architecture: ["x64"] # need to force Intel, arm64 builds have issues
fail-fast: false
name: OSX Python ${{ matrix.python-version }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/install-from-condalock-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false
name: Linux Python ${{ matrix.python-version }}
steps:
Expand All @@ -51,7 +51,6 @@ jobs:
- run: pip install -e .[develop]
- run: esmvaltool --help
- run: esmvaltool version 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/version.txt
- run: flake8
- run: pytest -n 2 -m "not installation"
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/install-from-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
# fail-fast set to False allows all other tests
# in the workflow to run regardless of any fail
fail-fast: false
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
runs-on: "macos-latest"
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
architecture: ["x64"] # need to force Intel, arm64 builds have issues
fail-fast: false
name: OSX Python ${{ matrix.python-version }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/install-from-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false
name: Linux Python ${{ matrix.python-version }}
steps:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
runs-on: "macos-latest"
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
architecture: ["x64"] # need to force Intel, arm64 builds have issues
fail-fast: false
name: OSX Python ${{ matrix.python-version }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tests-monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false
name: Linux Python ${{ matrix.python-version }}
steps:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
runs-on: "macos-latest"
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
architecture: ["x64"] # need to force Intel, arm64 builds have issues
fail-fast: false
name: OSX Python ${{ matrix.python-version }}
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false
name: Linux Python ${{ matrix.python-version }}
steps:
Expand All @@ -60,7 +60,9 @@ jobs:
- run: conda list
- run: pip install -e .[develop] 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/install.txt
- run: conda list
- run: flake8
- run: |
pre-commit install
pre-commit run -a
- run: pytest -n 2 -m "not installation" 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/test_report.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
Expand All @@ -73,7 +75,7 @@ jobs:
runs-on: "macos-latest"
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
architecture: ["x64"] # need to force Intel, arm64 builds have issues
fail-fast: false
name: OSX Python ${{ matrix.python-version }}
Expand All @@ -97,7 +99,9 @@ jobs:
- run: conda list
- run: pip install -e .[develop] 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/install.txt
- run: conda list
- run: flake8
- run: |
pre-commit install
pre-commit run -a
- run: pytest -n 2 -m "not installation" 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/test_report.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
Expand Down
38 changes: 16 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
---
ci:
autofix_prs: false

exclude: |
(?x)
^doc/conf.py|
^esmvalcore/cmor/tables/|
^esmvalcore/preprocessor/ne_masks/
^esmvalcore/preprocessor/ne_masks/|
^esmvalcore/preprocessor/shapefiles/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -19,33 +24,22 @@ repos:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/adrienverge/yamllint
rev: 'v1.31.0'
rev: 'v1.35.1'
hooks:
- id: yamllint
- repo: https://github.com/codespell-project/codespell
rev: 'v2.2.4'
rev: 'v2.3.0'
hooks:
- id: codespell
- repo: https://github.com/PyCQA/isort
rev: '5.12.0'
additional_dependencies: [tomli] # required for Python 3.10
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.8"
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-yapf
rev: 'v0.32.0'
hooks:
- id: yapf
additional_dependencies:
- 'toml'
- repo: https://github.com/myint/docformatter
rev: 'v1.6.5'
hooks:
- id: docformatter
- repo: https://github.com/pycqa/flake8
rev: '6.0.0'
hooks:
- id: flake8
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.2.0'
rev: 'v1.11.2'
hooks:
- id: mypy
additional_dependencies:
Expand Down
Loading

0 comments on commit 0763861

Please sign in to comment.