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
48 changes: 30 additions & 18 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,53 @@
name: Rust CI for WSLPlugins-rs

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

env:
CARGO_TERM_COLOR: always

jobs:
build-and-validate:
runs-on: windows-latest

strategy:
matrix:
toolchain: ["stable", "nightly"]
include:
- toolchain: stable
RUSTDOCFLAGS: "-D warnings"
DOCTYPE: "docrs"
- toolchain: nightly
RUSTDOCFLAGS: "-D warnings --cfg docsrs"
DOCTYPE: "doc"

name: "Build and validate (${{ matrix.toolchain}})"
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: ${{ matrix.RUSTDOCFLAGS }}

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Cache Cargo Registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-registry-

- name: Cache Cargo Git Index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-index-

- name: Install Rust (Matrix)
shell: pwsh
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}

- name: Lint with Clippy (Stable Only)
if: matrix.toolchain == 'stable'
run: cargo clippy --all-targets --all-features -- -D warnings
run: cargo clippy --all-targets --all-features

- name: Check Code Formatting (Stable Only)
if: matrix.toolchain == 'stable'
Expand All @@ -39,16 +59,8 @@ jobs:
- name: Run Tests
run: cargo test --verbose

- name: Generate Documentation (Stable Only)
if: matrix.toolchain == 'stable'
run: cargo doc --no-deps

- name: Generate Documentation for Docs.rs (Nightly Only)
if: matrix.toolchain == 'nightly'
shell: pwsh
run: |
$env:RUSTDOCFLAGS = "--cfg docsrs"
cargo +nightly doc --no-deps
- name: Generate Documentation (${{ matrix.RUSTDOCFLAGS }}, ${{ matrix.toolchain }})
run: cargo doc --no-deps --all-features

- name: Install and Run Security Audit (Nightly Only)
if: matrix.toolchain == 'nightly'
Expand Down
4 changes: 2 additions & 2 deletions wslplugins-rs/src/plugin/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn create_plugin_with_required_version<T: WSLPluginV1>(
/// into a [windows::core::Error] using the `consume_error_message_unwrap` method.
///
/// # Arguments
/// - `result`: A [Result<T>] using the custom [Error] type defined in this crate.
/// - `result`: A [`Result<T>`] using the custom [Error] type defined in this crate.
///
/// # Returns
/// A `WinResult<T>` where:
Expand All @@ -74,7 +74,7 @@ pub fn create_plugin_with_required_version<T: WSLPluginV1>(
///
/// # Behavior
/// - If the `result` is `Ok`, it is returned as-is.
/// - If the `result` is `Err`, the error is consumed using the
/// - If the `result` is `Err`, the error is consumed
/// and sent to WSL and is then
/// converted into a [windows::core::Error].
///
Expand Down
4 changes: 2 additions & 2 deletions wslplugins-rs/src/wsl_user_configuration/bitflags.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Provides a [bitflags] implementation for [WSLUserConfiguration] flags.
//! Provides a [mod@bitflags] implementation for [WSLUserConfiguration] flags.
use super::WSLUserConfiguration;
use bitflags::bitflags;

bitflags! {
/// Represents the user configuration flags for Windows Subsystem for Linux (WSL) as
/// [bitflags]
/// [mod@bitflags]
///
/// These flags are used to customize the behavior of WSL instances based on user configuration.
/// The values correspond to the definitions in the WSL Plugin API provided by Microsoft.
Expand Down