Skip to content

Commit 48cdc2d

Browse files
committed
Merge branch 'main' of github.com:ESMValGroup/ESMValTool into dev_cordex5_recipe
2 parents 9b83385 + f81189c commit 48cdc2d

694 files changed

Lines changed: 62240 additions & 8482 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: 51 additions & 224 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,43 @@
22
version: 2.1
33

44
orbs:
5-
coverage-reporter: codacy/coverage-reporter@13.13.0
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
13-
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:
17+
name: Check dependencies are compatible
18+
command: pixi run --as-is pip check
2619
- run:
27-
name: Log versions
28-
command: |
29-
. /opt/conda/etc/profile.d/conda.sh
30-
conda env export --name base > /logs/base_environment.yml
31-
conda activate esmvaltool
32-
esmvaltool version
33-
dpkg -l > /logs/versions.txt
34-
conda env export > /logs/environment.yml
35-
pip freeze > /logs/requirements.txt
36-
37-
test_and_report:
38-
steps:
20+
name: Check code formatting and mistakes
21+
command: pixi run --as-is pre-commit run --all
3922
- run:
4023
name: Run tests
4124
command: |
42-
. /opt/conda/etc/profile.d/conda.sh
43-
conda activate esmvaltool
44-
# Add existing Julia to PATH
45-
export PATH=/root/.juliaup/bin:$PATH
46-
pytest -n 4 --junitxml=test-reports/report.xml
25+
pixi run --as-is test -n 4 --durations=10 --junitxml=test-reports/report.xml
26+
- run:
27+
name: Check the command line interface
28+
command: |
29+
source <(pixi shell-hook --as-is)
4730
esmvaltool version
4831
esmvaltool -- --help
4932
esmvaltool develop compare -- --help
50-
ncl -V
51-
cdo --version
5233
- store_test_results:
5334
path: test-reports/report.xml
54-
- store_artifacts:
55-
path: /logs
35+
- run:
36+
# Documentation available at https://docs.codacy.com/coverage-reporter/
37+
name: Upload coverage report to Codacy
38+
command: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -s -r test-reports/coverage.xml
5639
- run:
5740
name: Compress pytest artifacts
58-
command: tar -cvzf pytest.tar.gz -C /tmp/pytest-of-root/ .
41+
command: tar -cvzf pytest.tar.gz -C /tmp/pytest-of-$(whoami)/ .
5942
when: always
6043
- store_artifacts:
6144
path: pytest.tar.gz
@@ -66,210 +49,64 @@ commands:
6649
- store_artifacts:
6750
path: test-reports.tar.gz
6851

