ci: where possible, run jobs with MSRV (#251)

This commit is contained in:
Riccardo Mazzarini 2025-05-29 15:44:32 +02:00 committed by GitHub
parent dfdfe59d9d
commit 1674fdc36b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 61 additions and 17 deletions

View file

@ -0,0 +1,30 @@
name: "Install MSRV"
description: "Install Rust toolchain using MSRV read from Cargo.toml"
inputs:
components:
description: "Rust components to install (comma-separated)"
required: false
default: ""
outputs:
rust-version:
description: "The Rust version installed"
value: ${{ steps.get_msrv.outputs.version }}
runs:
using: "composite"
steps:
- name: Get MSRV
id: get_msrv
shell: bash
run: |
MSRV=$(cargo metadata --no-deps --format-version 1 | jq -r '.workspace_default_members[0] as $root | .packages[] | select(.id == $root) | .rust_version')
echo "version=$MSRV" >> $GITHUB_OUTPUT
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ steps.get_msrv.outputs.version }}
components: ${{ inputs.components }}

View file

@ -29,6 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-msrv
- name: Install Neovim ${{ matrix.neovim }}
uses: rhysd/action-setup-vim@v1
with:
@ -40,8 +41,6 @@ jobs:
- name: Install libluajit (macOS)
if: runner.os == 'macOS'
run: brew install luajit
- name: Install latest stable `rustc`
uses: dtolnay/rust-toolchain@stable
- name: Run tests
run: cargo test --workspace ${{ matrix.features }}
@ -50,7 +49,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: ./.github/actions/install-msrv
with:
components: clippy
- run: cargo clippy --all-features --workspace --tests -- -D warnings

View file

@ -6,10 +6,8 @@ resolver = "2"
version = "0.6.0"
edition = "2024"
authors = ["Riccardo Mazzarini <me@noib3.dev>"]
rust-version = "1.62"
description = "Rust bindings to all things Neovim"
rust-version = "1.85.0"
documentation = "https://docs.rs/nvim-oxi"
readme = "./README.md"
repository = "https://github.com/noib3/nvim-oxi"
license = "MIT"
keywords = ["bindings", "neovim", "nvim"]
@ -31,14 +29,16 @@ unsafe_op_in_unsafe_fn = "allow"
[package]
name = "nvim-oxi"
description.workspace = true
description = "Rust bindings to all things Neovim"
readme = "./README.md"
version.workspace = true
edition.workspace = true
repository.workspace = true
authors.workspace = true
rust-version.workspace = true
documentation.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
readme.workspace = true
[package.metadata.docs.rs]
features = ["neovim-nightly", "libuv", "mlua", "test", "__vendored_luajit"]
@ -63,7 +63,7 @@ types = { workspace = true, features = ["serde"] }
libuv = { workspace = true, optional = true }
thiserror = { workspace = true }
cargo_metadata = { version = "0.19", optional = true }
cargo_metadata = { version = "0.20", optional = true }
mlua = { version = "0.10", features = ["luajit"], optional = true }
[dev-dependencies]

View file

@ -3,9 +3,12 @@ name = "nvim-oxi-api"
description = "Rust bindings to Neovim's C API for nvim-oxi"
version.workspace = true
edition.workspace = true
repository.workspace = true
authors.workspace = true
rust-version.workspace = true
documentation.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
[features]
neovim-0-10 = []

View file

@ -3,9 +3,12 @@ name = "nvim-oxi-libuv"
description = "Rust bindings to libuv for nvim-oxi"
version.workspace = true
edition.workspace = true
repository.workspace = true
authors.workspace = true
rust-version.workspace = true
documentation.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
[dependencies]
luajit = { workspace = true }

View file

@ -3,9 +3,12 @@ name = "nvim-oxi-luajit"
description = "Rust bindings to LuaJIT for nvim-oxi"
version.workspace = true
edition.workspace = true
repository.workspace = true
authors.workspace = true
rust-version.workspace = true
documentation.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
[dependencies]
thiserror = { workspace = true }

View file

@ -3,9 +3,12 @@ name = "nvim-oxi-macros"
description = "Proc macros for nvim-oxi"
version.workspace = true
edition.workspace = true
repository.workspace = true
authors.workspace = true
rust-version.workspace = true
documentation.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
[lib]
proc-macro = true

View file

@ -3,9 +3,12 @@ name = "nvim-oxi-types"
description = "Rust bindings to types used by Neovim's C API"
version.workspace = true
edition.workspace = true
repository.workspace = true
authors.workspace = true
rust-version.workspace = true
documentation.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
[features]
serde = ["dep:serde"]

View file

@ -1,7 +1,7 @@
use core::ffi::{self, CStr};
use core::marker::PhantomData;
use core::str::Utf8Error;
use core::{cmp, fmt, hash, slice};
use core::{cmp, fmt, hash, slice, str};
use std::borrow::Cow;
use crate::String as NvimString;

View file

@ -214,7 +214,7 @@ impl CargoManifest {
.join("nvim_oxi_tests")
// Namespace by the package name to allow for multiple test crates
// in the same workspace.
.join(&self.root_package().name)
.join(&*self.root_package().name)
}
pub(super) fn library_path(&self, profile_name: &str) -> Utf8PathBuf {