Skip to content

Commit 7d320a6

Browse files
authored
Merge branch 'main' into 4GST_for_CMUG
2 parents d89c052 + 13f6361 commit 7d320a6

104 files changed

Lines changed: 40803 additions & 2943 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: 76 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,49 @@
11
---
22
version: 2.1
33

4-
commands:
5-
check_changes:
6-
steps:
7-
- run:
8-
name: Check whether or not installation tests are needed
9-
command: |
10-
if (test "$CIRCLE_BRANCH" = main ||
11-
git --no-pager diff --name-only origin/main... |
12-
grep -q -E -f .circleci/install_triggers)
13-
then
14-
echo Running installation tests
15-
else
16-
echo Skipping installation tests
17-
circleci step halt
18-
fi
4+
orbs:
5+
pixi: prefix-dev/pixi@0.1.0
196

20-
log_versions:
7+
jobs:
8+
tests:
9+
# Run tests
10+
docker:
11+
- image: cimg/base:current
12+
resource_class: large
2113
steps:
14+
- checkout
15+
- pixi/pixi_setup
2216
- run:
23-
name: Log versions
17+
name: Check dependencies are compatible and installed
2418
command: |
25-
. /opt/conda/etc/profile.d/conda.sh
26-
conda env export --name base > /logs/base_environment.yml
27-
conda activate esmvaltool
28-
esmvaltool version
29-
dpkg -l > /logs/versions.txt
30-
conda env export > /logs/environment.yml
31-
pip freeze > /logs/requirements.txt
32-
33-
test_and_report:
34-
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]
24+
- run:
25+
name: Check code formatting and mistakes
26+
command: pixi run --as-is pre-commit run --all
3527
- run:
3628
name: Run tests
3729
command: |
38-
. /opt/conda/etc/profile.d/conda.sh
39-
conda activate esmvaltool
40-
pip check
41-
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)
4235
esmvaltool version
4336
esmvaltool -- --help
4437
esmvaltool develop compare -- --help
45-
ncl -V
46-
cdo --version
4738
- store_test_results:
4839
path: test-reports/report.xml
49-
- store_artifacts:
50-
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
5144
- run:
5245
name: Compress pytest artifacts
53-
command: tar -cvzf pytest.tar.gz -C /tmp/pytest-of-root/ .
46+
command: tar -cvzf pytest.tar.gz -C /tmp/pytest-of-$(whoami)/ .
5447
when: always
5548
- store_artifacts:
5649
path: pytest.tar.gz
@@ -61,161 +54,72 @@ commands:
6154
- store_artifacts:
6255
path: test-reports.tar.gz
6356