69-
test_installation_from_source:
70-
parameters:
71-
extra:
72-
type: string
73-
flags:
74-
type: string
75-
default: ""
76-
steps:
77-
- run:
78-
name: Install git+ssh
79-
environment:
80-
DEBIAN_FRONTEND: noninteractive # needed to install tzdata
81-
command: apt update && apt install -y git ssh
82-
- checkout
83-
- check_changes
84-
- run:
85-
name: Generate cache key
86-
command: date '+%Y-%V' | tee cache_key.txt
87-
- restore_cache:
88-
key: install-<< parameters.extra >>-{{ .Branch }}-{{ checksum "cache_key.txt" }}
89-
- run:
90-
name: Install dependencies
91-
no_output_timeout: 30m
92-
command: |
93-
# Install
94-
. /opt/conda/etc/profile.d/conda.sh
95-
mkdir /logs
96-
mamba --version
97-
conda env create -n esmvaltool -f environment.yml --verbose
98-
conda activate esmvaltool
99-
mamba list >> /logs/conda.txt
100-
pip install << parameters.flags >> ".[<<parameters.extra>>]"> /logs/install.txt 2>&1
101-
curl -fsSL https://install.julialang.org | sh -s -- --yes
102-
export PATH=/root/.juliaup/bin:$PATH
103-
julia --version
104-
esmvaltool install Julia > /logs/install_julia.txt 2>&1
105-
if [[ "<<parameters.flags>>" != *'--editable'* ]]
106-
then
107-
rm -r esmvaltool
108-
fi
109-
- log_versions
110-
- run:
111-
name: Lint source code
112-
command: |
113-
. /opt/conda/etc/profile.d/conda.sh
114-
conda activate esmvaltool
115-
pre-commit run --all
116-
- test_and_report
117-
- save_cache:
118-
key: install-<< parameters.extra >>-{{ .Branch }}-{{ checksum "cache_key.txt" }}
119-
paths:
120-
- /opt/conda/pkgs
121-
- /root/.cache/pip
122-
- .pytest_cache
123-
124-
jobs:
125-
run_tests:
126-
# Run tests
127-
docker:
128-
- image: esmvalgroup/esmvaltool:development
129-
resource_class: large
130-
steps:
131-
- checkout
132-
- run:
133-
name: Generate cache key
134-
command: date '+%Y-%V' | tee cache_key.txt
135-
- restore_cache:
136-
key: test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
137-
- run:
138-
name: Install dependencies
139-
command: |
140-
set -x
141-
. /opt/conda/etc/profile.d/conda.sh
142-
conda activate esmvaltool
143-
mkdir /logs
144-
pip install .[test] > /logs/install.txt 2>&1
145-
curl -fsSL https://install.julialang.org | sh -s -- --yes
146-
export PATH=/root/.juliaup/bin:$PATH
147-
julia --version
148-
esmvaltool install Julia > /logs/install_julia.txt 2>&1
149-
- run:
150-
name: Check Python code style and mistakes
151-
command: |
152-
. /opt/conda/etc/profile.d/conda.sh
153-
conda activate esmvaltool
154-
pre-commit run --all
155-
- run:
156-
name: Remove source code to test the installed software
157-
command: rm -r esmvaltool
158-
- test_and_report
159-
- save_cache:
160-
key: test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
161-
paths:
162-
- /root/.cache/pip
163-
- .pytest_cache
164-
- coverage-reporter/send_report:
165-
coverage-reports: 'test-reports/coverage.xml'
166-
project-token: $CODACY_PROJECT_TOKEN
167-
skip: true # skip if project-token is not defined (i.e. on a fork)
168-
169-
test_installation_from_source_test_mode:
170-
# Test installation from source
171-
docker:
172-
- image: condaforge/miniforge3:latest
173-
resource_class: large
174-
steps:
175-
- test_installation_from_source:
176-
extra: test
177-
178-
test_installation_from_source_develop_mode:
179-
# Test development installation
180-
docker:
181-
- image: condaforge/miniforge3:latest
182-
resource_class: large
183-
steps:
184-
- test_installation_from_source:
185-
extra: develop
186-
flags: "--editable"
187-
18852
test_upstream_development:
18953
# Test running recipes with the development version of ESMValCore. The
19054
# purpose of this test to discover backward-incompatible changes early on in
19155
# the development cycle.
19256
docker:
193-
- image: condaforge/miniforge3:latest
57+
- image: cimg/base:current
19458
resource_class: large
19559
steps:
196-
- run:
197-
name: Install git and ssh
198-
environment:
199-
DEBIAN_FRONTEND: noninteractive # needed to install tzdata
200-
command: apt update && apt install -y git ssh
20160
- checkout
20261
- run:
20362
name: Generate cache key
20463
command: echo $(date '+%Y')-$(expr $(date '+%V') / 2) | tee cache_key.txt
20564
- restore_cache:
20665
key: test-upstream-{{ .Branch }}-{{ checksum "cache_key.txt" }}
66+
- pixi/pixi_setup:
67+
env: esmvalcore-dev
20768
- run:
208-
name: Install
209-
no_output_timeout: 30m
69+
name: Run tests
21070
command: |
211-
# Install according to instructions on readthedocs with the
212-
# development version of ESMValTool and ESMValCore:
213-
# https://docs.esmvaltool.org/en/latest/quickstart/installation.html#install-from-source
214-
. /opt/conda/etc/profile.d/conda.sh
215-
mkdir /logs
216-
conda env create -n esmvaltool -f environment.yml --verbose
217-
conda activate esmvaltool
218-
mamba list >> /logs/conda.txt
219-
pip install --editable .[develop]
220-
# Install Julia from source and add to PATH
221-
curl -fsSL https://install.julialang.org | sh -s -- --yes
222-
export PATH=/root/.juliaup/bin:$PATH
223-
julia --version
224-
esmvaltool install Julia > /logs/install_julia.txt 2>&1
225-
git clone https://github.com/ESMValGroup/ESMValCore $HOME/ESMValCore
226-
pip install --editable $HOME/ESMValCore[develop]
227-
- log_versions
228-
- test_and_report
71+
pixi run --as-is --environment esmvalcore-dev test -n 4 --junitxml=test-reports/report.xml
72+
- store_test_results:
73+
path: test-reports/report.xml
22974
- run:
23075
name: Run recipes
23176
command: |
232-
. /opt/conda/etc/profile.d/conda.sh
233-
conda activate esmvaltool
234-
mkdir -p ~/climate_data
235-
esmvaltool config get_config_user
236-
echo "search_esgf: when_missing" >> ~/.config/esmvaltool/config-user.yml
237-
cat ~/.config/esmvaltool/config-user.yml
77+
source <(pixi shell-hook --as-is --environment esmvalcore-dev)
78+
# Temporarily install intake-esgf here until there is a new release
79+
# that includes https://github.com/esgf2-us/intake-esgf/pull/160.
80+
pip install git+https://github.com/esgf2-us/intake-esgf@main
81+
esmvaltool version
82+
esmvaltool config copy data-intake-esgf.yml
83+
python -c '
84+
import intake_esgf
85+
intake_esgf.conf["solr_indices"]["esgf.ceda.ac.uk"] = True
86+
intake_esgf.conf["solr_indices"]["esgf-data.dkrz.de"] = True
87+
intake_esgf.conf.save()
88+
'
23889
for recipe in esmvaltool/recipes/testing/recipe_*.yml; do
239-
esmvaltool run "$recipe"
90+
esmvaltool run --max-parallel-tasks=2 "$recipe"
24091
done
24192
- store_artifacts:
24293
path: /root/esmvaltool_output
24394
- save_cache:
24495
key: test-upstream-{{ .Branch }}-{{ checksum "cache_key.txt" }}
24596
paths:
246-
- /opt/conda/pkgs
247-
- /root/.cache/pip
24897
- /root/climate_data
24998

