Skip to content

Commit b49e21e

Browse files
committed
Merge branch 'main' of github.com:ESMValGroup/ESMValCore into modernize-derived-variables
2 parents 6e5eb70 + e232092 commit b49e21e

105 files changed

Lines changed: 21211 additions & 2152 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 72 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -3,253 +3,121 @@ version: 2.1
33

44
orbs:
55
codecov: codecov/codecov@5.3.0
6+
pixi: prefix-dev/pixi@0.1.0
67

7-
commands:
8-
check_changes:
8+
jobs:
9+
test:
10+
# Run tests.
11+
docker:
12+
- image: cimg/base:current
13+
resource_class: large
914
steps:
15+
- checkout
16+
- pixi/pixi_setup
1017
- run:
11-
name: Check whether or not installation tests are needed
12-
command: |
13-
if (test "$CIRCLE_BRANCH" = main ||
14-
git --no-pager diff --name-only origin/main... |
15-
grep -q -E -f .circleci/install_triggers)
16-
then
17-
echo Running installation tests
18-
else
19-
echo Skipping installation tests
20-
circleci step halt
21-
fi
22-
test_and_report:
23-
parameters:
24-
args:
25-
type: string
26-
default: ""
27-
steps:
18+
name: Check dependencies are compatible
19+
command: pixi run --as-is pip check
2820
- run:
2921
name: Run tests
3022
command: |
31-
mkdir -p test-reports
32-
. /opt/conda/etc/profile.d/conda.sh
33-
conda activate esmvaltool
34-
pytest -n 4 --junitxml=test-reports/report.xml << parameters.args >>
35-
esmvaltool version
36-
esmvaltool -- --help
23+
pixi run --as-is test --cov -n 4 --durations=10 --junitxml=test-reports/report.xml
24+
- run:
25+
name: Test the command line interface
26+
command: |
27+
pixi run --as-is esmvaltool version
28+
pixi run --as-is esmvaltool -- --help
29+
pixi run --as-is esmvaltool config list
30+
pixi run --as-is esmvaltool config show
31+
- codecov/upload:
32+
files: "test-reports/coverage.xml"
33+
disable_search: true
3734
- store_test_results:
3835
path: test-reports/report.xml
39-
- store_artifacts:
40-
path: /logs
4136
- run:
4237
name: Compress pytest artifacts
43-
command: tar -cvzf pytest.tar.gz -C /tmp/pytest-of-root/pytest-0/ .
38+
command: tar -cvzf pytest.tar.gz -C /tmp/pytest-of-$(whoami)/ .
4439
- store_artifacts:
4540
path: pytest.tar.gz
4641
- run:
4742
name: Compress test-report artifacts
4843
command: tar -cvzf test-reports.tar.gz test-reports/
4944
- store_artifacts:
5045
path: test-reports.tar.gz
51-
test_installation_from_source:
52-
parameters:
53-
extra:
54-
description: pip "extra"s to install
55-
type: string
56-
default: "test"
57-
flags:
58-
description: pip install --no-deps flags
59-
type: string
60-
default: ""
61-
upstream_packages:
62-
description: List of packages that will be installed with pip.
63-
type: string
64-
default: ""
46+
47+
test_with_upstream_developments:
48+
# Test with development versions of upstream packages.
49+
docker:
50+
- image: cimg/base:current
51+
resource_class: large
6552
steps:
66-
- run:
67-
name: Install git+ssh
68-
environment:
69-
DEBIAN_FRONTEND: noninteractive # needed to install tzdata
70-
command: apt update && apt install -y git ssh
7153
- checkout
72-
- check_changes
73-
- run:
74-
name: Generate cache key
75-
command: date '+%Y-%V' | tee cache_key.txt
76-
- restore_cache:
77-
key: install-<< parameters.extra >>-{{ .Branch }}-{{ checksum "cache_key.txt" }}
54+
- pixi/pixi_setup
7855
- run:
79-
name: Install dependencies
80-
no_output_timeout: 30m
56+
name: Install development versions of upstream packages
8157
command: |
82-
# Add additional requirements for running all tests
83-
echo "
84-
- r-base
85-
- r-yaml
86-
- ncl
87-
" >> environment.yml
88-
# Installation of development version of packages requires compilers
89-
if [[ "<< parameters.upstream_packages >>" ]]; then
90-
echo " - compilers" >> environment.yml
91-
fi
92-
# Install
93-
. /opt/conda/etc/profile.d/conda.sh
94-
mkdir /logs
95-
mamba env create -n esmvaltool -f environment.yml |& tee /logs/conda.txt
96-
git stash # Restore repository state to get clean version number.
97-
conda activate esmvaltool
98-
pip install --no-deps << parameters.flags >> ".[<<parameters.extra>>]" << parameters.upstream_packages >> |& tee /logs/install.txt
58+
pixi run --as-is pip install \
59+
git+https://github.com/esgf2-us/intake-esgf \
60+
git+https://github.com/euro-cordex/py-cordex \
61+
git+https://github.com/SciTools/cartopy \
62+
git+https://github.com/SciTools/cf-units \
63+
git+https://github.com/SciTools/iris \
64+
git+https://github.com/SciTools/iris-grib \
65+
git+https://github.com/SciTools/nc-time-axis \
66+
git+https://github.com/SciTools/ncdata \
67+
git+https://github.com/SciTools/iris-esmf-regrid \
68+
git+https://github.com/SciTools/python-stratify
9969
- run:
100-
name: Log versions
70+
name: Run tests
10171
command: |
102-
. /opt/conda/etc/profile.d/conda.sh
103-
conda activate esmvaltool
104-
dpkg -l | tee /logs/versions.txt
105-
conda env export | tee /logs/environment.yml
106-
pip freeze | tee /logs/requirements.txt
72+
pixi run --as-is test -n 4 --junitxml=test-reports/report.xml
10773
- run:
108-
name: Check dependencies are compatible
74+
name: Test the command line interface
10975
command: |
110-
if [[ "<< parameters.upstream_packages >>" = "" ]]; then
111-
. /opt/conda/etc/profile.d/conda.sh
112-
conda activate esmvaltool
113-
pip check
114-
else
115-
echo "Skipping `pip check` due to upstream packages"
116-
fi
117-
- test_and_report
118-
- save_cache:
119-
key: install-<< parameters.extra >>-{{ .Branch }}-{{ checksum "cache_key.txt" }}
120-
paths:
121-
- /opt/conda/pkgs
122-
- /root/.cache/pip
123-
- .mypy_cache
124-
- .pytest_cache
125-
126-
jobs:
127-
run_tests:
128-
# Run tests
129-
docker:
130-
- image: esmvalgroup/esmvalcore:development
131-
resource_class: large
132-
steps:
133-
- checkout
134-
- run:
135-
name: Generate cache key
136-
command: date '+%Y-%V' | tee cache_key.txt
137-
- restore_cache:
138-
key: test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
76+
pixi run --as-is esmvaltool version
77+
pixi run --as-is esmvaltool -- --help
78+
- store_test_results:
79+
path: test-reports/report.xml
13980
- run:
140-
name: Install dependencies
141-
command: |
142-
. /opt/conda/etc/profile.d/conda.sh
143-
mkdir /logs
144-
conda activate esmvaltool
145-
pip install --no-deps .[test] > /logs/install.txt 2>&1
146-
pip check
147-
- test_and_report:
148-
args: --cov
149-
- save_cache:
150-
key: test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
151-
paths:
152-
- /root/.cache/pip
153-
- .mypy_cache
154-
- .pytest_cache
81+
name: Compress pytest artifacts
82+
command: tar -cvzf pytest.tar.gz -C /tmp/pytest-of-$(whoami)/ .
83+
- store_artifacts:
84+
path: pytest.tar.gz
15585
- run:
156-
name: Install gpg (required by codecov orb)
157-
command: apt update && apt install -y gpg
158-
- codecov/upload:
159-
files: "test-reports/coverage.xml"
160-
disable_search: true
161-
162-
test_installation_from_source_test_mode:
163-
# Test installation from source
164-
docker:
165-
- image: condaforge/miniforge3
166-
resource_class: large
167-
steps:
168-
- test_installation_from_source
169-
170-
test_installation_from_source_develop_mode:
171-
# Test development installation
172-
docker:
173-
- image: condaforge/miniforge3
174-
resource_class: large
175-
steps:
176-
- test_installation_from_source:
177-
extra: develop
178-
flags: "--editable"
179-
180-
test_with_upstream_developments:
181-
# Test with development versions of upstream packages
182-
docker:
183-
- image: condaforge/miniforge3
184-
resource_class: large
185-
steps:
186-
- test_installation_from_source:
187-
upstream_packages: >-
188-
git+https://github.com/esgf/esgf-pyclient
189-
git+https://github.com/euro-cordex/py-cordex
190-
git+https://github.com/SciTools/cartopy
191-
git+https://github.com/SciTools/cf-units
192-
git+https://github.com/SciTools/iris
193-
git+https://github.com/SciTools/iris-grib
194-
git+https://github.com/SciTools/nc-time-axis
195-
git+https://github.com/SciTools-incubator/iris-esmf-regrid
196-
git+https://github.com/SciTools-incubator/python-stratify
197-
git+https://github.com/Toblerity/Fiona
86+
name: Compress test-report artifacts
87+
command: tar -cvzf test-reports.tar.gz test-reports/
88+
- store_artifacts:
89+
path: test-reports.tar.gz
19890

