Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
22cedd6
initial commit
tropicrainforest Jan 5, 2026
3688990
setup ci workflow
tropicrainforest Jan 5, 2026
1b52dd1
use mambe on the ci to use pre-build wheels
tropicrainforest Jan 5, 2026
b8000fd
install no deps since conda is install it already to avoid conflict i…
tropicrainforest Jan 5, 2026
ec2c3f9
enable site-package in tests of ci
tropicrainforest Jan 5, 2026
e123017
add _version for release
tropicrainforest Jan 5, 2026
c3d3120
add _version for release
tropicrainforest Jan 5, 2026
c4e8d63
fix relase ci
tropicrainforest Jan 5, 2026
f71f5d5
import __version__ in __init__
tropicrainforest Jan 5, 2026
d760a5a
read from version in the ci
tropicrainforest Jan 5, 2026
5425337
remove the py12 and py13 from black
tropicrainforest Jan 5, 2026
de9bde2
apply black and fix flak8 errors
tropicrainforest Jan 5, 2026
0f007ec
fix version importing
tropicrainforest Jan 5, 2026
2ec541c
let's test TEST_PYPI_TOKEN if it's still valid
tropicrainforest Jan 5, 2026
4b3ba3d
add id-token permission to make the ci work
tropicrainforest Jan 5, 2026
fa9a2e1
fix github release
tropicrainforest Jan 5, 2026
5c04528
remove token api
tropicrainforest Jan 5, 2026
696e13e
increase version to test
tropicrainforest Jan 6, 2026
2f00905
get version only from _version
tropicrainforest Jan 6, 2026
2935584
support NSSC data
tropicrainforest Jan 6, 2026
fbbd1f5
add a lightweight terminal detector to be able to use hyperlink for c…
tropicrainforest Jan 6, 2026
58be2d4
increase test version
tropicrainforest Jan 6, 2026
eee8263
fix linter
tropicrainforest Jan 6, 2026
eba4de4
freva-xarray to xarray-prism
tropicrainforest Jan 7, 2026
6f44b53
replace leftover of freva-xarray to xarray-prism
tropicrainforest Jan 7, 2026
afb8528
resolve the change requests on the first review round
tropicrainforest Jan 8, 2026
7806f9f
keep it as lazy load as possible and add h5py into deps
tropicrainforest Feb 24, 2026
acf1843
bumo the version
tropicrainforest Feb 24, 2026
956bf7f
switch verbose to info
tropicrainforest Feb 24, 2026
99a73d9
fix linter
tropicrainforest Feb 24, 2026
55c22c6
sanitize rasterio kwrds due to incompatibility with official xarray k…
tropicrainforest Feb 25, 2026
12ef352
turn the black linter to white
tropicrainforest Feb 25, 2026
7dd10eb
clean the surrogates produces via h5py and move the all satizations l…
tropicrainforest Feb 25, 2026
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
161 changes: 161 additions & 0 deletions .github/workflows/release_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
---
name: Build and publish release
run-name: ${{ github.actor }} is preparing the next release

permissions:
pull-requests: write
contents: write
packages: write

"on":
workflow_dispatch:
inputs:
rc:
description: "Release candidate number for this release."
required: true
type: number
push:
tags:
- "v*.*.*"

