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
2 changes: 1 addition & 1 deletion .github/ci/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Adapted from the conda forge recipe
context:
name: parcels
version: 4.0.0alpha2 # The last number here needs to be bumped for each new alpha release
version: ${{ env.get('PARCELS_ALPHA_VERSION') }}

package:
name: ${{ name|lower }}
Expand Down
38 changes: 35 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ on:
push:
branches:
- "main"
- "v4-dev"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were only running in PRs before, and not the branch itself

- "test-me/*"
pull_request:
schedule:
- cron: "0 7 * * 1" # Run every Monday at 7:00 UTC

concurrency:
group: branch-${{ github.head_ref }}
Expand Down Expand Up @@ -38,7 +37,7 @@ jobs:
exit 1

cache-pixi-lock:
runs-on: ubuntu-slim
runs-on: ubuntu-latest
needs: [should-run-ci]
outputs:
cache-key: ${{ steps.pixi-lock.outputs.cache-key }}
Expand Down Expand Up @@ -195,3 +194,36 @@ jobs:
with:
name: Mypy report
path: mypy-report
build-and-upload-nightly-parcels: # for alpha testing
needs: [cache-pixi-lock]
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Restore cached pixi lockfile
uses: Parcels-code/pixi-lock/restore@2b823a4a804631370fbde7e6088ee5db71a26c60 # TODO: Update to action in prefix-dev once available
with:
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
- uses: prefix-dev/setup-pixi@v0.9.0
with:
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'v4-dev' }} # TODO: Update v4-dev to main when v4 is released
- run: pixi run get-parcels-alpha-version >> $GITHUB_ENV
- run: echo "PARCELS_ALPHA_VERSION is $PARCELS_ALPHA_VERSION"
- name: Build conda package
uses: prefix-dev/rattler-build-action@v0.2.34
with:
recipe-path: .github/ci/recipe.yaml
- if: github.ref == 'refs/heads/v4-dev'
run: |
for pkg in $(find output -type f \( -name "*.conda" -o -name "*.tar.bz2" \) ); do
echo "Uploading ${pkg}"
rattler-build upload prefix -c parcels "${pkg}"
done
env:
PREFIX_API_KEY: ${{ secrets.PREFIX_API_KEY }}
26 changes: 0 additions & 26 deletions .github/workflows/nightly.yml

This file was deleted.

7 changes: 7 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ py-triangle = ">=20250106,<20250107"
[dependencies]
parcels = { path = "." }

[feature.alpha-parcels.dependencies]
git = "*"

[feature.alpha-parcels.tasks]
get-parcels-alpha-version = { cmd = "python tools/get-parcels-alpha-version.py" }

[feature.minimum.dependencies]
python = "3.11.*"
netcdf4 = "1.6.*"
Expand Down Expand Up @@ -127,3 +133,4 @@ test-py313 = { features = ["test", "py313"] }
test-notebooks = { features = ["test", "notebooks"], solve-group = "main" }
docs = { features = ["docs", "notebooks"], solve-group = "docs" }
typing = { features = ["typing"], solve-group = "main" }
alpha-parcels = { features = ["alpha-parcels"] }
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ dependencies = [
"netCDF4 >=1.7.2",
"zarr >=2.15.0,!=2.18.0,<3",
"tqdm >=4.50.0",
"pytest",
"xarray >=2024.5.0",
"uxarray >=2025.3.0",
"pooch >=1.8.0",
Expand Down
30 changes: 30 additions & 0 deletions tools/get-parcels-alpha-version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Get a Parcels v4 alpha version string based on commits since the last tag.

Sets the PARCELS_ALPHA_VERSION environment variable (via GITHUB_ENV in CI,
or prints the version to stdout for local use).
"""

import subprocess


def get_alpha_version():
result = subprocess.run(
["git", "describe", "--tags", "--long"],
capture_output=True,
text=True,
check=True,
)
# Format: <tag>-<n>-g<hash>
# e.g. v3.1.2-1967-g1857d5219
parts = result.stdout.strip().rsplit("-", 2)
n_commits = parts[1]
return f"4.0.0alpha{n_commits}"


def main():
version = get_alpha_version()
print(f"PARCELS_ALPHA_VERSION={version}")


if __name__ == "__main__":
main()
Loading