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
23 changes: 23 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Memory-optimized build configuration
# For environments with limited RAM

[build]
# Use single job to reduce memory usage
jobs = 1

# Disable incremental compilation to save memory
incremental = false

# Target the native architecture (auto-detected)
# target = "aarch64-apple-darwin"

[profile.release]
# Optimize for size to reduce memory during compilation
opt-level = "z"
lto = false
codegen-units = 1

[profile.dev]
# Debug builds also optimized for memory
opt-level = 0
debug = false
94 changes: 94 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
build-wheels:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform_tag: manylinux_2_17_x86_64
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
platform_tag: manylinux_2_17_aarch64
- os: macos-latest
target: aarch64-apple-darwin
platform_tag: macosx_11_0_arm64
- os: macos-13
target: x86_64-apple-darwin
platform_tag: macosx_10_9_x86_64

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}

- name: Run tests
run: cargo test

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install build tools
run: pip install build

- name: Build wheel
run: |
mkdir -p python/site2skill/bin
cp target/${{ matrix.target }}/release/site2skill python/site2skill/bin/
chmod +x python/site2skill/bin/site2skill
cd python
python -m build --wheel
cd dist
for wheel in site2skill-*-py3-none-any.whl; do
if [ -f "$wheel" ]; then
VERSION=$(echo "$wheel" | sed 's/site2skill-\(.*\)-py3-none-any.whl/\1/')
NEW_NAME="site2skill-${VERSION}-py3-none-${{ matrix.platform_tag }}.whl"
mv "$wheel" "$NEW_NAME"
echo "Built: $NEW_NAME"
fi
done

- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.platform_tag }}
path: python/dist/*.whl

publish:
needs: build-wheels
runs-on: ubuntu-latest
environment: pypi

steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- name: List wheels
run: ls -lh dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
19 changes: 10 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Set up Python
uses: actions/setup-python@v5
- name: Cache cargo
uses: actions/cache@v4
with:
python-version-file: ".python-version"

- name: Install dependencies
run: uv sync --all-extras --dev
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run tests
run: uv run pytest
run: cargo test
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,15 @@ venv/

# Pytest
.pytest_cache/

# Rust
target/

# Benchmark artifacts
bench-site-*/
bench-results/

# Misc
wget-log
*.skill
python/site2skill/bin/
Loading
Loading