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
93 changes: 62 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,85 @@ on:
workflow_dispatch:
inputs:
version:
description: 'New version'
description: New semantic version (for example, 2.3.1)
required: true

permissions:
contents: write

jobs:
update-and-build:
update-build-and-release:
runs-on: ubuntu-latest
env:
VERSION: ${{ inputs.version }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Validate version
shell: bash
run: |
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version must use MAJOR.MINOR.PATCH without a prefix."
exit 1
fi
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Git tag $VERSION already exists."
exit 1
fi

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Poetry
run: python -m pip install "poetry>=1.8,<3"

- name: Update pyproject.toml version
- name: Set version, install, test, and build
run: |
sed -i "s/^version = .*/version = \"${{ github.event.inputs.version }}\"/" pyproject.toml
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
git commit -am "ci: Version bump ${{ github.event.inputs.version }}"
git push
poetry version "$VERSION"
poetry install --no-interaction
poetry run pytest
poetry build

- name: Commit and tag the version
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add pyproject.toml
git commit -m "chore: release $VERSION"
git tag "$VERSION"
git push origin "HEAD:${GITHUB_REF_NAME}"
git push origin "$VERSION"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push Docker Image
uses: docker/build-push-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64 #,linux/arm64 future ;)
platforms: linux/amd64
push: true
tags: ${{ vars.DOCKER_IMAGE_NAME }}:${{ github.event.inputs.version }}, ${{ vars.DOCKER_IMAGE_NAME }}:latest

- name: Push version bump commit
run: |
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}
git push
tags: |
${{ vars.DOCKER_IMAGE_NAME }}:${{ env.VERSION }}
${{ vars.DOCKER_IMAGE_NAME }}:latest

- name: Create GitHub Release
uses: actions/create-release@v1
- name: Create GitHub release and upload Python artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}
release_name: Release ${{ github.event.inputs.version }}
draft: false
prerelease: false
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$VERSION" dist/* \
--title "Release $VERSION" \
--generate-notes \
--verify-tag
32 changes: 32 additions & 0 deletions .github/workflows/soil-raster-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Soil raster compatibility

on:
push:
pull_request:

jobs:
regression-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.12"]
runs-on: ${{ matrix.os }}

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: python -m pip install poetry

- name: Install dependencies
run: poetry install

- name: Test one-band and two-band soil rasters
run: poetry run pytest -q pythia/tests/raster_functions_test.py
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Changelog

## Unreleased

### Fixed

- Restored backward compatibility with legacy one-band GHR soil rasters.
- Automatically detect one-band legacy and two-band encoded soil rasters.
- Resolve legacy raster IDs through `GHR.db` and provide actionable errors for
missing database records and DSSAT `.SOL` files.
- Prevent out-of-bounds soil raster access and support coordinate reprojection.
- Read only the requested two-band raster pixel instead of loading both bands
for every lookup.
- Corrected and documented the Sri Lanka example workflow; its existing
one-band `ggcmi_soils_2.tif` does not require conversion.
- Fixed plugin hook execution so context is passed once and plugin return values
are composed correctly.

### Added

- Added `--configure-example` and `--validate-example` commands for the
downloadable Sri Lanka data.
- Added a reproducible example-data packager that removes local/generated files,
restores portable JSON templates, enforces the GitHub asset size limit, and
writes a SHA-256 checksum.
- Expanded installation, conceptual, input configuration, troubleshooting, and
release documentation.
- Updated the release workflow to test and build wheel/source artifacts before
publishing them.

### Testing

- Added self-contained regression coverage for both soil raster formats,
including the Sri Lanka coordinate and profile reported by users.
- Added tests for repeatable example configuration, archive portability, and
plugin hook execution.
Loading
Loading