Skip to content

Commit c4ccee3

Browse files
committed
Merge remote-tracking branch 'origin/main' into cmorize_glass
2 parents 236e40c + 75304ca commit c4ccee3

1,390 files changed

Lines changed: 146003 additions & 42248 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: 86 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,48 @@
22
version: 2.1
33

44
orbs:
5-
coverage-reporter: codacy/coverage-reporter@13.11.16
5+
pixi: prefix-dev/pixi@0.1.0
66

7-
commands:
8-
9-
check_changes:
7+
jobs:
8+
tests:
9+
# Run tests
10+
docker:
11+
- image: cimg/base:current
12+
resource_class: large
1013
steps:
14+
- checkout
15+
- pixi/pixi_setup
1116
- run:
12-
name: Check whether or not installation tests are needed
17+
name: Check dependencies are compatible and installed
1318
command: |
14-
if (test "$CIRCLE_BRANCH" = main ||
15-
git --no-pager diff --name-only origin/main... |
16-
grep -q -E -f .circleci/install_triggers)
17-
then
18-
echo Running installation tests
19-
else
20-
echo Skipping installation tests
21-
circleci step halt
22-
fi
23-
24-
log_versions:
25-
steps:
19+
pixi run --as-is pip check
20+
# The following command should not install any new dependencies
21+
# because they are already in the conda environment, but this is
22+
# not checked.
23+
pixi run --as-is pip install --dry-run .[all]
2624
- run:
27-
name: Log versions
28-
command: |
29-
. /opt/conda/etc/profile.d/conda.sh
30-
conda activate esmvaltool
31-
esmvaltool version
32-
dpkg -l > /logs/versions.txt
33-
conda env export > /logs/environment.yml
34-
pip freeze > /logs/requirements.txt
35-
36-
test_and_report:
37-
steps:
25+
name: Check code formatting and mistakes
26+
command: pixi run --as-is pre-commit run --all
3827
- run:
3928
name: Run tests
4029
command: |
41-
. /opt/conda/etc/profile.d/conda.sh
42-
conda activate esmvaltool
43-
pytest -n 4 --junitxml=test-reports/report.xml
30+
pixi run --as-is test -n 4 --durations=10 --junitxml=test-reports/report.xml
31+
- run:
32+
name: Check the command line interface
33+
command: |
34+
source <(pixi shell-hook --as-is)
4435
esmvaltool version
4536
esmvaltool -- --help
46-
ncl -V
47-
cdo --version
37+
esmvaltool develop compare -- --help
4838
- store_test_results:
4939
path: test-reports/report.xml
50-
- store_artifacts:
51-
path: /logs
40+
- run:
41+
# Documentation available at https://docs.codacy.com/coverage-reporter/
42+
name: Upload coverage report to Codacy
43+
command: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -s -r test-reports/coverage.xml
5244
- run:
5345
name: Compress pytest artifacts
54-
command: tar -cvzf pytest.tar.gz -C /tmp/pytest-of-root/ .
46+
command: tar -cvzf pytest.tar.gz -C /tmp/pytest-of-$(whoami)/ .
5547
when: always
5648
- store_artifacts:
5749
path: pytest.tar.gz
@@ -62,197 +54,106 @@ commands:
6254
- store_artifacts:
6355
path: test-reports.tar.gz
6456

