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
18 changes: 0 additions & 18 deletions .cruft.json

This file was deleted.

6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
190 changes: 55 additions & 135 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,174 +22,94 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.0

combine-environments:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install conda-merge
run: |
python -m pip install conda-merge
- name: Combine environments
run: |
for SUFFIX in ci integration; do
conda-merge ci/environment-$SUFFIX.yml environment.yml > ci/combined-environment-$SUFFIX.yml || exit
done
- uses: actions/upload-artifact@v4
with:
name: combined-environments
path: ci/combined-environment-*.yml
- uses: pre-commit/action@v3.0.1

unit-tests:
name: unit-tests
needs: combine-environments
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
python-version:
- '3.11'
- '3.12'
- '3.13'
- '3.14'

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: actions/checkout@v7
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v7
with:
name: combined-environments
path: ci
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/combined-environment-ci.yml
environment-name: DEVELOP
cache-environment: true
cache-environment-key: environment-${{ steps.date.outputs.date }}
cache-downloads-key: downloads-${{ steps.date.outputs.date }}
create-args: >-
python=${{ matrix.python-version }}
- name: Install package
run: |
python -m pip install --no-deps -e .
- name: Run tests
run: |
make unit-tests COV_REPORT=xml
version: '0.11.17'
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Run unit tests
run: make unit-tests COV_REPORT=xml

type-check:
needs: [combine-environments, unit-tests]
check-typing:
needs: [unit-tests]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: actions/checkout@v7
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v7
with:
name: combined-environments
path: ci
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/combined-environment-ci.yml
environment-name: DEVELOP
cache-environment: true
cache-environment-key: environment-${{ steps.date.outputs.date }}
cache-downloads-key: downloads-${{ steps.date.outputs.date }}
create-args: >-
python=3.11
- name: Install package
run: |
python -m pip install --no-deps -e .
- name: Run code quality checks
run: |
make type-check
version: '0.11.17'
enable-cache: true
python-version: '3.14'
- name: Run type checks
run: make check-typing

docs-build:
needs: [combine-environments, unit-tests]
needs: [unit-tests]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: combined-environments
path: ci
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- uses: mamba-org/setup-micromamba@v1
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
environment-file: ci/combined-environment-ci.yml
environment-name: DEVELOP
cache-environment: true
cache-environment-key: environment-${{ steps.date.outputs.date }}
cache-downloads-key: downloads-${{ steps.date.outputs.date }}
create-args: >-
python=3.11
- name: Install package
run: |
python -m pip install --no-deps -e .
version: '0.11.17'
enable-cache: true
python-version: '3.14'
- name: Build documentation
run: |
make docs-build
run: make docs-build

integration-tests:
needs: [combine-environments, unit-tests]
if: |
success() && true
minver-tests:
needs: [unit-tests]
runs-on: ubuntu-latest

strategy:
matrix:
include:
- python-version: '3.11'
extra: -integration

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: combined-environments
path: ci
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- uses: mamba-org/setup-micromamba@v1
- uses: actions/checkout@v7

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v7
with:
environment-file: ci/combined-environment${{ matrix.extra }}.yml
environment-name: DEVELOP${{ matrix.extra }}
cache-environment: true
cache-environment-key: environment-${{ steps.date.outputs.date }}
cache-downloads-key: downloads-${{ steps.date.outputs.date }}
create-args: >-
python=${{ matrix.python-version }}
- name: Install package
run: |
python -m pip install --no-deps -e .
version: '0.11.17'
enable-cache: true
python-version: '3.14'

- name: Run tests
run: |
make unit-tests COV_REPORT=xml
run: make minver-tests

distribution:
runs-on: ubuntu-latest
needs: [unit-tests, type-check, docs-build, integration-tests]
needs: [unit-tests, check-typing, docs-build]
if: |
always() &&
needs.unit-tests.result == 'success' &&
needs.type-check.result == 'success' &&
needs.docs-build.result == 'success' &&
(needs.integration-tests.result == 'success' || needs.integration-tests.result == 'skipped')
needs.check-typing.result == 'success' &&
needs.docs-build.result == 'success'

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.11'
- name: Install package
Expand All @@ -206,7 +126,7 @@ jobs:
python -m twine check --strict * || exit
python -c "import xarray_ecmwf" || exit
cd ..
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: distribution
path: dist
Expand All @@ -215,7 +135,7 @@ jobs:
runs-on: ubuntu-latest
needs: distribution
if: |
always() &&
always() && true &&
needs.distribution.result == 'success' &&
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags')
Expand All @@ -226,10 +146,10 @@ jobs:
id-token: write # IMPORTANT: this permission is mandatory for trusted publish

steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
name: distribution
path: dist
- uses: pypa/gh-action-pypi-publish@v1.8.11
- uses: pypa/gh-action-pypi-publish@v1.14.2
with:
verbose: true
7 changes: 0 additions & 7 deletions .pre-commit-config-cruft.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions Dockerfile

This file was deleted.

40 changes: 14 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,28 @@
PROJECT := xarray_ecmwf
CONDA := conda
CONDAFLAGS :=
COV_REPORT := html
PYTHON := uv run --frozen

default: qa unit-tests type-check
default: qa unit-tests check-typing

qa:
pre-commit run --all-files
$(PYTHON) -m pre_commit run --all-files

unit-tests:
python -m pytest -vv --cov=. --cov-report=$(COV_REPORT)
$(PYTHON) -m pytest -vv --cov=. --cov-report=$(COV_REPORT)

type-check:
python -m mypy .

conda-env-update:
$(CONDA) install -y -c conda-forge conda-merge
$(CONDA) run conda-merge environment.yml ci/environment-ci.yml > ci/combined-environment-ci.yml
$(CONDA) env update $(CONDAFLAGS) -f ci/combined-environment-ci.yml

docker-build:
docker build -t $(PROJECT) .
integration-tests:
$(PYTHON) -m pytest -vv --cov=. --cov-report=$(COV_REPORT) tests/integration_test_*.py

docker-run:
docker run --rm -ti -v $(PWD):/srv $(PROJECT)
all-tests:
$(PYTHON) -m pytest -vv --cov=. --cov-report=$(COV_REPORT) tests/test*.py tests/integration_test_*.py

template-update:
pre-commit run --all-files cruft -c .pre-commit-config-cruft.yaml
check-typing:
$(PYTHON) -m mypy .

docs-build:
cd docs && rm -fr _api && make clean && make html

# DO NOT EDIT ABOVE THIS LINE, ADD COMMANDS BELOW
$(PYTHON) -m sphinx -b html docs docs/_build/html

doc-tests:
python -m pytest -vv --doctest-glob="*.md" --doctest-glob="*.rst" README.md
$(PYTHON) -m pytest -vv --doctest-glob="*.md" README.md

integration-tests:
python -m pytest -vv --cov=. --cov-report=$(COV_REPORT) --log-cli-level=INFO tests/integration*.py
minver-tests:
uv run --resolution lowest-direct -p python3.11 -m pytest .
22 changes: 0 additions & 22 deletions ci/environment-ci.yml

This file was deleted.

16 changes: 0 additions & 16 deletions ci/environment-integration.yml

This file was deleted.

Loading
Loading