Skip to content

Commit

Permalink
Add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron committed Oct 17, 2024
1 parent 98f09be commit a0ddc3b
Show file tree
Hide file tree
Showing 6 changed files with 352 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Rust

on:
push:
branches:
- main
pull_request:

jobs:
lint-test:
name: Lint and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2

- name: Cargo fmt
run: cargo fmt --all -- --check

- name: "clippy --all"
run: cargo clippy --all --all-features --tests -- -D warnings

- name: "cargo check"
run: cargo check --all --all-features

- name: "cargo test"
run: |
cargo test --all
cargo test --all --all-features
68 changes: 68 additions & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Python

on:
push:
branches:
- main
pull_request:

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

jobs:
pre-commit:
name: Run pre-commit on Python code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Cache pre-commit virtualenvs
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ hashFiles('.pre-commit-config.yaml') }}

- name: run pre-commit
run: |
python -m pip install pre-commit
pre-commit run --all-files
test-python:
name: Build and test Python
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

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

- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
version: "0.4.x"

- name: Build rust submodules
run: |
uv run maturin develop -m object-store-rs/Cargo.toml
- name: Run python tests
run: |
uv run pytest tests
182 changes: 182 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# This file is (mostly) autogenerated by maturin v1.7.1
# To update, run
#
# maturin generate-ci github -m arro3-core/Cargo.toml
#
name: Build wheels

on:
push:
tags:
- "py-v*"
workflow_dispatch:

permissions:
contents: read

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

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
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path object-store-rs/Cargo.toml
sccache: "true"
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}-object-store-rs
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:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path object-store-rs/Cargo.toml
sccache: "true"
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}-object-store-rs
path: dist

windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
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:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path object-store-rs/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}-object-store-rs
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:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path object-store-rs/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}-object-store-rs
path: dist

# sdist:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# steps:
# - uses: actions/checkout@v4
# - name: Build sdist
# uses: PyO3/maturin-action@v1
# with:
# command: sdist
# args: --out dist --manifest-path object-store-rs/Cargo.toml
# - name: Upload sdist
# uses: actions/upload-artifact@v4
# with:
# name: wheels-sdist-object-store-rs
# path: dist

# release:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# name: Release
# environment:
# name: release
# url: https://pypi.org/p/object-store-rs
# permissions:
# # IMPORTANT: this permission is mandatory for trusted publishing
# id-token: write
# if: startsWith(github.ref, 'refs/tags/')
# needs: [linux, windows, macos]
# steps:
# - uses: actions/download-artifact@v4
# with:
# pattern: wheels-*-object-store-rs
# merge-multiple: true
# path: dist
# - uses: actions/setup-python@v4
# with:
# python-version: 3.8

# - uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

# Default to Python 3
default_language_version:
python: python3

# Optionally both commit and push
default_stages: [pre-commit]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
args: ["--maxkb=500"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[project]
name = "test-env"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = []

[tool.uv]
dev-dependencies = [
"black>=24.10.0",
"boto3>=1.35.38",
"griffe-inherited-docstrings>=1.0.1",
"ipykernel>=6.29.5",
"maturin>=1.7.4",
"mike>=2.1.3",
"mkdocs-material[imaging]>=9.5.40",
"mkdocs>=1.6.1",
"mkdocstrings[python]>=0.26.1",
"pandas>=2.2.3",
"pip>=24.2",
"pytest>=8.3.3",
]

[tool.ruff]
select = [
# Pyflakes
"F",
# Pycodestyle
# "E",
"W",
# isort
"I",
]

[tool.ruff.extend-per-file-ignores]
"__init__.py" = [
"F401", # Allow unused imports in __init__.py files
"F403", # unable to detect undefined names
]
Empty file added tests/__init__.py
Empty file.

0 comments on commit a0ddc3b

Please sign in to comment.