Skip to content
Merged
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
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ jobs:
- name: Set up Helm
uses: azure/setup-helm@v4.3.1

- name: Build chart dependencies
run: helm dependency build helm/

- name: Lint chart
run: helm lint helm/

Expand All @@ -85,7 +88,13 @@ jobs:
run: uv sync --all-extras

- name: Fetch test data
run: uv run ref datasets fetch-sample-data
run: |
mkdir -p "$REF_TEST_DATA_DIR"
uv run ref datasets fetch-sample-data
env:
REF_TEST_DATA_DIR: ${{ runner.temp }}/test-data

- name: Run integration tests
run: uv run pytest tests/ -v --slow
env:
REF_TEST_DATA_DIR: ${{ runner.temp }}/test-data
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ This project uses [Calendar Versioning](https://calver.org/) with the format `YY

## [2026.02] - Unreleased

### Fixed

- Add package stub so hatchling can build the project wheel
- Add `helm dependency build` step in CI before linting
- Fix trailing YAML document separators in Helm provider templates
- Fix import sorting in test files

### Added

- Initial AFT repository scaffolding
Expand Down
8 changes: 4 additions & 4 deletions helm/templates/providers/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{- range $provider, $spec := (omit .Values.providers "defaults") -}}
{{- range $provider, $spec := (omit .Values.providers "defaults") }}
{{- $spec := merge (deepCopy $.Values.defaults) $spec -}}
{{- $args := list "celery" "start-worker" "--loglevel" "DEBUG" -}}
{{- if ne $provider "orchestrator" -}} {{- $args = concat $args (list "--provider" $provider) -}} {{- end -}}
{{- if ne $provider "orchestrator" -}} {{- $args = concat $args (list "--provider" $provider) -}} {{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -81,5 +82,4 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
---
{{ end -}}
{{- end }}
4 changes: 2 additions & 2 deletions helm/templates/providers/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{- range $provider, $spec := (omit .Values.providers "defaults") -}}
{{- range $provider, $spec := (omit .Values.providers "defaults") }}
{{- $spec := merge (deepCopy $.Values.defaults) $spec -}}
{{- if and $spec.autoscaling $spec.autoscaling.enabled }}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
Expand Down Expand Up @@ -28,5 +29,4 @@ spec:
type: Value
value: "50" # Scale up if queue length exceeds 50
{{- end }}
---
{{- end }}
6 changes: 3 additions & 3 deletions helm/templates/providers/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- range $name, $size := .Values.createPVCs -}}
{{- range $name, $size := .Values.createPVCs }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -11,5 +12,4 @@ spec:
resources:
requests:
storage: {{ $size }}
---
{{ end -}}
{{- end }}
6 changes: 3 additions & 3 deletions helm/templates/providers/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- range $provider, $spec := (omit .Values.providers "defaults") -}}
{{- $spec := merge (deepCopy $.Values.defaults) $spec -}}
{{- range $provider, $spec := (omit .Values.providers "defaults") }}
{{- $spec := merge (deepCopy $.Values.defaults) $spec }}
---
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -9,5 +10,4 @@ metadata:
{{- include "ref.labels" $ | nindent 4 }}
stringData:
{{- tpl (toYaml $spec.env) $ | nindent 2}}
---
{{- end }}
6 changes: 3 additions & 3 deletions helm/templates/providers/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{- range $provider, $spec := (omit .Values.providers "defaults") -}}
{{- range $provider, $spec := (omit .Values.providers "defaults") }}
{{- $spec := merge (deepCopy $.Values.defaults) $spec -}}
{{- if and $spec.serviceAccount $spec.serviceAccount.create -}}
{{- if and $spec.serviceAccount $spec.serviceAccount.create }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
Expand All @@ -14,5 +15,4 @@ metadata:
{{- end }}
automountServiceAccountToken: {{ $spec.serviceAccount.automount }}
{{- end }}
---
{{- end }}
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ dev = [
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/climate_ref_aft"]

[tool.ruff]
line-length = 110

Expand Down
1 change: 1 addition & 0 deletions src/climate_ref_aft/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# CMIP7 Assessment Fast Track - deployment configuration and integration tests
46 changes: 45 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,53 @@

from __future__ import annotations

import pytest
from collections.abc import Callable

import pytest
from click.testing import Result
from climate_ref import cli
from climate_ref.config import DiagnosticProviderConfig
from climate_ref_core.logging import remove_log_handler
from loguru import logger
from typer.testing import CliRunner


@pytest.fixture
def invoke_cli(monkeypatch: pytest.MonkeyPatch) -> Callable[..., Result]:
"""
Override upstream invoke_cli to drop mix_stderr (removed in typer 0.21+).

This can be removed once climate-ref fixes the upstream conftest_plugin.
"""
runner = CliRunner()

def _invoke_cli(args: list[str], expected_exit_code: int = 0, always_log: bool = False) -> Result:
monkeypatch.setenv("NO_COLOR", "1")
monkeypatch.setenv("COLUMNS", "200")

result = runner.invoke(app=cli.app, args=args)

if hasattr(logger, "default_handler_id"):
remove_log_handler()

stderr = getattr(result, "stderr", "")

if always_log or result.exit_code != expected_exit_code:
print("## Command: ", " ".join(args))
print("Exit code: ", result.exit_code)
print("Command stdout")
print(result.stdout)
print("Command stderr")
print(stderr)
print("## Command end")

if result.exit_code != expected_exit_code:
if result.exception:
raise result.exception
raise ValueError(f"Expected exit code {expected_exit_code}, got {result.exit_code}")
return result

return _invoke_cli


@pytest.fixture
Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_cmip7_aft.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import pandas as pd
import pytest

from climate_ref.database import Database
from climate_ref.models import ExecutionGroup

Expand Down
Loading