64-
test_installation_from_source:
65-
parameters:
66-
extra:
67-
type: string
68-
flags:
69-
type: string
70-
default: ""
71-
steps:
72-
- run:
73-
name: Install git+ssh
74-
environment:
75-
DEBIAN_FRONTEND: noninteractive # needed to install tzdata
76-
command: apt update && apt install -y git ssh
77-
- checkout
78-
- check_changes
79-
- run:
80-
name: Generate cache key
81-
command: date '+%Y-%V' | tee cache_key.txt
82-
- restore_cache:
83-
key: install-<< parameters.extra >>-{{ .Branch }}-{{ checksum "cache_key.txt" }}
84-
- run:
85-
name: Install dependencies
86-
no_output_timeout: 30m
87-
command: |
88-
# Install
89-
. /opt/conda/etc/profile.d/conda.sh
90-
mkdir /logs
91-
mamba --version
92-
conda env create -n esmvaltool -f environment.yml --verbose
93-
conda activate esmvaltool
94-
mamba list >> /logs/conda.txt
95-
pip install --no-deps << parameters.flags >> ".[<<parameters.extra>>]"> /logs/install.txt 2>&1
96-
if [[ "<<parameters.flags>>" != *'--editable'* ]]
97-
then
98-
rm -r esmvaltool
99-
fi
100-
- log_versions
101-
- run:
102-
name: Lint source code
103-
command: |
104-
. /opt/conda/etc/profile.d/conda.sh
105-
conda activate esmvaltool
106-
pre-commit run --all
107-
- test_and_report
108-
- save_cache:
109-
key: install-<< parameters.extra >>-{{ .Branch }}-{{ checksum "cache_key.txt" }}
110-
paths:
111-
- /opt/conda/pkgs
112-
- /root/.cache/pip
113-
- .pytest_cache
114-
115-
jobs:
116-
run_tests:
117-
# Run tests
57+
test_esmvaltool_base_installation:
58+
# Test running the example recipe with minimal dependencies.
11859
docker:
119-
- image: esmvalgroup/esmvaltool:development
120-
resource_class: large
60+
- image: cimg/base:current
61+
resource_class: medium
12162
steps:
12263
- checkout
12364
- run:
12465
name: Generate cache key
125-
command: date '+%Y-%V' | tee cache_key.txt
66+
# Refresh the cache every month.
67+
command: echo $(date '+%Y-%m') | tee cache_key.txt
12668
- restore_cache:
127-
key: test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
69+
key: test-base-{{ .Branch }}-{{ checksum "cache_key.txt" }}
70+
- pixi/pixi_setup:
71+
env: esmvaltool-base
12872
- run:
129-
name: Install dependencies
130-
command: |
131-
set -x
132-
. /opt/conda/etc/profile.d/conda.sh
133-
conda activate esmvaltool
134-
mkdir /logs
135-
pip install --no-deps .[test] > /logs/install.txt 2>&1
73+
name: Check dependencies are compatible
74+
command: pixi run --as-is --environment esmvaltool-base pip check
13675
- run:
137-
name: Check Python code style and mistakes
76+
name: Run example recipe
13877
command: |
139-
. /opt/conda/etc/profile.d/conda.sh
140-
conda activate esmvaltool
141-
pre-commit run --all
142-
- run:
143-
name: Remove source code to test the installed software
144-
command: rm -r esmvaltool
145-
- test_and_report
146-
- run:
147-
# Documentation available at https://docs.codacy.com/coverage-reporter/
148-
name: Upload coverage report to Codacy
149-
command: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -s -r test-reports/coverage.xml
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
15090
- save_cache:
151-
key: test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
91+
key: test-base-{{ .Branch }}-{{ checksum "cache_key.txt" }}
15292
paths:
153-
- /root/.cache/pip
154-
- .pytest_cache
155-
156-
test_installation_from_source_test_mode:
157-
# Test installation from source
158-
docker:
159-
- image: condaforge/miniforge3:latest
160-
resource_class: large
161-
steps:
162-
- test_installation_from_source:
163-
extra: test
164-
165-
test_installation_from_source_develop_mode:
166-
# Test development installation
167-
docker:
168-
- image: condaforge/miniforge3:latest
169-
resource_class: large
170-
steps:
171-
- test_installation_from_source:
172-
extra: develop
173-
flags: "--editable"
93+
- /root/climate_data
17494