25099
build_documentation:
251100
# Test building documentation
252101
docker:
253-
- image: condaforge/miniforge3:latest
254-
resource_class: medium
102+
- image: cimg/base:current
103+
resource_class: medium+
255104
steps:
256105
- checkout
106+
- pixi/pixi_setup
257107
- run:
258-
command: |
259-
mkdir /logs
260-
. /opt/conda/etc/profile.d/conda.sh
261-
# Install
262-
conda env create -n esmvaltool -f environment_python.yml
263-
conda activate esmvaltool
264-
pip install .[doc]
265-
# Log versions
266-
dpkg -l > /logs/versions.txt
267-
conda env export > /logs/environment.yml
268-
pip freeze > /logs/requirements.txt
269-
# Test building documentation
270-
MPLBACKEND=Agg sphinx-build -W doc/sphinx/source doc/spinx/build
271-
- store_artifacts:
272-
path: /logs
108+
name: Build documentation
109+
command: pixi run --as-is doc --fail-on-warning --show-traceback
273110

274111
test_installation_from_conda:
275112
# Test conda package installation
@@ -284,15 +121,9 @@ jobs:
284121
# Install prerequisites
285122
mkdir /logs
286123
# Install ESMValTool in a new conda environment
287-
mamba create -y --name esmvaltool -c conda-forge esmvaltool julia 'python=3.11' >> /logs/conda.txt 2>&1
124+
mamba create -y --name esmvaltool -c conda-forge esmvaltool 'python=3.13' >> /logs/conda.txt 2>&1
288125
# Activate the environment
289126
set +x; conda activate esmvaltool; set -x
290-
# install Julia from source and add to PATH
291-
curl -fsSL https://install.julialang.org | sh -s -- --yes
292-
export PATH=/root/.juliaup/bin:$PATH
293-
julia --version
294-
# install the Julia dependencies
295-
esmvaltool install Julia > /logs/install_Julia.txt 2>&1
296127
# Log versions
297128
mamba env export > /logs/environment.yml
298129
# Test installation
@@ -306,9 +137,7 @@ jobs:
306137
workflows:
307138
commit:
308139
jobs:
309-
- run_tests
310-
- test_installation_from_source_test_mode
311-
- test_installation_from_source_develop_mode
140+
- tests
312141
nightly:
313142
triggers:
314143
- schedule:
@@ -318,9 +147,7 @@ workflows:
318147
only:
319148
- main
320149
jobs:
321-
- run_tests
322-
- test_installation_from_source_test_mode
323-
- test_installation_from_source_develop_mode
150+
- tests
324151
- test_upstream_development
325152
- build_documentation
326153
- test_installation_from_conda

.circleci/install_triggers

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

0 commit comments

Comments
 (0)