jobs:
release-type-determination:
name: Determine if tag is pre-release or not
runs-on: ubuntu-latest
outputs:
is_prerelease: ${{ steps.check-prerelease.outputs.is_prerelease }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Installing dependencies
run: pip install git-python packaging tomli requests

- name: Getting release job
run: curl -Ls -o rc.py https://raw.githubusercontent.com/freva-org/freva-admin/main/release.py

- name: Check if tag is a pre-release
id: check-prerelease
run: |
RC="${{ github.event_name == 'workflow_dispatch' && inputs.rc || '' }}"
IS_PRERELEASE="false"
if [ "$RC" ]; then
python3 rc.py rc $RC xarray_prism -p . 1> tag.txt
IS_PRERELEASE="true"
else
python3 -c "exec(open('src/xarray_prism/_version.py').read()); print(__version__)" 1> tag.txt
fi
echo "$IS_PRERELEASE" > is_prerelease.txt
echo "is_prerelease=$IS_PRERELEASE" >> "$GITHUB_OUTPUT"

- name: Upload Outputs
uses: actions/upload-artifact@v4
with:
name: release-metadata
path: |
tag.txt
is_prerelease.txt

tests:
uses: ./.github/workflows/tests_ci.yml

pypi:
name: Publish to PyPI
needs: [tests, release-type-determination]
if: needs.release-type-determination.outputs.is_prerelease == 'false'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: python -m pip install build
- run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true

pypi-prerelease:
name: Publish pre-release to PyPI
needs: [tests, release-type-determination]
if: needs.release-type-determination.outputs.is_prerelease == 'true'
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download Release Metadata
uses: actions/download-artifact@v4
with:
name: release-metadata

- name: Read tag version
run: |
TAG=$(tail -1 tag.txt)
echo "TAG=$TAG" >> $GITHUB_ENV

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install build tools
run: python -m pip install build tomli

- name: Update version for pre-release
run: |
sed -i "s/__version__ = .*/__version__ = \"${{ env.TAG }}\"/" src/xarray_prism/_version.py

- name: Build package
run: python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
skip-existing: true
verbose: true

github-release:
name: Create GitHub Release
needs: [tests, release-type-determination]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download Release Metadata
uses: actions/download-artifact@v4
with:
name: release-metadata
path: release-metadata

- name: Read Metadata
shell: bash
run: |
TAG="$(tail -n 1 release-metadata/tag.txt)"
IS_PRERELEASE="$(tail -n 1 release-metadata/is_prerelease.txt)"
echo "TAG=$TAG" >> "$GITHUB_ENV"
echo "IS_PRERELEASE=$IS_PRERELEASE" >> "$GITHUB_ENV"

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.TAG }}
name: Release v${{ env.TAG }}
prerelease: ${{ env.IS_PRERELEASE == 'true' }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117 changes: 117 additions & 0 deletions .github/workflows/tests_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: CI Tests

permissions:
pull-requests: write
contents: write
packages: write

on: [push, pull_request, workflow_call]

jobs:
lint-and-types:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox

- name: Run lint and type checks
run: tox run-parallel --parallel-no-spinner -e lint,types

tests:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: "latest"
environment-name: xarray-prism
cache-environment: true
cache-downloads: true
create-args: >-
python=${{ matrix.python-version }}
hdf5
netcdf4
h5py
h5netcdf
eccodes
cfgrib
rasterio
gdal
pip
tox
condarc: |
channels:
- conda-forge
channel_priority: strict
init-shell: bash

- name: Set up services
shell: bash -l {0}
run: |
docker compose -f dev-env/docker-compose.yaml up -d --remove-orphans

- name: Wait for MinIO
shell: bash -l {0}
run: |
echo "Waiting for MinIO to be ready..."
timeout 60 bash -c 'until curl -sf http://localhost:9000/minio/health/ready; do sleep 2; done'
echo "MinIO is ready"

- name: Wait for THREDDS
shell: bash -l {0}
run: |
echo "Waiting for THREDDS to be ready..."
timeout 120 bash -c 'until curl -sf http://localhost:8088/thredds/catalog.html; do sleep 5; done'
echo "THREDDS is ready"

- name: Run tests
shell: bash -l {0}
run: VIRTUALENV_SYSTEM_SITE_PACKAGES=1 tox -e test

- name: Upload coverage to Codecov
if: matrix.python-version == '3.12'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

dependabot:
name: Merge PR by dependabot
runs-on: ubuntu-latest
needs: [tests, lint-and-types]
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve dependabot's PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.TOKEN }}

- name: Auto-merge for dependabot's PR
run: gh pr merge --merge --auto "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.TOKEN }}
Loading
Loading