65-
test_installation_from_source:
66-
parameters:
67-
extra:
68-
type: string
69-
flags:
70-
type: string
71-
default: ""
72-
steps:
73-
- run:
74-
name: Install git+ssh
75-
environment:
76-
DEBIAN_FRONTEND: noninteractive # needed to install tzdata
77-
command: apt update && apt install -y git ssh
78-
- checkout
79-
- check_changes
80-
- run:
81-
name: Generate cache key
82-
command: date '+%Y-%V' | tee cache_key.txt
83-
- restore_cache:
84-
key: install-<< parameters.extra >>-{{ .Branch }}-{{ checksum "cache_key.txt" }}
85-
- run:
86-
name: Install dependencies
87-
command: |
88-
# Install
89-
. /opt/conda/etc/profile.d/conda.sh
90-
mkdir /logs
91-
mamba env create >> /logs/conda.txt 2>&1
92-
conda activate esmvaltool
93-
pip install << parameters.flags >> ".[<<parameters.extra>>]"> /logs/install.txt 2>&1
94-
esmvaltool install Julia > /logs/install_julia.txt 2>&1
95-
if [[ "<<parameters.flags>>" != *'--editable'* ]]
96-
then
97-
rm -r esmvaltool
98-
fi
99-
- log_versions
100-
- run:
101-
name: Lint source code
102-
command: |
103-
. /opt/conda/etc/profile.d/conda.sh
104-
conda activate esmvaltool
105-
flake8 -j 4
106-
- test_and_report
107-
- save_cache:
108-
key: install-<< parameters.extra >>-{{ .Branch }}-{{ checksum "cache_key.txt" }}
109-
paths:
110-
- /opt/conda/pkgs
111-
- /root/.cache/pip
112-
- .pytest_cache
113-
114-
jobs:
115-
run_tests:
116-
# Run tests
57+
test_esmvaltool_base_installation:
58+
# Test running the example recipe with minimal dependencies.
11759
docker:
118-
- image: esmvalgroup/esmvaltool:development
119-
resource_class: large
60+
- image: cimg/base:current
61+
resource_class: medium
12062
steps:
12163
- checkout
12264
- run:
12365
name: Generate cache key
124-
command: date '+%Y-%V' | tee cache_key.txt
66+
# Refresh the cache every month.
67+
command: echo $(date '+%Y-%m') | tee cache_key.txt
12568
- restore_cache:
126-
key: test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
69+
key: test-base-{{ .Branch }}-{{ checksum "cache_key.txt" }}
70+
- pixi/pixi_setup:
71+
env: esmvaltool-base
12772
- run:
128-
name: Install dependencies
73+
name: Check dependencies are compatible
74+
command: pixi run --as-is --environment esmvaltool-base pip check
75+
- run:
76+
name: Run example recipe
12977
command: |
130-
. /opt/conda/etc/profile.d/conda.sh
131-
mkdir /logs
132-
conda activate esmvaltool
133-
pip install .[test] > /logs/install.txt 2>&1
134-
# Run flake8 check with source code (it doesn't work without it)
135-
flake8 -j 4
136-
# Update/install Julia dependencies
137-
esmvaltool install Julia > /logs/install_julia.txt 2>&1
138-
# Remove source to test installed software
139-
rm -r esmvaltool
140-
- test_and_report
78+
source <(pixi shell-hook --as-is --environment esmvaltool-base)
79+
esmvaltool version
80+
esmvaltool config copy data-intake-esgf.yml
81+
python -c '
82+
import intake_esgf
83+
intake_esgf.conf["solr_indices"]["esgf.ceda.ac.uk"] = True
84+
intake_esgf.conf["solr_indices"]["esgf-data.dkrz.de"] = True
85+
intake_esgf.conf.save()
86+
'
87+
esmvaltool run --max-parallel-tasks=2 testing/recipe_python_for_CI.yml
88+
- store_artifacts:
89+
path: /root/esmvaltool_output
14190
- save_cache:
142-
key: test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
91+
key: test-base-{{ .Branch }}-{{ checksum "cache_key.txt" }}
14392
paths:
144-
- /root/.cache/pip
145-
- .pytest_cache
146-
- coverage-reporter/send_report:
147-
coverage-reports: 'test-reports/coverage.xml'
148-
project-token: $CODACY_PROJECT_TOKEN
149-
skip: true # skip if project-token is not defined (i.e. on a fork)
150-
151-
test_installation_from_source_test_mode:
152-
# Test installation from source
153-
docker:
154-
- image: condaforge/mambaforge:latest
155-
resource_class: large
156-
steps:
157-
- test_installation_from_source:
158-
extra: test
159-
160-
test_installation_from_source_develop_mode:
161-
# Test development installation
162-
docker:
163-
- image: condaforge/mambaforge:latest
164-
resource_class: large
165-
steps:
166-
- test_installation_from_source:
167-
extra: develop
168-
flags: "--editable"
93+
- /root/climate_data
16994

