From e196ed0d4765ec5ae98fe2c32d040f1544e88c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Fri, 10 Jan 2025 20:40:29 +0100 Subject: [PATCH 1/7] Try to improve CI --- .github/workflows/{rust.yml => code.yml} | 3 +- .github/workflows/docs.yml | 39 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) rename .github/workflows/{rust.yml => code.yml} (94%) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/code.yml similarity index 94% rename from .github/workflows/rust.yml rename to .github/workflows/code.yml index af1a1c9..4157804 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/code.yml @@ -8,6 +8,7 @@ on: env: CARGO_TERM_COLOR: always + RUSTFLAGS: -D warnings jobs: build-and-validate: @@ -27,7 +28,7 @@ jobs: - 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' diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..e666dfa --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,39 @@ +name: Rust CI for WSLPlugins-rs + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +env: + CARGO_TERM_COLOR: always + RUSTFLAGS: -D warnings + +jobs: + build-and-validate: + runs-on: windows-latest + + strategy: + matrix: + include: + - toolchain: stable + RUSTDOCFLAGS: "-D warnings" + - toolchain: nightly + RUSTDOCFLAGS: "-D warnings --cfg docsrs" + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Install Rust (Matrix) + shell: pwsh + run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} + + - name: Run Doc Tests + run: cargo test --docs + + - name: Generate Documentation + env: + RUSTDOCFLAGS: ${{ matrix.RUSTDOCFLAGS }} + run: cargo doc --no-deps From 5cebee7ae183f15a599bdd68451ab3fd602035ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Fri, 10 Jan 2025 22:19:08 +0100 Subject: [PATCH 2/7] Update code.yml title --- .github/workflows/code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 4157804..ba11332 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -1,4 +1,4 @@ -name: Rust CI for WSLPlugins-rs +name: Rust CI for WSLPlugins-rs code on: push: From 63b514569d518bff6e7a53a3080ba1b4693c5db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Fri, 10 Jan 2025 22:19:41 +0100 Subject: [PATCH 3/7] Update docs.yml title --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e666dfa..3f0f13f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,4 +1,4 @@ -name: Rust CI for WSLPlugins-rs +name: Rust CI for WSLPlugins-rs docs on: push: From b6f559784db0dadf02e824a6bf1e543dc73a3295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Fri, 10 Jan 2025 22:25:17 +0100 Subject: [PATCH 4/7] Update docs.yml fix typo --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 3f0f13f..866227b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -31,7 +31,7 @@ jobs: run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - name: Run Doc Tests - run: cargo test --docs + run: cargo test --doc - name: Generate Documentation env: From a038c2a869737bd1f6e2f8e176300e06b57d3ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Sat, 11 Jan 2025 13:02:04 +0100 Subject: [PATCH 5/7] Restore old file and improve it --- .github/workflows/code.yml | 58 --------------- .github/workflows/docs.yml | 39 ----------- .github/workflows/rust.yml | 70 +++++++++++++++++++ wslplugins-rs/src/plugin/utils.rs | 4 +- .../src/wsl_user_configuration/bitflags.rs | 4 +- 5 files changed, 74 insertions(+), 101 deletions(-) delete mode 100644 .github/workflows/code.yml delete mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml deleted file mode 100644 index ba11332..0000000 --- a/.github/workflows/code.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Rust CI for WSLPlugins-rs code - -on: - push: - branches: ["main"] - pull_request: - branches: ["main"] - -env: - CARGO_TERM_COLOR: always - RUSTFLAGS: -D warnings - -jobs: - build-and-validate: - runs-on: windows-latest - - strategy: - matrix: - toolchain: ["stable", "nightly"] - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - - - 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 - - - name: Check Code Formatting (Stable Only) - if: matrix.toolchain == 'stable' - run: cargo fmt -- --check - - - name: Build the Project - run: cargo build --verbose - - - 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: Install and Run Security Audit (Nightly Only) - if: matrix.toolchain == 'nightly' - run: | - cargo install cargo-audit - cargo audit diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 866227b..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Rust CI for WSLPlugins-rs docs - -on: - push: - branches: ["main"] - pull_request: - branches: ["main"] - -env: - CARGO_TERM_COLOR: always - RUSTFLAGS: -D warnings - -jobs: - build-and-validate: - runs-on: windows-latest - - strategy: - matrix: - include: - - toolchain: stable - RUSTDOCFLAGS: "-D warnings" - - toolchain: nightly - RUSTDOCFLAGS: "-D warnings --cfg docsrs" - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - - - name: Install Rust (Matrix) - shell: pwsh - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - - - name: Run Doc Tests - run: cargo test --doc - - - name: Generate Documentation - env: - RUSTDOCFLAGS: ${{ matrix.RUSTDOCFLAGS }} - run: cargo doc --no-deps diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..deadd36 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,70 @@ +name: Rust CI for WSLPlugins-rs + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + build-and-validate: + runs-on: windows-latest + + strategy: + matrix: + include: + - toolchain: stable + RUSTDOCFLAGS: "-D warnings" + DOCTYPE: "docrs" + - toolchain: nightly + RUSTDOCFLAGS: "-D warnings --cfg docsrs" + DOCTYPE: "doc" + 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 + + - name: Check Code Formatting (Stable Only) + if: matrix.toolchain == 'stable' + run: cargo fmt -- --check + + - name: Build the Project + run: cargo build --verbose + + - name: Run Tests + run: cargo test --verbose + + - 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' + run: | + cargo install cargo-audit + cargo audit diff --git a/wslplugins-rs/src/plugin/utils.rs b/wslplugins-rs/src/plugin/utils.rs index 882d714..3e9257a 100644 --- a/wslplugins-rs/src/plugin/utils.rs +++ b/wslplugins-rs/src/plugin/utils.rs @@ -65,7 +65,7 @@ pub fn create_plugin_with_required_version( /// into a [windows::core::Error] using the `consume_error_message_unwrap` method. /// /// # Arguments -/// - `result`: A [Result] using the custom [Error] type defined in this crate. +/// - `result`: A [`Result`] using the custom [Error] type defined in this crate. /// /// # Returns /// A `WinResult` where: @@ -74,7 +74,7 @@ pub fn create_plugin_with_required_version( /// /// # 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]. /// diff --git a/wslplugins-rs/src/wsl_user_configuration/bitflags.rs b/wslplugins-rs/src/wsl_user_configuration/bitflags.rs index 32c89ec..c100abe 100644 --- a/wslplugins-rs/src/wsl_user_configuration/bitflags.rs +++ b/wslplugins-rs/src/wsl_user_configuration/bitflags.rs @@ -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. From 4b8e91d252cffa8a2aa00c5b854a512ad67b5a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Sat, 11 Jan 2025 13:15:08 +0100 Subject: [PATCH 6/7] Fix name --- .github/workflows/rust.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index deadd36..633e768 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -9,7 +9,6 @@ on: jobs: build-and-validate: runs-on: windows-latest - strategy: matrix: include: @@ -19,6 +18,8 @@ jobs: - toolchain: nightly RUSTDOCFLAGS: "-D warnings --cfg docsrs" DOCTYPE: "doc" + + name: "Build and validate on toolchain ${{ matrix.toolchain}}" env: CARGO_TERM_COLOR: always RUSTFLAGS: -D warnings From 16bee8b4326a8053af108ca3324897c3e73695d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Sat, 11 Jan 2025 13:25:08 +0100 Subject: [PATCH 7/7] Simplify name --- .github/workflows/rust.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 633e768..14af2fd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,5 +1,3 @@ -name: Rust CI for WSLPlugins-rs - on: push: branches: ["main"] @@ -19,7 +17,7 @@ jobs: RUSTDOCFLAGS: "-D warnings --cfg docsrs" DOCTYPE: "doc" - name: "Build and validate on toolchain ${{ matrix.toolchain}}" + name: "Build and validate (${{ matrix.toolchain}})" env: CARGO_TERM_COLOR: always RUSTFLAGS: -D warnings