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
45 changes: 13 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,28 @@ on:

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

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

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
python-version: ${{ matrix.python }}
cache: pip

- name: Install package + dev deps
run: pip install -e ".[dev]"

- name: Run tests
run: pytest --tb=short -q

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
components: rustfmt, clippy

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Install ruff
run: pip install ruff
- name: Check formatting
run: cargo fmt --all -- --check

- name: Ruff check
run: ruff check src/
- name: Run clippy
run: cargo clippy --workspace -- -D warnings

- name: Ruff format check
run: ruff format --check src/
- name: Run tests
run: cargo test --workspace
159 changes: 37 additions & 122 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,165 +13,80 @@ on:
permissions:
contents: write

# ─────────────────────────────────────────────
# Build a standalone binary on every platform
# ─────────────────────────────────────────────
jobs:
build-binaries:
name: Build — ${{ matrix.label }}
build:
name: Build - ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
label: Windows x86_64
artifact: routecode.exe
asset: routecode-cli-windows-x86_64.exe

- os: macos-latest # Apple Silicon (arm64)
label: macOS arm64
artifact: routecode
asset: routecode-cli-macos-arm64

- os: macos-15-intel # Intel (x86_64)
label: macOS x86_64
artifact: routecode
asset: routecode-cli-macos-x86_64

- os: ubuntu-latest
label: Linux x86_64
artifact: routecode
asset: routecode-cli-linux-x86_64

runs-on: ${{ matrix.os }}
timeout-minutes: 20
target: x86_64-unknown-linux-gnu
artifact_name: routecode
asset_name: routecode-linux-x86_64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: routecode-cli.exe
asset_name: routecode-windows-x86_64.exe
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: routecode
asset_name: routecode-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: routecode
asset_name: routecode-macos-arm64

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history needed for setuptools-scm version tags

- uses: actions/setup-python@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
python-version: "3.12"
cache: pip

- name: Install dependencies
run: |
pip install -e .
pip install pyinstaller
targets: ${{ matrix.target }}

- name: Build binary (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: pyinstaller --clean routecode.spec
- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Build binary (Unix)
if: runner.os != 'Windows'
run: pyinstaller --clean routecode.spec
- name: Build
run: cargo build -p routecode-cli --release --target ${{ matrix.target }}

- name: Stage artifact
- name: Prepare Assets
shell: bash
run: |
mkdir -p release
if [ -f "dist/routecode.exe" ]; then
cp dist/routecode.exe release/${{ matrix.asset }}
else
cp dist/routecode release/${{ matrix.asset }}
fi
cp target/${{ matrix.target }}/release/${{ matrix.artifact_name }} release/${{ matrix.asset_name }}

- name: Upload artifact
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: release/${{ matrix.asset }}
retention-days: 1
name: ${{ matrix.asset_name }}
path: release/${{ matrix.asset_name }}

# ─────────────────────────────────────────────
# Create GitHub Release and attach all binaries
# ─────────────────────────────────────────────
publish-release:
name: Publish GitHub Release
needs: build-binaries
if: always() && !cancelled()
publish:
name: Publish Release
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release/
merge-multiple: true

- name: Generate checksums
run: |
cd release
find . -type f | sort | xargs sha256sum > checksums.txt
cat checksums.txt
sha256sum * > checksums.txt

- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name || inputs.tag }}
name: "RouteCode ${{ github.ref_name || inputs.tag }}"
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
generate_release_notes: true
files: |
release/**/*
body: |
## Install

**macOS / Linux — one-liner:**
```sh
curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/install.sh | sh
```

**Windows — one-liner (PowerShell):**
```powershell
irm https://raw.githubusercontent.com/${{ github.repository }}/main/install.ps1 | iex
```

**Python (pip / pipx):**
```sh
pipx install routecode
```

---

| Platform | Binary |
|---|---|
| Windows x86_64 | `routecode-cli-windows-x86_64.exe` |
| macOS Apple Silicon | `routecode-cli-macos-arm64` |
| macOS Intel | `routecode-cli-macos-x86_64` |
| Linux x86_64 | `routecode-cli-linux-x86_64` |

# ─────────────────────────────────────────────
# Publish to PyPI (pipx install routecode)
# ─────────────────────────────────────────────
publish-pypi:
name: Publish to PyPI
needs: build-binaries
if: always() && !cancelled()
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # required for OIDC trusted publishing

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Build wheel + sdist
run: |
pip install build setuptools-scm
python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
release/*
generate_release_notes: true
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ env/
.idea/
*.suo
*.user

\inspiration
# ── OS ────────────────────────────────────────
Thumbs.db
.DS_Store
Expand Down Expand Up @@ -55,3 +55,8 @@ tests/tmp/
test.txt
test_progress.txt
snake_game.html


# Added by cargo

/target
24 changes: 0 additions & 24 deletions .pre-commit-config.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions .routecode/skills/lint.md

This file was deleted.

11 changes: 0 additions & 11 deletions .routecode/skills/test.md

This file was deleted.

30 changes: 0 additions & 30 deletions Build_portable.bat

This file was deleted.

Loading
Loading