19991
test_installation_from_conda:
200-
# Test conda package installation
201-
working_directory: /esmvaltool
92+
# Test installation from conda-forge.
20293
docker:
203-
- image: condaforge/miniforge3
94+
- image: mambaorg/micromamba
20495
resource_class: medium
20596
steps:
20697
- run:
98+
name: Install ESMValCore from conda
20799
command: |
208-
. /opt/conda/etc/profile.d/conda.sh
209-
set -x
210-
# Install prerequisites
211-
mkdir /logs
212-
# Create and activate conda environment
213-
mamba create -y --name esmvaltool 'python=3.12'
214-
set +x; conda activate esmvaltool; set -x
215-
# Install
216-
mamba install -y esmvalcore
217-
# Log versions
218-
conda env export | tee /logs/environment.yml
219-
# Test installation
220-
esmvaltool version
100+
micromamba create -y --name esmvalcore esmvalcore
101+
micromamba env export --name esmvalcore
102+
micromamba run --name esmvalcore esmvaltool -- --help
103+
micromamba run --name esmvalcore esmvaltool version
221104
222105
build_documentation:
223-
# Test building documentation
106+
# Test building documentation.
224107
docker:
225-
- image: condaforge/miniforge3
226-
resource_class: medium
108+
- image: cimg/base:current
109+
resource_class: small
227110
steps:
228111
- checkout
112+
- pixi/pixi_setup
229113
- run:
230-
command: |
231-
mkdir /logs
232-
. /opt/conda/etc/profile.d/conda.sh
233-
# Install
234-
mamba env create -n esmvaltool -f environment.yml
235-
conda activate esmvaltool
236-
pip install --no-deps .[doc]
237-
pip check
238-
# Log versions
239-
dpkg -l | tee /logs/versions.txt
240-
conda env export | tee /logs/environment.yml
241-
pip freeze | tee /logs/requirements.txt
242-
# Test building documentation
243-
MPLBACKEND=Agg sphinx-build -W doc doc/build
244-
- store_artifacts:
245-
path: /logs
114+
name: Build documentation
115+
command: pixi run --as-is doc --fail-on-warning --show-traceback
246116

