Skip to content

add docs

add docs #4

Workflow file for this run

name: Release
on:
push:
branches:
- main
defaults:
run:
shell: bash
permissions:
contents: write
actions: write
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Cleanup artifacts
uses: actions/github-script@v7
with:
script: |
const artifacts = await github.paginate(github.rest.actions.listArtifactsForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100,
});
const toDelete = artifacts.filter((artifact) => artifact.name.startsWith("wheels-"));
for (const artifact of toDelete) {
await github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
});
}
build:
runs-on: ${{ matrix.os }}
needs: cleanup
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
python-version:
- "3.13"
env:
PYTHONIOENCODING: "utf-8"
PYTHONUTF8: "1"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Create venv (Unix)
if: runner.os != 'Windows'
run: |
python -m venv .venv
echo "PYTHON_EXEC=$PWD/.venv/bin/python" >> $GITHUB_ENV
- name: Create venv (Windows)
if: runner.os == 'Windows'
run: |
python -m venv .venv
echo "PYTHON_EXEC=$(pwd)/.venv/Scripts/python.exe" >> $GITHUB_ENV
- name: Install maturin
run: $PYTHON_EXEC -m pip install --upgrade pip maturin
- name: Build wheels
run: $PYTHON_EXEC -m maturin build --release --out dist
- name: Install wheel
run: $PYTHON_EXEC -m pip install dist/*.whl
- name: Run Tests
run: |
$PYTHON_EXEC -m unittest discover tests
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-py${{ matrix.python-version }}
path: dist/*
retention-days: 3
release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Cleanup latest release assets
uses: actions/github-script@v7
with:
script: |
try {
const release = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: "latest",
});
const assets = release.data.assets || [];
for (const asset of assets) {
await github.rest.repos.deleteReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
asset_id: asset.id,
});
}
} catch (error) {
if (error.status !== 404) {
throw error;
}
}
- name: Download wheels
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Publish latest release
uses: softprops/action-gh-release@v2
with:
tag_name: latest
name: latest
generate_release_notes: true
files: dist/*