From ff55c352b5623c2c6daa8b8c8414439e008f1ad3 Mon Sep 17 00:00:00 2001 From: Arne Beer Date: Tue, 28 Nov 2023 20:27:55 +0100 Subject: [PATCH 1/2] add: CI workflows and issue templates --- .github/ISSUE_TEMPLATE/bug_report.yml | 77 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 56 ++++++++++++++++ .github/dependabot.yml | 7 +- .github/workflows/coverage.yml | 16 ++--- .github/workflows/{style.yml => lint.yml} | 2 +- .github/workflows/test.yml | 46 +++++++------ 6 files changed, 173 insertions(+), 31 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml rename .github/workflows/{style.yml => lint.yml} (98%) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..2f7ecad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,77 @@ +name: Bug Report 🐛 +description: Create a report to help improve the project +labels: ["t: bug"] +title: "[Bug]" + +body: + - type: markdown + attributes: + value: | + Please take the time to fill out all relevant the fields below. + + - type: textarea + id: description-of-bug + attributes: + label: Describe the bug + description: A clear and concise description of the bug. + placeholder: | + Description goes here :) + validations: + required: true + + - type: textarea + id: steps-to-reproduce + attributes: + label: Steps to reproduce + description: | + Please add a code example on how to trigger the bug. + Or even better, a link to a repository with a minimal reproducible setup to reproduce the bug. + placeholder: | + ``` + use libwifi::*; + ``` + The import doesn't work! + validations: + required: true + + - type: textarea + id: debug-output + attributes: + label: Logs (if applicable) + description: | + This is mostly important for crashes or panics. + Logs helps me to debug a problem if the bug is something that's not clearly visible. + placeholder: | + ``` + Some log output here + ``` + validations: + required: false + + - type: input + id: operating-system + attributes: + label: Operating system + description: The operating system you're using. + placeholder: iOS 8 / Windows 10 / Ubuntu 22.04 + validations: + required: true + + - type: input + id: version + attributes: + label: libwifi version + description: The current version you're using. + placeholder: v0.1.0 + validations: + required: true + + - type: textarea + id: additional-context + attributes: + label: Additional context + description: Add any other context about the problem here. + placeholder: | + Anything else you want to add. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..7293fbc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,56 @@ +name: Feature request +description: Suggest an idea for this project +labels: ["t: feature"] + +body: + - type: markdown + attributes: + value: | + Please take the time to fill out all relevant the fields below. + + - type: textarea + id: feature + attributes: + label: A detailed description of the feature you would like to see added. + description: | + Explain how that feature would look like and how it should behave. + placeholder: | + Description + validations: + required: true + + - type: textarea + id: user-story + attributes: + label: Explain your usecase of the requested feature + description: | + I need to know what a feature is going to be used for, before I can decide if and how it's going to be implemented. + + The more information you provide, the better I understand your problem ;). + placeholder: | + User story + validations: + required: true + + - type: textarea + id: alternatives + attributes: + label: Alternatives + description: | + If your problem can be solved in multiple ways, I would like to hear the possible alternatives you've considered. + + Some problems really don't have any feasible alternatives, in that case don't bother answering this question :) + placeholder: | + Alternatives + validations: + required: false + + - type: textarea + id: additional-context + attributes: + label: Additional context + description: Add any other context about the problem here. + placeholder: | + Anything else you want to add, such as sketches, example code, etc. + validations: + required: false diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8ef5278..08579a0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,11 @@ version: 2 updates: -- package-ecosystem: cargo +- package-ecosystem: github-actions directory: "/" schedule: interval: daily -- package-ecosystem: github-actions + +- package-ecosystem: cargo directory: "/" schedule: - interval: daily + interval: weekly diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 30f07dd..408deb9 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -4,15 +4,17 @@ on: push: branches: [main] paths: - - '.github/**/*' + - '.github/workflows/coverage.yml' - '**.rs' - 'Cargo.toml' + - 'Cargo.lock' pull_request: branches: [main] paths: - - '.github/**/*' + - '.github/workflows/coverage.yml' - '**.rs' - 'Cargo.toml' + - 'Cargo.lock' jobs: coverage: @@ -20,14 +22,12 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout sources - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v4 - name: Setup Rust toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - override: true components: llvm-tools-preview - name: Install cargo-llvm-cov @@ -40,4 +40,4 @@ jobs: uses: codecov/codecov-action@v3 with: files: lcov.info - fail_ci_if_error: true + fail_ci_if_error: false diff --git a/.github/workflows/style.yml b/.github/workflows/lint.yml similarity index 98% rename from .github/workflows/style.yml rename to .github/workflows/lint.yml index ae61616..b85fb1e 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: Code Style +name: Lint on: push: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 01947ba..b4cbdf2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,43 +4,51 @@ on: push: branches: [main] paths: - - '.github/**/*' - - '**.rs' - - 'Cargo.toml' + - ".github/workflows/test.yml" + - "**.rs" + - "Cargo.toml" + - "Cargo.lock" pull_request: branches: [main] paths: - - '.github/**/*' - - '**.rs' - - 'Cargo.toml' + - ".github/workflows/test.yml" + - "**.rs" + - "Cargo.toml" + - "Cargo.lock" jobs: test: - name: Tests on ${{ matrix.os }} for ${{ matrix.toolchain }} + name: Test target ${{ matrix.target }} on ${{ matrix.os }} for ${{ matrix.toolchain }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - toolchain: [stable] + target: + - x86_64-unknown-linux-gnu + - x86_64-pc-windows-msvc + - x86_64-apple-darwin + toolchain: [stable, nightly, "1.70"] + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + - target: x86_64-pc-windows-msvc + os: windows-latest + - target: x86_64-apple-darwin + os: macos-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Rust toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: - profile: minimal + targets: ${{ matrix.target }} toolchain: ${{ matrix.toolchain }} - override: true components: rustfmt, clippy - name: cargo build - uses: actions-rs/cargo@v1 - with: - command: build + run: cargo build --target=${{ matrix.target }} - name: cargo test - uses: actions-rs/cargo@v1 - with: - command: test + run: cargo test --target=${{ matrix.target }} From a019f53ae41511185887788ed957f0e057f51d40 Mon Sep 17 00:00:00 2001 From: Arne Beer Date: Tue, 28 Nov 2023 20:30:18 +0100 Subject: [PATCH 2/2] fix: Clippy lint --- libwifi/src/parsers/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libwifi/src/parsers/mod.rs b/libwifi/src/parsers/mod.rs index b60bcde..e451eae 100644 --- a/libwifi/src/parsers/mod.rs +++ b/libwifi/src/parsers/mod.rs @@ -18,7 +18,7 @@ fn flag_is_set(data: u8, bit: usize) -> bool { } } -pub(self) fn flag((input, bit_offset): (&[u8], usize)) -> IResult<(&[u8], usize), bool> { +fn flag((input, bit_offset): (&[u8], usize)) -> IResult<(&[u8], usize), bool> { if input.is_empty() { return Err(nom::Err::Incomplete(Needed::new(1))); }