11---
22version : 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
24- 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 :
17+ name : Check dependencies are compatible
18+ command : pixi run --as-is pip check
19+ - run :
20+ name : Check code formatting and mistakes
21+ command : pixi run --as-is pre-commit run --all
3522 - run :
3623 name : Run tests
3724 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
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)
4230 esmvaltool version
4331 esmvaltool -- --help
4432 esmvaltool develop compare -- --help
45- ncl -V
46- cdo --version
4733 - store_test_results :
4834 path : test-reports/report.xml
49- - store_artifacts :
50- 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
5139 - run :
5240 name : Compress pytest artifacts
53- command : tar -cvzf pytest.tar.gz -C /tmp/pytest-of-root / .
41+ command : tar -cvzf pytest.tar.gz -C /tmp/pytest-of-$(whoami) / .
5442 when : always
5543 - store_artifacts :
5644 path : pytest.tar.gz
@@ -61,161 +49,43 @@ commands:
6149 - store_artifacts :
6250 path : test-reports.tar.gz
6351
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
118- docker :
119- - image : esmvalgroup/esmvaltool:development
120- resource_class : large
121- steps :
122- - checkout
123- - run :
124- name : Generate cache key
125- command : date '+%Y-%V' | tee cache_key.txt
126- - restore_cache :
127- key : test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
128- - 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
136- - run :
137- name : Check Python code style and mistakes
138- 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
150- - save_cache :
151- key : test-{{ .Branch }}-{{ checksum "cache_key.txt" }}
152- 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"
174-
17552 test_upstream_development :
17653 # Test running recipes with the development version of ESMValCore. The
17754 # purpose of this test to discover backward-incompatible changes early on in
17855 # the development cycle.
17956 docker :
180- - image : condaforge/miniforge3:latest
57+ - image : cimg/base:current
18158 resource_class : large
18259 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
18860 - checkout
18961 - run :
19062 name : Generate cache key
19163 command : echo $(date '+%Y')-$(expr $(date '+%V') / 2) | tee cache_key.txt
19264 - restore_cache :
19365 key : test-upstream-{{ .Branch }}-{{ checksum "cache_key.txt" }}
66+ - pixi/pixi_setup :
67+ env : esmvalcore-dev
19468 - run :
195- name : Install
196- no_output_timeout : 30m
69+ name : Run tests
19770 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- # Temporarily install intake-esgf here until it is an ESMValCore dependency in v2.14.
204- echo " - intake-esgf" >> environment.yml
205- conda env create -n esmvaltool -f environment.yml --verbose
206- conda activate esmvaltool
207- mamba list >> /logs/conda.txt
208- pip install --no-deps --editable .[develop]
209- git clone https://github.com/ESMValGroup/ESMValCore $HOME/ESMValCore
210- pip install --no-deps --editable $HOME/ESMValCore[develop]
211- - log_versions
212- - 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
21374 - run :
21475 name : Run recipes
21576 command : |
216- . /opt/conda/etc/profile.d/conda.sh
217- conda activate esmvaltool
218- esmvaltool config copy data-esmvalcore-esgf.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+ '
21989 for recipe in esmvaltool/recipes/testing/recipe_*.yml; do
22090 esmvaltool run --max-parallel-tasks=2 "$recipe"
22191 done
@@ -224,34 +94,19 @@ jobs:
22494 - save_cache :
22595 key : test-upstream-{{ .Branch }}-{{ checksum "cache_key.txt" }}
22696 paths :
227- - /opt/conda/pkgs
228- - /root/.cache/pip
22997 - /root/climate_data
23098
23199 build_documentation :
232100 # Test building documentation
233101 docker :
234- - image : condaforge/miniforge3:latest
102+ - image : cimg/base:current
235103 resource_class : medium+
236104 steps :
237105 - checkout
106+ - pixi/pixi_setup
238107 - run :
239- command : |
240- mkdir /logs
241- . /opt/conda/etc/profile.d/conda.sh
242- # Install
243- conda env create -n esmvaltool -f environment_python.yml
244- conda activate esmvaltool
245- pip install --no-deps .[doc]
246- pip check
247- # Log versions
248- dpkg -l > /logs/versions.txt
249- conda env export > /logs/environment.yml
250- pip freeze > /logs/requirements.txt
251- # Test building documentation
252- MPLBACKEND=Agg sphinx-build -W doc/sphinx/source doc/spinx/build
253- - store_artifacts :
254- path : /logs
108+ name : Build documentation
109+ command : pixi run --as-is doc --fail-on-warning --show-traceback
255110
256111 test_installation_from_conda :
257112 # Test conda package installation
@@ -266,7 +121,7 @@ jobs:
266121 # Install prerequisites
267122 mkdir /logs
268123 # Install ESMValTool in a new conda environment
269- mamba create -y --name esmvaltool -c conda-forge esmvaltool 'python=3.12 ' >> /logs/conda.txt 2>&1
124+ mamba create -y --name esmvaltool -c conda-forge esmvaltool 'python=3.13 ' >> /logs/conda.txt 2>&1
270125 # Activate the environment
271126 set +x; conda activate esmvaltool; set -x
272127 # Log versions
@@ -282,9 +137,7 @@ jobs:
282137workflows :
283138 commit :
284139 jobs :
285- - run_tests
286- - test_installation_from_source_test_mode
287- - test_installation_from_source_develop_mode
140+ - tests
288141 nightly :
289142 triggers :
290143 - schedule :
@@ -294,9 +147,7 @@ workflows:
294147 only :
295148 - main
296149 jobs :
297- - run_tests
298- - test_installation_from_source_test_mode
299- - test_installation_from_source_develop_mode
150+ - tests
300151 - test_upstream_development
301152 - build_documentation
302153 - test_installation_from_conda
0 commit comments