Skip to content

Commit

Permalink
add ci yamls
Browse files Browse the repository at this point in the history
  • Loading branch information
slawler committed Jan 21, 2025
1 parent a3a9326 commit 18c02de
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 8 deletions.
66 changes: 66 additions & 0 deletions .github/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI

on:
push:
branches: [ "main", "dev" ]
paths:
- 'stormhub/**'
- 'tests/**'
pull_request:
branches: [ "main", "dev" ]
paths:
- 'stormhub/**'
- 'tests/**'
workflow_dispatch:


permissions:
contents: read

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
build:

strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
os: ["ubuntu-latest"]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

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

- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build toml ruff pytest
- name: Build wheel
run: |
python -m build_wheel
- name: Install the built wheel
run: |
python -c "import glob; import subprocess; wheel_files = glob.glob('dist/*.whl'); subprocess.check_call(['pip', 'install', wheel_files[0]])"
# - name: Lint (ruff)
# run: |
# ruff check .
# ruff format --check

# - name: Run tests with coverage
# run: |
# pytest tests/conflation_tests.py
# pytest tests/read_ras_files_tests.py
69 changes: 69 additions & 0 deletions .github/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release

on:
push:
branches: [ "main" ]
paths:
- 'stormhub/**'

workflow_dispatch:

permissions:
contents: write

jobs:
release:
name: release
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Print Python version
run: python --version
- name: Install release dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Extract version from stormhub version
id: get_version
shell: pwsh
run: |
$version = python -c "import stormhub; print(stormhub.__version__);"
echo "::set-output name=VERSION::$version"
- name: Build wheel and source distribution
run: python -m build
- name: List dist directory contents
run: dir dist
- name: Publish package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: python -m twine upload dist/*
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.VERSION }}
release_name: Release v${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- name: List dist directory contents again
run: dir dist
- name: Upload Source Distribution
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/stormhub-${{ steps.get_version.outputs.VERSION }}.tar.gz
asset_name: stormhub-v${{ steps.get_version.outputs.VERSION }}.tar.gz
asset_content_type: application/gzip
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# StormHub
[![CI](https://github.com/dewberry/stormhub/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/dewberry/stormhub/actions/workflows/ci.yaml)
[![Documentation Status](https://readthedocs.org/projects/stormhub/badge/?version=latest)](https://stormhub.readthedocs.io/en/latest/?badge=latest)
[![Release](https://github.com/dewberry/stormhub/actions/workflows/release.yaml/badge.svg)](https://github.com/dewberry/stormhub/actions/workflows/release.yaml)
[![PyPI version](https://badge.fury.io/py/stormhub.svg)](https://badge.fury.io/py/stormhub)


**StormHub** is an open-source Python library designed to access and process publicly available hydrometeorological data to create catalogs, metadata, and data products for hydrologic modeling. This project automates the generation of STAC catalogs from storm and stream gage data, enabling improved analysis and simulation for flood studies and stochastic storm transposition (SST). StormHub aims to follow the principles of **[FAIR](https://www.nature.com/articles/sdata201618) (Findable, Accessible, Interoperable, and Reusable)** practices, ensuring that all catalogs can be easily reproduced, shared, published, and integrated into broader workflows.

Expand Down Expand Up @@ -51,7 +56,7 @@ pip install -e .
```

## Usage
See the [User Guide](readthedocs).
See the [User Guide](https://stormhub.readthedocs.io/en/latest/user_guide.html).

## Sources and References
- **AORC Dataset** - 1km hourly gridded precipitation data, available through NOAA.
Expand All @@ -68,10 +73,3 @@ This project builds on the work of Daniel Wright's [RainyDay2](https://her.cee.w

## License
StormHub is licensed under the MIT License. See [LICENSE](LICENSE) for more information.

## Contributing
Contributions are welcome! Please submit issues and pull requests through the [GitHub repository](https://github.com/slawler/stormhub).

---
For more information, visit the project repository: [https://github.com/dewberry/stormhub](https://github.com/slawler/stormhub).

0 comments on commit 18c02de

Please sign in to comment.