Skip to content

Commit 9161258

Browse files
authored
CI improvment (#3)
1 parent 5830c86 commit 9161258

File tree

3 files changed

+34
-22
lines changed

3 files changed

+34
-22
lines changed

.github/workflows/rust.yml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,53 @@
1-
name: Rust CI for WSLPlugins-rs
2-
31
on:
42
push:
53
branches: ["main"]
64
pull_request:
75
branches: ["main"]
86

9-
env:
10-
CARGO_TERM_COLOR: always
11-
127
jobs:
138
build-and-validate:
149
runs-on: windows-latest
15-
1610
strategy:
1711
matrix:
18-
toolchain: ["stable", "nightly"]
12+
include:
13+
- toolchain: stable
14+
RUSTDOCFLAGS: "-D warnings"
15+
DOCTYPE: "docrs"
16+
- toolchain: nightly
17+
RUSTDOCFLAGS: "-D warnings --cfg docsrs"
18+
DOCTYPE: "doc"
19+
20+
name: "Build and validate (${{ matrix.toolchain}})"
21+
env:
22+
CARGO_TERM_COLOR: always
23+
RUSTFLAGS: -D warnings
24+
RUSTDOCFLAGS: ${{ matrix.RUSTDOCFLAGS }}
1925

2026
steps:
2127
- name: Checkout Code
2228
uses: actions/checkout@v4
2329

30+
- name: Cache Cargo Registry
31+
uses: actions/cache@v3
32+
with:
33+
path: ~/.cargo/registry
34+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
35+
restore-keys: ${{ runner.os }}-cargo-registry-
36+
37+
- name: Cache Cargo Git Index
38+
uses: actions/cache@v3
39+
with:
40+
path: ~/.cargo/git
41+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
42+
restore-keys: ${{ runner.os }}-cargo-index-
43+
2444
- name: Install Rust (Matrix)
2545
shell: pwsh
2646
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
2747

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

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

42-
- name: Generate Documentation (Stable Only)
43-
if: matrix.toolchain == 'stable'
44-
run: cargo doc --no-deps
45-
46-
- name: Generate Documentation for Docs.rs (Nightly Only)
47-
if: matrix.toolchain == 'nightly'
48-
shell: pwsh
49-
run: |
50-
$env:RUSTDOCFLAGS = "--cfg docsrs"
51-
cargo +nightly doc --no-deps
62+
- name: Generate Documentation (${{ matrix.RUSTDOCFLAGS }}, ${{ matrix.toolchain }})
63+
run: cargo doc --no-deps --all-features
5264

5365
- name: Install and Run Security Audit (Nightly Only)
5466
if: matrix.toolchain == 'nightly'

wslplugins-rs/src/plugin/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn create_plugin_with_required_version<T: WSLPluginV1>(
6565
/// into a [windows::core::Error] using the `consume_error_message_unwrap` method.
6666
///
6767
/// # Arguments
68-
/// - `result`: A [Result<T>] using the custom [Error] type defined in this crate.
68+
/// - `result`: A [`Result<T>`] using the custom [Error] type defined in this crate.
6969
///
7070
/// # Returns
7171
/// A `WinResult<T>` where:
@@ -74,7 +74,7 @@ pub fn create_plugin_with_required_version<T: WSLPluginV1>(
7474
///
7575
/// # Behavior
7676
/// - If the `result` is `Ok`, it is returned as-is.
77-
/// - If the `result` is `Err`, the error is consumed using the
77+
/// - If the `result` is `Err`, the error is consumed
7878
/// and sent to WSL and is then
7979
/// converted into a [windows::core::Error].
8080
///

wslplugins-rs/src/wsl_user_configuration/bitflags.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
//! Provides a [bitflags] implementation for [WSLUserConfiguration] flags.
1+
//! Provides a [mod@bitflags] implementation for [WSLUserConfiguration] flags.
22
use super::WSLUserConfiguration;
33
use bitflags::bitflags;
44

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

0 commit comments

Comments
 (0)