247117
workflows:
248118
commit:
249119
jobs:
250-
- run_tests
251-
- test_installation_from_source_develop_mode
252-
- test_installation_from_source_test_mode
120+
- test
253121

254122
nightly:
255123
triggers:
@@ -261,8 +129,6 @@ workflows:
261129
- main
262130
jobs:
263131
- build_documentation
264-
- run_tests
132+
- test
265133
- test_installation_from_conda
266-
- test_installation_from_source_develop_mode
267-
- test_installation_from_source_test_mode
268134
- test_with_upstream_developments

.circleci/install_triggers

Lines changed: 0 additions & 3 deletions
This file was deleted.

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
**/__pycache__
3+
.*
4+
doc
5+
tests
6+
ESMValCore.egg-info
7+
8+
!.git
9+
!.zenodo.json

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true -diff

.github/workflows/build-and-deploy-on-pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Build a binary wheel and a source tarball
3636
run: python3 -m build
3737
- name: Store the distribution packages
38-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
38+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
3939
with:
4040
name: python-package-distributions
4141
path: dist/
@@ -55,9 +55,9 @@ jobs:
5555

5656
steps:
5757
- name: Download all the dists
58-
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
58+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
5959
with:
6060
name: python-package-distributions
6161
path: dist/
6262
- name: Publish distribution 📦 to PyPI
63-
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
63+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0

0 commit comments

Comments
 (0)