From 0029f25e370bdde10e1883dd06bccd4611bad30f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Mon, 6 Jan 2025 13:44:22 +0100 Subject: [PATCH 1/4] Create rust.yml --- .github/workflows/rust.yml | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..1d946a1 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,57 @@ +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: + rust: ["stable", "nightly"] + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Install Rust (Matrix) + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + target: x86_64-pc-windows-msvc + override: true + + - name: Lint with Clippy (Stable Only) + if: matrix.rust == 'stable' + uses: actions-rs/clippy@v1 + + - name: Check Code Formatting (Stable Only) + if: matrix.rust == 'stable' + uses: actions-rs/rustfmt@v1 + + - name: Build the Project + run: cargo build --verbose + + - name: Run Tests + run: cargo test --verbose + + - name: Generate Documentation (Stable Only) + if: matrix.rust == 'stable' + run: cargo doc --no-deps + + - name: Generate Documentation for Docs.rs (Nightly Only) + if: matrix.rust == 'nightly' + run: | + RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps + + - name: Run Security Audit (Nightly Only) + if: matrix.rust == 'nightly' + run: cargo audit From 4cfdff21c67d33466bfff41889579ab66492018c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Mon, 6 Jan 2025 17:01:24 +0100 Subject: [PATCH 2/4] Fix ci --- .github/workflows/rust.yml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1d946a1..7c78ec6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,9 +2,9 @@ name: Rust CI for WSLPlugins-rs on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] env: CARGO_TERM_COLOR: always @@ -22,20 +22,15 @@ jobs: uses: actions/checkout@v4 - name: Install Rust (Matrix) - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - target: x86_64-pc-windows-msvc - override: true + run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - name: Lint with Clippy (Stable Only) if: matrix.rust == 'stable' - uses: actions-rs/clippy@v1 + run: cargo clippy --all-targets --all-features -- -D warnings - name: Check Code Formatting (Stable Only) if: matrix.rust == 'stable' - uses: actions-rs/rustfmt@v1 + run: cargo fmt -- --check - name: Build the Project run: cargo build --verbose @@ -50,8 +45,4 @@ jobs: - name: Generate Documentation for Docs.rs (Nightly Only) if: matrix.rust == 'nightly' run: | - RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps - - - name: Run Security Audit (Nightly Only) - if: matrix.rust == 'nightly' - run: cargo audit + RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps \ No newline at end of file From 081b52be0effe288c2f68039df9b386226dbb6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Mon, 6 Jan 2025 17:34:50 +0100 Subject: [PATCH 3/4] Fix powershell env --- .github/workflows/rust.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7c78ec6..1d431b3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,7 +22,12 @@ jobs: uses: actions/checkout@v4 - name: Install Rust (Matrix) - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + target: x86_64-pc-windows-msvc + override: true - name: Lint with Clippy (Stable Only) if: matrix.rust == 'stable' @@ -44,5 +49,13 @@ jobs: - name: Generate Documentation for Docs.rs (Nightly Only) if: matrix.rust == 'nightly' + shell: pwsh run: | - RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps \ No newline at end of file + $env:RUSTDOCFLAGS = "--cfg docsrs" + cargo +nightly doc --no-deps + + - name: Install and Run Security Audit (Nightly Only) + if: matrix.rust == 'nightly' + run: | + cargo install cargo-audit + cargo audit From 3c4e8f9e465ee1515971cb28ff88308b5fccd8f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Mon, 6 Jan 2025 17:41:10 +0100 Subject: [PATCH 4/4] Remove archived action --- .github/workflows/rust.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1d431b3..af1a1c9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,26 +15,22 @@ jobs: strategy: matrix: - rust: ["stable", "nightly"] + toolchain: ["stable", "nightly"] steps: - name: Checkout Code uses: actions/checkout@v4 - name: Install Rust (Matrix) - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - target: x86_64-pc-windows-msvc - override: true + shell: pwsh + run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - name: Lint with Clippy (Stable Only) - if: matrix.rust == 'stable' + if: matrix.toolchain == 'stable' run: cargo clippy --all-targets --all-features -- -D warnings - name: Check Code Formatting (Stable Only) - if: matrix.rust == 'stable' + if: matrix.toolchain == 'stable' run: cargo fmt -- --check - name: Build the Project @@ -44,18 +40,18 @@ jobs: run: cargo test --verbose - name: Generate Documentation (Stable Only) - if: matrix.rust == 'stable' + if: matrix.toolchain == 'stable' run: cargo doc --no-deps - name: Generate Documentation for Docs.rs (Nightly Only) - if: matrix.rust == 'nightly' + 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.rust == 'nightly' + if: matrix.toolchain == 'nightly' run: | cargo install cargo-audit cargo audit