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
49 changes: 49 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
push:
branches: [main]
pull_request:

jobs:
test:
name: Test (Python ${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

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

- name: Create virtualenv
run: python -m venv .venv

- name: Add venv to PATH
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
echo "$GITHUB_WORKSPACE/.venv/Scripts" >> $GITHUB_PATH
else
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
fi
shell: bash

- name: Build and install (dev mode)
uses: PyO3/maturin-action@v1
env:
VIRTUAL_ENV: ${{ github.workspace }}/.venv
with:
command: develop
args: --release

- name: Install test dependencies
run: pip install pytest

- name: Run tests
run: pytest tests/
86 changes: 86 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
linux:
name: Build Linux (${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: --release --out dist --find-interpreter
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
path: dist

windows:
name: Build Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
args: --release --out dist --find-interpreter
- uses: actions/upload-artifact@v4
with:
name: wheels-windows
path: dist

macos:
name: Build macOS (${{ matrix.target }})
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
- uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: dist

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

publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [linux, windows, macos, sdist]
environment:
name: pypi
url: https://pypi.org/p/prinpy
permissions:
id-token: write # required for PyPI trusted publishing (no API token needed)
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ __pycache__/
build/
dist/
prinpy.egg-info/
venv/
target/
prinpy/_rs/*.pyd
prinpy/_rs/*.pdb
.mypy_cache/
.pytest_cache/
251 changes: 251 additions & 0 deletions Cargo.lock

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

Loading
Loading