Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,23 @@ jobs:
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
-
name: Create Environment with Mamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v3
with:
environment-name: climada_env_${{ matrix.python-version }}
environment-file: requirements/env_climada.yml
environment-name: climada_env
environment-file: requirements/base.yml
create-args: >-
python=${{ matrix.python-version }}
make
# Persist environment for branch, Python version, single day
cache-environment-key: env-${{ github.ref }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }}
cache-environment-key: env-${{ github.ref }}-${{ steps.date.outputs.date }}
-
name: Install CLIMADA
name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: ${{ matrix.python-version }}
-
name: Install dependencies
run: |
python -m pip install "./[dev]"
uv sync --locked --dev
-
name: Run Unit Tests
run: |
Expand Down
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,14 @@ repos:
rev: '24.4.2'
hooks:
- id: black-jupyter

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.11.7
hooks:
- id: uv-lock
- id: uv-export
args: [
--frozen, --no-hashes, --quiet, --group=doc,
--output-file=doc/requirements.txt
]
files: (^uv\.lock|doc/requirements\.txt$)
18 changes: 3 additions & 15 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,12 @@ sphinx:
configuration: doc/conf.py

build:
os: "ubuntu-22.04"
os: "ubuntu-26.04"
tools:
python: "mambaforge-4.10"

# Append fixed Python version to requirements
jobs:
pre_create_environment:
- echo " - python=3.11" >> requirements/env_climada.yml
python: "miniforge3-25.11"

conda:
environment: requirements/env_climada.yml

python:
install:
- method: pip
path: .
extra_requirements:
- doc
environment: env-docs.yml

formats:
- pdf
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# test, coverage and lint
###

PRE_CMD = uv run --

PYTEST_JUNIT_ARGS = --junitxml=tests_xml/tests.xml

PYTEST_COV_ARGS = \
Expand All @@ -16,32 +18,32 @@ help: ## Use one of the following instructions:

.PHONY : lint
lint : ## Static code analysis with Pylint
pylint -ry climada > pylint.log || true
$(PRE_CMD) pylint -ry climada > pylint.log || true

.PHONY : unit_test
unit_test : ## Unit tests execution with coverage and xml reports
pytest $(PYTEST_ARGS) --ignore=climada/test climada/
$(PRE_CMD) pytest $(PYTEST_ARGS) --ignore=climada/test climada/

.PHONY : install_test
install_test : ## Test installation was successful
pytest $(PYTEST_JUNIT_ARGS) --pyargs climada.engine.test.test_cost_benefit \
$(PRE_CMD) pytest $(PYTEST_JUNIT_ARGS) --pyargs climada.engine.test.test_cost_benefit \
climada.engine.test.test_impact

.PHONY : data_test
data_test : ## Test data APIs
pytest $(PYTEST_JUNIT_ARGS) script/jenkins/test_data_api.py
$(PRE_CMD) pytest $(PYTEST_JUNIT_ARGS) script/jenkins/test_data_api.py

.PHONY : notebook_test
notebook_test : ## Test notebooks in doc/tutorial
pytest $(PYTEST_JUNIT_ARGS) script/jenkins/test_notebooks.py
$(PRE_CMD) pytest $(PYTEST_JUNIT_ARGS) script/jenkins/test_notebooks.py

.PHONY : integ_test
integ_test : ## Integration tests execution with xml reports
pytest $(PYTEST_ARGS) climada/test/
$(PRE_CMD) pytest $(PYTEST_ARGS) climada/test/

.PHONY : test
test : ## Unit and integration tests execution with coverage and xml reports
pytest $(PYTEST_ARGS) climada/
$(PRE_CMD) pytest $(PYTEST_ARGS) climada/

.PHONY : ci-clean
ci-clean :
Expand Down
Loading
Loading