22version : 2.1
33
44orbs :
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
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 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 :
25+ name : Check code formatting and mistakes
26+ command : pixi run --as-is pre-commit run --all
3927 - run :
4028 name : Run tests
4129 command : |
42- . /opt/conda/etc/profile.d/conda.sh
43- conda activate esmvaltool
44- mamba --version
45- 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)
4635 esmvaltool version
4736 esmvaltool -- --help
48- ncl -V
49- cdo --version
37+ esmvaltool develop compare -- --help
5038 - store_test_results :
5139 path : test-reports/report.xml
52- - store_artifacts :
53- 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
5444 - run :
5545 name : Compress pytest artifacts
56- command : tar -cvzf pytest.tar.gz -C /tmp/pytest-of-root / .
46+ command : tar -cvzf pytest.tar.gz -C /tmp/pytest-of-$(whoami) / .
5747 when : always
5848 - store_artifacts :
5949 path : pytest.tar.gz
@@ -64,200 +54,100 @@ commands:
6454 - store_artifacts :
6555 path : test-reports.tar.gz
6656
67- test_installation_from_source :
68- parameters :
69- extra :
70- type : string
71- flags :
72- type : string
73- default : " "
74- steps :
75- - run :
76- name : Install git+ssh
77- environment :
78- DEBIAN_FRONTEND : noninteractive # needed to install tzdata
79- command : apt update && apt install -y git ssh
80- - checkout
81- - check_changes
82- - run :
83- name : Generate cache key
84- command : date '+%Y-%V' | tee cache_key.txt
85- - restore_cache :
86- key : install-<< parameters.extra >>-{{ .Branch }}-{{ checksum "cache_key.txt" }}
87- - run :
88- name : Install dependencies
89- no_output_timeout : 30m
90- command : |
91- # Install
92- . /opt/conda/etc/profile.d/conda.sh
93- mkdir /logs
94- mamba --version
95- conda env create -n esmvaltool -f environment.yml --verbose
96- conda activate esmvaltool
97- mamba list >> /logs/conda.txt
98- pip install << parameters.flags >> ".[<<parameters.extra>>]"> /logs/install.txt 2>&1
99- esmvaltool install Julia > /logs/install_julia.txt 2>&1
100- if [[ "<<parameters.flags>>" != *'--editable'* ]]
101- then
102- rm -r esmvaltool
103- fi
104- - log_versions
105- - run :
106- name : Lint source code
107- command : |
108- . /opt/conda/etc/profile.d/conda.sh
109- conda activate esmvaltool
110- pre-commit run --all
111- - test_and_report
112- - save_cache :
113- key : install-<< parameters.extra >>-{{ .Branch }}-{{ checksum "cache_key.txt" }}
114- paths :
115- - /opt/conda/pkgs
116- - /root/.cache/pip
117- - .pytest_cache
118-
119- jobs :
120- run_tests :
121- # Run tests
57+ test_esmvaltool_base_installation :
58+ # Test running the example recipe with minimal dependencies.
12259 docker :
123- - image : esmvalgroup/esmvaltool:development
124- resource_class : large
60+ - image : cimg/base:current
61+ resource_class : medium
12562 steps :
12663 - checkout
12764 - run :
12865 name : Generate cache key
129- command : date '+%Y-%V' | tee cache_key.txt
66+ # Refresh the cache every month.
67+ command : echo $(date '+%Y-%m') | tee cache_key.txt
13068 - restore_cache :
131- key : test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
69+ key : test-base-{{ .Branch }}-{{ checksum "cache_key.txt" }}
70+ - pixi/pixi_setup :
71+ env : esmvaltool-base
13272 - run :
133- name : Install dependencies
134- command : |
135- set -x
136- . /opt/conda/etc/profile.d/conda.sh
137- conda activate esmvaltool
138- mkdir /logs
139- pip install .[test] > /logs/install.txt 2>&1
140- esmvaltool install Julia > /logs/install_julia.txt 2>&1
73+ name : Check dependencies are compatible
74+ command : pixi run --as-is --environment esmvaltool-base pip check
14175 - run :
142- name : Check Python code style and mistakes
76+ name : Run example recipe
14377 command : |
144- . /opt/conda/etc/profile.d/conda.sh
145- conda activate esmvaltool
146- pre-commit run --all
147- - run :
148- name : Remove source code to test the installed software
149- command : rm -r esmvaltool
150- - 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
15190 - save_cache :
152- key : test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
91+ key : test-base- {{ .Branch }}-{{ checksum "cache_key.txt" }}
15392 paths :
154- - /root/.cache/pip
155- - .pytest_cache
156- - coverage-reporter/send_report :
157- coverage-reports : ' test-reports/coverage.xml'
158- project-token : $CODACY_PROJECT_TOKEN
159- skip : true # skip if project-token is not defined (i.e. on a fork)
160-
161- test_installation_from_source_test_mode :
162- # Test installation from source
163- docker :
164- - image : condaforge/miniforge3:latest
165- resource_class : large
166- steps :
167- - test_installation_from_source :
168- extra : test
169-
170- test_installation_from_source_develop_mode :
171- # Test development installation
172- docker :
173- - image : condaforge/miniforge3:latest
174- resource_class : large
175- steps :
176- - test_installation_from_source :
177- extra : develop
178- flags : " --editable"
93+ - /root/climate_data
17994
18095 test_upstream_development :
18196 # Test running recipes with the development version of ESMValCore. The
18297 # purpose of this test to discover backward-incompatible changes early on in
18398 # the development cycle.
18499 docker :
185- - image : condaforge/miniforge3:latest
186- resource_class : large
100+ - image : cimg/base:current
101+ resource_class : medium
187102 steps :
188- - run :
189- name : Install git and ssh
190- environment :
191- DEBIAN_FRONTEND : noninteractive # needed to install tzdata
192- command : apt update && apt install -y git ssh
193103 - checkout
194104 - run :
195105 name : Generate cache key
196- 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
197108 - restore_cache :
198109 key : test-upstream-{{ .Branch }}-{{ checksum "cache_key.txt" }}
110+ - pixi/pixi_setup :
111+ env : esmvalcore-dev
199112 - run :
200- name : Install
201- no_output_timeout : 30m
113+ name : Run tests
202114 command : |
203- # Install according to instructions on readthedocs with the
204- # development version of ESMValTool and ESMValCore:
205- # https://docs.esmvaltool.org/en/latest/quickstart/installation.html#install-from-source
206- . /opt/conda/etc/profile.d/conda.sh
207- mkdir /logs
208- conda env create -n esmvaltool -f environment.yml --verbose
209- conda activate esmvaltool
210- mamba list >> /logs/conda.txt
211- pip install --editable .[develop]
212- esmvaltool install Julia > /logs/install_julia.txt 2>&1
213- git clone https://github.com/ESMValGroup/ESMValCore $HOME/ESMValCore
214- pip install --editable $HOME/ESMValCore[develop]
215- - log_versions
216- - 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
217118 - run :
218119 name : Run recipes
219120 command : |
220- . /opt/conda/etc/profile.d/conda.sh
221- conda activate esmvaltool
222- mkdir -p ~/climate_data
223- esmvaltool config get_config_user
224- echo "search_esgf: when_missing" >> ~/.config/esmvaltool/config-user.yml
225- cat ~/.config/esmvaltool/config-user.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+ '
226130 for recipe in esmvaltool/recipes/testing/recipe_*.yml; do
227- esmvaltool run "$recipe"
131+ esmvaltool run --max-parallel-tasks=2 "$recipe"
228132 done
229133 - store_artifacts :
230134 path : /root/esmvaltool_output
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
143+ - image : cimg/base:current
242144 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 .[doc]
253- # Log versions
254- dpkg -l > /logs/versions.txt
255- conda env export > /logs/environment.yml
256- pip freeze > /logs/requirements.txt
257- # Test building documentation
258- MPLBACKEND=Agg sphinx-build -W doc/sphinx/source doc/spinx/build
259- - store_artifacts :
260- path : /logs
149+ name : Build documentation
150+ command : pixi run --as-is doc --fail-on-warning --show-traceback
261151
262152 test_installation_from_conda :
263153 # Test conda package installation
@@ -272,11 +162,9 @@ jobs:
272162 # Install prerequisites
273163 mkdir /logs
274164 # Install ESMValTool in a new conda environment
275- mamba create -y --name esmvaltool -c conda-forge esmvaltool julia 'python=3.11 ' >> /logs/conda.txt 2>&1
165+ mamba create -y --name esmvaltool -c conda-forge esmvaltool 'python=3.13 ' >> /logs/conda.txt 2>&1
276166 # Activate the environment
277167 set +x; conda activate esmvaltool; set -x
278- # install the Julia dependencies
279- esmvaltool install Julia > /logs/install_Julia.txt 2>&1
280168 # Log versions
281169 mamba env export > /logs/environment.yml
282170 # Test installation
@@ -290,9 +178,7 @@ jobs:
290178workflows :
291179 commit :
292180 jobs :
293- - run_tests
294- - test_installation_from_source_test_mode
295- - test_installation_from_source_develop_mode
181+ - tests
296182 nightly :
297183 triggers :
298184 - schedule :
@@ -302,9 +188,8 @@ workflows:
302188 only :
303189 - main
304190 jobs :
305- - run_tests
306- - test_installation_from_source_test_mode
307- - test_installation_from_source_develop_mode
191+ - tests
192+ - test_esmvaltool_base_installation
308193 - test_upstream_development
309194 - build_documentation
310195 - test_installation_from_conda
0 commit comments