diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a4da774 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +name: CI + +on: + push: + branches: [master] + tags: ["v*"] + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + steps: + - uses: actions/checkout@v6 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy, rustfmt + + - uses: Swatinem/rust-cache@v2 + + - name: cargo fmt --check + run: cargo fmt --check + + - name: cargo clippy + run: cargo clippy --all-targets --locked -- -D warnings + + - name: cargo test + run: cargo test --locked + + build: + name: Build wheel (${{ matrix.target }}) + needs: test + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu + - os: macos-latest + target: aarch64-apple-darwin + steps: + - uses: actions/checkout@v6 + + - name: Build wheel + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --locked --out dist + sccache: "true" + + - name: Upload wheel + uses: actions/upload-artifact@v7 + with: + name: wheel-${{ matrix.target }} + path: dist/*.whl + if-no-files-found: error + + sdist: + name: Build sdist + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + + - name: Upload sdist + uses: actions/upload-artifact@v7 + with: + name: sdist + path: dist/*.tar.gz + if-no-files-found: error diff --git a/.gitignore b/.gitignore index ea8c4bf..7a3a7fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,12 @@ /target + +# Python / maturin build artifacts +/dist +/build +/wheels +*.egg-info/ +__pycache__/ +*.py[cod] +.venv/ +venv/ +.env/ diff --git a/README.md b/README.md index 9067517..b30d71d 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,36 @@ CLI tool to launch and manage [KoalaVim](https://github.com/KoalaVim/KoalaVim) e ## Installation +`kv` is a Rust binary. It can be installed with `cargo`, or with `pip` / `uv` +(packaged via [maturin](https://www.maturin.rs/)). All methods require a Rust +toolchain to build the binary. + +### With `uv` (recommended) + +```bash +# From Git +uv tool install git+https://github.com/KoalaVim/kv.git + +# From a local checkout +git clone https://github.com/KoalaVim/kv.git +cd kv +uv tool install . +``` + +### With `pip` + +```bash +# From Git +pip install git+https://github.com/KoalaVim/kv.git + +# From a local checkout +git clone https://github.com/KoalaVim/kv.git +cd kv +pip install . +``` + +### With `cargo` + Make sure [Cargo](https://www.rust-lang.org/tools/install) is installed (`~/.cargo/bin` should be in your `PATH`). ```bash @@ -20,6 +50,16 @@ cd kv cargo install --locked --path . ``` +### Building a wheel + +To build a redistributable wheel (e.g. to publish or install offline): + +```bash +uvx maturin build --release +# wheel is written to target/wheels/ +pip install target/wheels/kv-*.whl +``` + ## Try Without Installing ```bash @@ -78,4 +118,3 @@ kv completions fish # generate fish completions - Linux - macOS -- Windows diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0f6ba98 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = ["maturin>=1.7,<2.0"] +build-backend = "maturin" + +[project] +name = "kv" +description = "CLI tool to launch KoalaVim" +readme = "README.md" +requires-python = ">=3.8" +license = { file = "LICENSE" } +authors = [{ name = "KoalaVim" }] +keywords = ["neovim", "koalavim", "cli"] +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: MacOS", + "Operating System :: POSIX :: Linux", + "Programming Language :: Rust", + "Topic :: Text Editors", + "Topic :: Utilities", +] +dynamic = ["version"] + +[project.urls] +Homepage = "https://github.com/KoalaVim/kv" +Repository = "https://github.com/KoalaVim/kv" +Issues = "https://github.com/KoalaVim/kv/issues" + +[tool.maturin] +bindings = "bin" +strip = true