Skip to content

Commit

Permalink
Update workflows to support python and rust crate publish (#44)
Browse files Browse the repository at this point in the history
* Update workflows

* Attempt to update working directory

* Update working dir for real

* Update python container?

* Maybe missing extension

* Cleanup rust actions

* update mappers dep

* Update package metadata

* Update rust workflows
  • Loading branch information
mpiannucci authored Jul 10, 2024
1 parent ba0566f commit 86582fe
Show file tree
Hide file tree
Showing 9 changed files with 252 additions and 47 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/ci.yml

This file was deleted.

169 changes: 169 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
# This file is autogenerated by maturin v1.7.0
# To update, run
#
# maturin generate-ci github
#
name: python ci

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

permissions:
contents: read

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: python
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: python
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist

windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: python
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: python
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
working-directory: python
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, musllinux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
49 changes: 49 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: rust ci

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

permissions:
contents: read

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- name: run cargo check
run: cargo build

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- name: run cargo test
run: cargo test

publish:
name: Publish
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [check, test]
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: publish gribberish-types
run: cargo publish -p gribberish-types
- name: publish gribberish-macros
run: cargo publish -p gribberish-macros
- name: publish gribberish
run: cargo publish -p gribberish
16 changes: 12 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions gribberish/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@
name = "gribberish"
version = "0.20.0"
authors = ["Matthew Iannucci <[email protected]>"]
description = "Parse grib 2 files with Rust"
edition = "2021"
license = "MIT"
repository = "https://github.com/mpiannucci/gribberish"
keywords = ["grib", "weather", "meteorology", "climate", "oceanography"]
categories = ["science", "encoding", "compression"]

[dependencies]
gribberish-types = { path = "../types" }
gribberish-macros = { path = "../macros" }
gribberish-types = { path = "../types", version = "0.20.0" }
gribberish-macros = { path = "../macros", version = "0.20.0" }
chrono = "0.4"
openjpeg-sys = { version = "1.0.3", optional = true }
png = { version = "0.17.2", optional = true }
num = { version = "0.2", default-features = false }
itertools = "0.10.5"
mappers = { git = "https://github.com/mpiannucci/mappers" }
mappers = "0.7.1"
bitvec = "1.0.1"
thiserror = "1.0.60"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl LambertConformalTemplate {
EarthShape::OblateIAU => Err(GribberishError::GridTemplateError("unimplemented: OblateIAU".into())),
EarthShape::OblateKM => Err(GribberishError::GridTemplateError("unimplemented: OblateKM".into())),
EarthShape::OblateIAGGRS80 => Err(GribberishError::GridTemplateError("unimplemented: OblateIAGGRS80".into())),
EarthShape::WGS84 => Ok(Ellipsoid::wgs84()),
EarthShape::WGS84 => Ok(Ellipsoid::WGS84),
EarthShape::Spherical2 => Ok(Ellipsoid {
A: 6_371_229.0,
B: 6_371_229.0,
Expand Down
9 changes: 6 additions & 3 deletions macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
[package]
name = "gribberish-macros"
version = "0.1.0"
version = "0.20.0"
authors = ["Matthew Iannucci <[email protected]>"]
edition = "2018"
description = "Procedural macros for the gribberish crate"
edition = "2021"
license = "MIT"
repository = "https://github.com/mpiannucci/gribberish"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
gribberish-types = { path = "./../types" }
gribberish-types = { path = "./../types", version = "0.20.0" }
syn = { version = "1.0", features = ["full"] }
quote = "1.0"

Expand Down
4 changes: 2 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ gribberish = "gribberish.gribberish_backend:GribberishBackend"
gribberish = "gribberish.kerchunk:GribberishCodec"

[tool.maturin]
# features = ["pyo3/extension-module"]
module-name = "gribberish._gribberish_python"
features = ["pyo3/extension-module"]
module-name = "gribberish._gribberish_python"
7 changes: 5 additions & 2 deletions types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
[package]
name = "gribberish-types"
version = "0.1.0"
version = "0.20.0"
authors = ["Matthew Iannucci <[email protected]>"]
edition = "2018"
description = "Common types for the gribberish crate"
edition = "2021"
license = "MIT"
repository = "https://github.com/mpiannucci/gribberish"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down

0 comments on commit 86582fe

Please sign in to comment.