17095
test_upstream_development:
17196
# Test running recipes with the development version of ESMValCore. The
17297
# purpose of this test to discover backward-incompatible changes early on in
17398
# the development cycle.
17499
docker:
175-
- image: condaforge/mambaforge:latest
176-
resource_class: large
100+
- image: cimg/base:current
101+
resource_class: medium
177102
steps:
178-
- run:
179-
name: Install git and ssh
180-
environment:
181-
DEBIAN_FRONTEND: noninteractive # needed to install tzdata
182-
command: apt update && apt install -y git ssh
183103
- checkout
184104
- run:
185105
name: Generate cache key
186-
command: echo $(date '+%Y')-$(expr $(date '+%V') / 2) | tee cache_key.txt
106+
# Refresh the cache every month.
107+
command: echo $(date '+%Y-%m') | tee cache_key.txt
187108
- restore_cache:
188109
key: test-upstream-{{ .Branch }}-{{ checksum "cache_key.txt" }}
110+
- pixi/pixi_setup:
111+
env: esmvalcore-dev
189112
- run:
190-
name: Install
113+
name: Run tests
191114
command: |
192-
# Install according to instructions on readthedocs with the
193-
# development version of ESMValTool and ESMValCore:
194-
# https://docs.esmvaltool.org/en/latest/quickstart/installation.html#install-from-source
195-
. /opt/conda/etc/profile.d/conda.sh
196-
mkdir /logs
197-
mamba env create >> /logs/conda.txt 2>&1
198-
conda activate esmvaltool
199-
pip install --editable .[develop]
200-
esmvaltool install Julia > /logs/install_julia.txt 2>&1
201-
git clone https://github.com/ESMValGroup/ESMValCore $HOME/ESMValCore
202-
pip install --editable $HOME/ESMValCore[develop]
203-
- log_versions
204-
- test_and_report
115+
pixi run --as-is --environment esmvalcore-dev test -n 2 --junitxml=test-reports/report.xml
116+
- store_test_results:
117+
path: test-reports/report.xml
205118
- run:
206119
name: Run recipes
207120
command: |
208-
. /opt/conda/etc/profile.d/conda.sh
209-
conda activate esmvaltool
210-
mkdir -p ~/climate_data
211-
esmvaltool config get_config_user
212-
echo "offline: false" >> ~/.esmvaltool/config-user.yml
213-
cat ~/.esmvaltool/config-user.yml
214-
esmvaltool run examples/recipe_python.yml
121+
source <(pixi shell-hook --as-is --environment esmvalcore-dev)
122+
esmvaltool version
123+
esmvaltool config copy data-intake-esgf.yml
124+
python -c '
125+
import intake_esgf
126+
intake_esgf.conf["solr_indices"]["esgf.ceda.ac.uk"] = True
127+
intake_esgf.conf["solr_indices"]["esgf-data.dkrz.de"] = True
128+
intake_esgf.conf.save()
129+
'
215130
for recipe in esmvaltool/recipes/testing/recipe_*.yml; do
216-
esmvaltool run "$recipe"
131+
esmvaltool run --max-parallel-tasks=2 "$recipe"
217132
done
218133
- store_artifacts:
219134
path: /root/esmvaltool_output
220135
- save_cache:
221136
key: test-upstream-{{ .Branch }}-{{ checksum "cache_key.txt" }}
222137
paths:
223-
- /opt/conda/pkgs
224-
- /root/.cache/pip
225138
- /root/climate_data
226139

227140
build_documentation:
228141
# Test building documentation
229142
docker:
230-
- image: condaforge/mambaforge:latest
231-
resource_class: small
143+
- image: cimg/base:current
144+
resource_class: medium
232145
steps:
233146
- checkout
147+
- pixi/pixi_setup
234148
- run:
235-
command: |
236-
mkdir /logs
237-
. /opt/conda/etc/profile.d/conda.sh
238-
# Install
239-
mamba env create
240-
conda activate esmvaltool
241-
pip install .[doc]
242-
# Log versions
243-
dpkg -l > /logs/versions.txt
244-
conda env export > /logs/environment.yml
245-
pip freeze > /logs/requirements.txt
246-
# Test building documentation
247-
MPLBACKEND=Agg sphinx-build -W doc/sphinx/source doc/spinx/build
248-
- store_artifacts:
249-
path: /logs
149+
name: Build documentation
150+
command: pixi run --as-is doc --fail-on-warning --show-traceback
250151

251152
test_installation_from_conda:
252153
# Test conda package installation
253154
docker:
254-
- image: condaforge/mambaforge:latest
255-
resource_class: medium
155+
- image: condaforge/miniforge3:latest
156+
resource_class: large
256157
steps:
257158
- run:
258159
command: |
@@ -261,11 +162,9 @@ jobs:
261162
# Install prerequisites
262163
mkdir /logs
263164
# Install ESMValTool in a new conda environment
264-
mamba create -y --name esmvaltool -c conda-forge esmvaltool julia 'python=3.10' >> /logs/conda.txt 2>&1
165+
mamba create -y --name esmvaltool -c conda-forge esmvaltool 'python=3.13' >> /logs/conda.txt 2>&1
265166
# Activate the environment
266167
set +x; conda activate esmvaltool; set -x
267-
# install the Julia dependencies
268-
esmvaltool install Julia > /logs/install_Julia.txt 2>&1
269168
# Log versions
270169
mamba env export > /logs/environment.yml
271170
# Test installation
@@ -279,9 +178,7 @@ jobs:
279178
workflows:
280179
commit:
281180
jobs:
282-
- run_tests
283-
- test_installation_from_source_test_mode
284-
- test_installation_from_source_develop_mode
181+
- tests
285182
nightly:
286183
triggers:
287184
- schedule:
@@ -291,9 +188,8 @@ workflows:
291188
only:
292189
- main
293190
jobs:
294-
- run_tests
295-
- test_installation_from_source_test_mode
296-
- test_installation_from_source_develop_mode
191+
- tests
192+
- test_esmvaltool_base_installation
297193
- test_upstream_development
298194
- build_documentation
299195
- test_installation_from_conda

.circleci/install_triggers

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

0 commit comments

Comments
 (0)