17595
test_upstream_development:
17696
# Test running recipes with the development version of ESMValCore. The
17797
# purpose of this test to discover backward-incompatible changes early on in
17898
# the development cycle.
17999
docker:
180-
- image: condaforge/miniforge3:latest
181-
resource_class: large
100+
- image: cimg/base:current
101+
resource_class: medium
182102
steps:
183-
- run:
184-
name: Install git and ssh
185-
environment:
186-
DEBIAN_FRONTEND: noninteractive # needed to install tzdata
187-
command: apt update && apt install -y git ssh
188103
- checkout
189104
- run:
190105
name: Generate cache key
191-
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
192108
- restore_cache:
193109
key: test-upstream-{{ .Branch }}-{{ checksum "cache_key.txt" }}
110+
- pixi/pixi_setup:
111+
env: esmvalcore-dev
194112
- run:
195-
name: Install
196-
no_output_timeout: 30m
113+
name: Run tests
197114
command: |
198-
# Install according to instructions on readthedocs with the
199-
# development version of ESMValTool and ESMValCore:
200-
# https://docs.esmvaltool.org/en/latest/quickstart/installation.html#install-from-source
201-
. /opt/conda/etc/profile.d/conda.sh
202-
mkdir /logs
203-
conda env create -n esmvaltool -f environment.yml --verbose
204-
conda activate esmvaltool
205-
# Temporarily install intake-esgf here until there is a new release
206-
# that includes https://github.com/esgf2-us/intake-esgf/pull/160.
207-
pip install git+https://github.com/esgf2-us/intake-esgf@main
208-
mamba list >> /logs/conda.txt
209-
pip install --no-deps --editable .[develop]
210-
git clone https://github.com/ESMValGroup/ESMValCore $HOME/ESMValCore
211-
pip install --no-deps --editable $HOME/ESMValCore[develop]
212-
- log_versions
213-
- 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
214118
- run:
215119
name: Run recipes
216120
command: |
217-
. /opt/conda/etc/profile.d/conda.sh
218-
conda activate esmvaltool
121+
source <(pixi shell-hook --as-is --environment esmvalcore-dev)
122+
esmvaltool version
219123
esmvaltool config copy data-intake-esgf.yml
220124
python -c '
221125
import intake_esgf
@@ -231,34 +135,19 @@ jobs:
231135
- save_cache:
232136
key: test-upstream-{{ .Branch }}-{{ checksum "cache_key.txt" }}
233137
paths:
234-
- /opt/conda/pkgs
235-
- /root/.cache/pip
236138
- /root/climate_data
237139

238140
build_documentation:
239141
# Test building documentation
240142
docker:
241-
- image: condaforge/miniforge3:latest
242-
resource_class: medium+
143+
- image: cimg/base:current
144+
resource_class: medium
243145
steps:
244146
- checkout
147+
- pixi/pixi_setup
245148
- run:
246-
command: |
247-
mkdir /logs
248-
. /opt/conda/etc/profile.d/conda.sh
249-
# Install
250-
conda env create -n esmvaltool -f environment_python.yml
251-
conda activate esmvaltool
252-
pip install --no-deps .[doc]
253-
pip check
254-
# Log versions
255-
dpkg -l > /logs/versions.txt
256-
conda env export > /logs/environment.yml
257-
pip freeze > /logs/requirements.txt
258-
# Test building documentation
259-
MPLBACKEND=Agg sphinx-build -W doc/sphinx/source doc/spinx/build
260-
- store_artifacts:
261-
path: /logs
149+
name: Build documentation
150+
command: pixi run --as-is doc --fail-on-warning --show-traceback
262151

263152
test_installation_from_conda:
264153
# Test conda package installation
@@ -273,7 +162,7 @@ jobs:
273162
# Install prerequisites
274163
mkdir /logs
275164
# Install ESMValTool in a new conda environment
276-
mamba create -y --name esmvaltool -c conda-forge esmvaltool 'python=3.12' >> /logs/conda.txt 2>&1
165+
mamba create -y --name esmvaltool -c conda-forge esmvaltool 'python=3.13' >> /logs/conda.txt 2>&1
277166
# Activate the environment
278167
set +x; conda activate esmvaltool; set -x
279168
# Log versions
@@ -289,9 +178,7 @@ jobs:
289178
workflows:
290179
commit:
291180
jobs:
292-
- run_tests
293-
- test_installation_from_source_test_mode
294-
- test_installation_from_source_develop_mode
181+
- tests
295182
nightly:
296183
triggers:
297184
- schedule:
@@ -301,9 +188,8 @@ workflows:
301188
only:
302189
- main
303190
jobs:
304-
- run_tests
305-
- test_installation_from_source_test_mode
306-
- test_installation_from_source_develop_mode
191+
- tests
192+
- test_esmvaltool_base_installation
307193
- test_upstream_development
308194
- build_documentation
309195
- test_installation_from_conda

.circleci/install_triggers

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

.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/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ updates:
1212
directory: "/"
1313
schedule:
1414
interval: "weekly"
15+
cooldown:
16+
default-days: 7
1517
labels:
1618
- dependencies
1719
- github_actions

0 commit comments

Comments
 (0)