Skip to content

Commit

Permalink
feat: ci cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski authored Nov 15, 2024
1 parent 5848ce5 commit 2a0a221
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 19 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PR

on:
push:
branches:
- main
pull_request:

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

jobs:
ci:
name: CI
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
env:
UV_PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- run: uv sync
- run: uv run pre-commit run --all-files
- run: uv run pytest
20 changes: 5 additions & 15 deletions .github/workflows/ci.yml → .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
name: CI
name: PyPI

on:
push:
branches:
- main
tags:
- "*"
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency: pypi

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- run: uv sync
- run: uv run ruff check
- run: uv run ruff format --check
- run: uv run mypy tests
- run: uv run pytest
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
Expand Down Expand Up @@ -161,7 +150,8 @@ jobs:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: [test, linux, musllinux, windows, macos, sdist]
needs: [linux, musllinux, windows, macos, sdist]
environment: pypi
permissions:
id-token: write
contents: write
Expand Down
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: local
hooks:
- id: cargo-fmt
name: cargo fmt
language: system
entry: cargo fmt --check --
types: [rust]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
hooks:
- id: ruff
- id: ruff-format
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @gadomski
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# hydraters

[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/gadomski/hydraters/ci.yml?style=for-the-badge)](https://github.com/gadomski/hydraters/actions/workflows/ci.yml)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/developmentseed/hydraters/ci.yml?style=for-the-badge)](https://github.com/developmentseed/hydraters/actions/workflows/ci.yml)
[![PyPI - Version](https://img.shields.io/pypi/v/hydraters?style=for-the-badge)](https://pypi.org/project/hydraters/)

Hydrate Python dictionaries with Rust.
Expand All @@ -25,6 +25,24 @@ assert result == {
python -m pip install hydraters
```

## Developing

Get [Rust](https://rustup.rs/) and [uv](https://docs.astral.sh/uv/getting-started/installation/).
Then:

```shell
git clone git@github.com:developmentseed/hydraters.git
cd hydraters
uv sync
uv run pre-commit install
```

To run tests:

```shell
uv run pytest
```

## Background

The code for this package was taken from [pypgstac](https://github.com/stac-utils/pgstac/blob/f1d71d5e00392acb970e3b19a62d5f1aa8d50cc6/src/pypgstac/src/lib.rs).
Expand Down
11 changes: 8 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "hydraters"
version = "0.1.0"
description = "Hydrate Python dictionaries with Rust."
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
license = { file = "LICENSE" }
authors = [
{ name = "David Bitner", email = "bitner@dbspatial.com" },
Expand All @@ -13,10 +13,15 @@ classifiers = [
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[project.urls]
Repository = "https://github.com/gadomski/hydraters"
Repository = "https://github.com/developmentseed/hydraters"

[tool.maturin]
features = ["pyo3/extension-module"]
Expand All @@ -26,4 +31,4 @@ requires = ["maturin>=1.7,<2.0"]
build-backend = "maturin"

[dependency-groups]
dev = ["mypy>=1.13.0", "pytest>=8.3.3", "ruff>=0.7.3"]
dev = ["mypy>=1.13.0", "pre-commit>=3.5.0", "pytest>=8.3.3", "ruff>=0.7.3"]
Loading

0 comments on commit 2a0a221

Please sign in to comment.