From 2b01cd56d78af4c76aabc1fad6e1f0caddf682a4 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:28:45 -0400 Subject: [PATCH 01/19] proj: add .idea to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fe16237..bcb5522 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /target/ **/*.rs.bk Cargo.lock +/.idea From ddb1f28c6b3ca2227f02b8eaeee4230a30ccb567 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:29:37 -0400 Subject: [PATCH 02/19] ci: workflow name before triggers --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e5e5bd0..150a1f3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,7 +1,7 @@ -on: [push, pull_request] - name: Continuous integration +on: [push, pull_request] + jobs: check: name: Check From 26697e18f21638100a83606a8aa2f5e4f0ca2e30 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:29:54 -0400 Subject: [PATCH 03/19] ci: more 'on' triggers * Reformats to better support parameters. * Adds merge_group trigger for supporting queued merges. * Adds cron scheduled build. --- .github/workflows/rust.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 150a1f3..28eafe1 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,6 +1,11 @@ name: Continuous integration -on: [push, pull_request] +on: + push: + pull_request: + merge_group: + schedule: + - cron: '0 18 * * *' jobs: check: From 94bffd8bc3f09a3cc18f7b62cf8dc8beaf999666 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:30:35 -0400 Subject: [PATCH 04/19] ci: actions/checkout@v2/v1 -> v4 --- .github/workflows/clippy-check.yml | 2 +- .github/workflows/rust.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/clippy-check.yml b/.github/workflows/clippy-check.yml index 6010bf2..6e6b0d1 100644 --- a/.github/workflows/clippy-check.yml +++ b/.github/workflows/clippy-check.yml @@ -4,7 +4,7 @@ jobs: clippy_check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - run: rustup component add clippy - uses: actions-rs/clippy-check@v1 with: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 28eafe1..5a5da45 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,7 +18,7 @@ jobs: - 1.53.0 - nightly steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -34,7 +34,7 @@ jobs: name: Test Suite runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -48,7 +48,7 @@ jobs: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -64,7 +64,7 @@ jobs: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -82,7 +82,7 @@ jobs: env: RUSTDOCFLAGS: --cfg docsrs steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal From 9a5e37120ba8a70c4fc56a8809cee616cc9d159d Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:34:01 -0400 Subject: [PATCH 05/19] ci: replace actions-rs with dtolnay/rust-toolchain --- .github/workflows/rust.yml | 53 +++++++++----------------------------- 1 file changed, 12 insertions(+), 41 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5a5da45..21a58de 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,62 +19,40 @@ jobs: - nightly steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@master with: - profile: minimal toolchain: ${{ matrix.rust }} - override: true - name: Cargo update run: cargo update - - uses: actions-rs/cargo@v1 - with: - command: check + - run: cargo check test: name: Test Suite runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: test + - uses: dtolnay/rust-toolchain@stable + - run: cargo test fmt: name: Rustfmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 + - uses: dtolnay/rust-toolchain@stable with: - command: fmt - args: --all -- --check + components: rustfmt + - run: cargo fmt --all -- --check clippy: name: Clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + components: clippy + - run: cargo clippy -- -D warnings doc: name: Build documentation @@ -83,12 +61,5 @@ jobs: RUSTDOCFLAGS: --cfg docsrs steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - - uses: actions-rs/cargo@v1 - with: - command: doc - args: --workspace --no-deps --all-features + - uses: dtolnay/rust-toolchain@nightly + - run: cargo doc --workspace --no-deps --all-features From 8719c9cb90b408b8088ea8d77dde2d80a3a44841 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:34:52 -0400 Subject: [PATCH 06/19] ci: add rustsec/audit-check workflow --- .github/workflows/security-audit.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/security-audit.yml diff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.yml new file mode 100644 index 0000000..c8e58c0 --- /dev/null +++ b/.github/workflows/security-audit.yml @@ -0,0 +1,15 @@ +name: Security audit +on: + schedule: + - cron: "0 8 * * *" + push: + paths: + - "**/Cargo.*" +jobs: + security_audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: rustsec/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} From 0b9455b9c1164d3b3315c3154d3cda3a7e2ddc24 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:35:18 -0400 Subject: [PATCH 07/19] ci: remove clippy-check The `actions-rs/clippy-check` action is archived and there isn't a clear alternative. Since clippy is already being run in `rust.yml` the right fix seems to be removing this extra workflow. --- .github/workflows/clippy-check.yml | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .github/workflows/clippy-check.yml diff --git a/.github/workflows/clippy-check.yml b/.github/workflows/clippy-check.yml deleted file mode 100644 index 6e6b0d1..0000000 --- a/.github/workflows/clippy-check.yml +++ /dev/null @@ -1,12 +0,0 @@ -on: push -name: Clippy check -jobs: - clippy_check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: rustup component add clippy - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features From eb8dac2c3e669b2ae6ab13384a20d0d0eee56a2a Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:38:23 -0400 Subject: [PATCH 08/19] ci: update MSRV to 1.63.0 This better matches what other rusticata crates are using. --- .github/workflows/rust.yml | 2 +- Cargo.toml | 1 + README.md | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 21a58de..1a0a58d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,7 +15,7 @@ jobs: matrix: rust: - stable - - 1.53.0 + - 1.63.0 - nightly steps: - uses: actions/checkout@v4 diff --git a/Cargo.toml b/Cargo.toml index 350ff23..38b7258 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ authors = ["Pierre Chifflier "] readme = "README.md" categories = ["network-programming", "parser-implementations"] edition = "2018" +rust-version = "1.63" include = [ "CHANGELOG.md", diff --git a/README.md b/README.md index 7419a62..d4a390d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Crates.io Version](https://img.shields.io/crates/v/pcap-parser.svg)](https://crates.io/crates/pcap-parser) [![docs.rs](https://docs.rs/pcap-parser/badge.svg)](https://docs.rs/pcap-parser) [![Github CI](https://github.com/rusticata/pcap-parser/workflows/Continuous%20integration/badge.svg)](https://github.com/rusticata/pcap-parser/actions) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.53.0+-lightgray.svg)](#rust-version-requirements) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.63.0+-lightgray.svg)](#rust-version-requirements) # PCAP and PCAPNG parsers From eae1651261146454de7c2c9ada5f0f893169af21 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:39:20 -0400 Subject: [PATCH 09/19] proj: fix clippy::unused_imports findings Findings of the type: ``` warning: the item `AsMut` is imported redundantly --> src/utils.rs:1:20 | 1 | use std::convert::{AsMut, AsRef}; | ^^^^^ --> /rustc/a165f1f65015b1bd4afd2ec50700aaacf2e0c485/library/std/src/prelude/mod.rs:115:13 | = note: the item `AsMut` is already defined here | = note: `#[warn(unused_imports)]` on by default ``` --- src/blocks.rs | 1 - src/capture_pcap.rs | 2 +- src/utils.rs | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/blocks.rs b/src/blocks.rs index 8b6e6a7..ecf95f8 100644 --- a/src/blocks.rs +++ b/src/blocks.rs @@ -1,6 +1,5 @@ use crate::pcap::{LegacyPcapBlock, PcapHeader}; use crate::pcapng::Block; -use std::convert::From; /// A block from a Pcap or PcapNG file pub enum PcapBlockOwned<'a> { diff --git a/src/capture_pcap.rs b/src/capture_pcap.rs index 3b169eb..a1de8b6 100644 --- a/src/capture_pcap.rs +++ b/src/capture_pcap.rs @@ -9,7 +9,7 @@ use crate::traits::PcapReaderIterator; use circular::Buffer; use nom::combinator::complete; use nom::multi::many0; -use nom::{self, IResult, Needed, Offset}; +use nom::{IResult, Needed, Offset}; use std::fmt; use std::io::Read; diff --git a/src/utils.rs b/src/utils.rs index 45366f8..a1aa7c3 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,4 +1,3 @@ -use std::convert::{AsMut, AsRef}; use std::ops; use std::ops::{Deref, DerefMut}; From b789b383fe2137cf5ed309b9846f3b605dbe9ba9 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:40:22 -0400 Subject: [PATCH 10/19] proj: fix clippy::unused_qualifications findings Of the form: ``` error: unnecessary qualification --> src/error.rs:67:8 | 67 | I: std::fmt::Debug, | ^^^^^^^^^^^^^^^ | note: the lint level is defined here --> src/lib.rs:117:31 | 117 | unused_import_braces, unused_qualifications)] | ^^^^^^^^^^^^^^^^^^^^^ help: remove the unnecessary path segments | 67 - I: std::fmt::Debug, 67 + I: fmt::Debug, ``` --- src/error.rs | 4 ++-- src/pcapng.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/error.rs b/src/error.rs index 5a487ec..0fe20d0 100644 --- a/src/error.rs +++ b/src/error.rs @@ -64,7 +64,7 @@ impl ParseError for PcapError { impl fmt::Display for PcapError where - I: std::fmt::Debug, + I: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { @@ -82,4 +82,4 @@ where } } -impl std::error::Error for PcapError where I: std::fmt::Debug {} +impl std::error::Error for PcapError where I: fmt::Debug {} diff --git a/src/pcapng.rs b/src/pcapng.rs index c82a18c..265f2be 100644 --- a/src/pcapng.rs +++ b/src/pcapng.rs @@ -541,7 +541,7 @@ impl<'a, En: PcapEndianness> PcapNGBlockParser<'a, En, EnhancedPacketBlock<'a>> let origlen = En::u32_from_bytes(*array_ref4(b_hdr, 16)); // read packet data // align32 can overflow - if caplen >= ::std::u32::MAX - 4 { + if caplen >= std::u32::MAX - 4 { return Err(Err::Error(E::from_error_kind(i, ErrorKind::Verify))); } let padded_length = align32!(caplen); @@ -817,7 +817,7 @@ impl<'a, En: PcapEndianness> PcapNGBlockParser<'a, En, DecryptionSecretsBlock<'a let (i, secrets_len) = En::parse_u32(i)?; // read packet data // align32 can overflow - if secrets_len >= ::std::u32::MAX - 4 { + if secrets_len >= std::u32::MAX - 4 { return Err(Err::Error(E::from_error_kind(i, ErrorKind::Verify))); } let padded_length = align32!(secrets_len); @@ -1076,7 +1076,7 @@ where // read generic block layout // if i.len() < P::HDR_SZ { - return Err(nom::Err::Incomplete(nom::Needed::new(P::HDR_SZ - i.len()))); + return Err(Err::Incomplete(nom::Needed::new(P::HDR_SZ - i.len()))); } let (i, block_type) = le_u32(i)?; let (i, block_len1) = En::parse_u32(i)?; @@ -1154,7 +1154,7 @@ pub fn parse_sectionheaderblock_be( /// Parse a SectionHeaderBlock (little or big endian) pub fn parse_sectionheaderblock(i: &[u8]) -> IResult<&[u8], SectionHeaderBlock, PcapError<&[u8]>> { if i.len() < 12 { - return Err(nom::Err::Incomplete(nom::Needed::new(12 - i.len()))); + return Err(Err::Incomplete(nom::Needed::new(12 - i.len()))); } let bom = u32::from_le_bytes(*array_ref4(i, 8)); if bom == BOM_MAGIC { From 05bdfdc83baeacc582db92637a208653c1482130 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:44:58 -0400 Subject: [PATCH 11/19] proj: fix clippy::legacy_numeric_constants findings ``` error: usage of a legacy numeric constant --> src/pcapng.rs:544:22 | 544 | if caplen >= std::u32::MAX - 4 { | ^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants = note: `-D clippy::legacy-numeric-constants` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::legacy_numeric_constants)]` help: use the associated constant instead | 544 | if caplen >= u32::MAX - 4 { | ~~~~~~~~ ``` --- src/pcapng.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pcapng.rs b/src/pcapng.rs index 265f2be..a7bc458 100644 --- a/src/pcapng.rs +++ b/src/pcapng.rs @@ -541,7 +541,7 @@ impl<'a, En: PcapEndianness> PcapNGBlockParser<'a, En, EnhancedPacketBlock<'a>> let origlen = En::u32_from_bytes(*array_ref4(b_hdr, 16)); // read packet data // align32 can overflow - if caplen >= std::u32::MAX - 4 { + if caplen >= u32::MAX - 4 { return Err(Err::Error(E::from_error_kind(i, ErrorKind::Verify))); } let padded_length = align32!(caplen); @@ -817,7 +817,7 @@ impl<'a, En: PcapEndianness> PcapNGBlockParser<'a, En, DecryptionSecretsBlock<'a let (i, secrets_len) = En::parse_u32(i)?; // read packet data // align32 can overflow - if secrets_len >= std::u32::MAX - 4 { + if secrets_len >= u32::MAX - 4 { return Err(Err::Error(E::from_error_kind(i, ErrorKind::Verify))); } let padded_length = align32!(secrets_len); From af2d1deb7f5eb8fc3db0c0fbd2b45a202b3ff281 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:41:09 -0400 Subject: [PATCH 12/19] ci: deny warnings from cargo check --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1a0a58d..59be20a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,7 +24,7 @@ jobs: toolchain: ${{ matrix.rust }} - name: Cargo update run: cargo update - - run: cargo check + - run: RUSTFLAGS="-D warnings" cargo check test: name: Test Suite From 1f2a6f1990c8f96a32b058d867f5c1b01f9b917b Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:41:31 -0400 Subject: [PATCH 13/19] ci: use nightly for clippy --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 59be20a..5bde7d2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable + - uses: dtolnay/rust-toolchain@nightly with: components: clippy - run: cargo clippy -- -D warnings From 29714dec3e124ad76bd7e542662b8c3c4baae026 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:42:06 -0400 Subject: [PATCH 14/19] ci: add dependabot config --- .github/dependabot.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ce1ffcc --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +version: 2 +updates: +- package-ecosystem: cargo + directory: "/" + schedule: + interval: weekly + open-pull-requests-limit: 10 + groups: + crates-io: + patterns: + - "*" +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly From ea32aee576600f617ae81d5c9468e0e98284d5f2 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:42:24 -0400 Subject: [PATCH 15/19] ci: add cargo-semver-checks-action --- .github/workflows/rust.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5bde7d2..64ef82e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -63,3 +63,12 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly - run: cargo doc --workspace --no-deps --all-features + + semver: + name: Check semver compatibility + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Check semver + uses: obi1kenobi/cargo-semver-checks-action@v2 From 1a318ffd3264a258c38ce14a1ea8dd32661fb159 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:43:15 -0400 Subject: [PATCH 16/19] ci: add cargo-check-external-types --- .github/workflows/rust.yml | 14 ++++++++++++++ Cargo.toml | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 64ef82e..d696c68 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -72,3 +72,17 @@ jobs: uses: actions/checkout@v4 - name: Check semver uses: obi1kenobi/cargo-semver-checks-action@v2 + + check-external-types: + name: Validate external types appearing in public API + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Install rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2024-02-07 + # ^ sync with https://github.com/awslabs/cargo-check-external-types/blob/main/rust-toolchain.toml + - run: cargo install cargo-check-external-types + - run: cargo check-external-types diff --git a/Cargo.toml b/Cargo.toml index 38b7258..b8c6c58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,3 +51,10 @@ hex-literal = "0.4" [badges] travis-ci = { repository = "rusticata/pcap-parser" } + +[package.metadata.cargo_check_external_types] +allowed_external_types = [ + "nom", + "nom::*", + "circular::Buffer", +] From 8bb18f47eececb90eb297207227222cb6f7167bf Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:47:26 -0400 Subject: [PATCH 17/19] cargo: remove travis badge metadata --- Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b8c6c58..7bbcb70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,9 +49,6 @@ rusticata-macros = "4.0" [dev-dependencies] hex-literal = "0.4" -[badges] -travis-ci = { repository = "rusticata/pcap-parser" } - [package.metadata.cargo_check_external_types] allowed_external_types = [ "nom", From d222d26c1497297e7acbd9ebb4396853e4bdd45b Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 9 Apr 2024 18:48:10 -0400 Subject: [PATCH 18/19] ci: test/lint w/ more features * adds coverage for --all-features * adds coverage for --no-default-features --- .github/workflows/rust.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d696c68..59b0f60 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,6 +33,8 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - run: cargo test + - run: cargo test --all-features + - run: cargo test --no-default-features fmt: name: Rustfmt @@ -53,6 +55,8 @@ jobs: with: components: clippy - run: cargo clippy -- -D warnings + - run: cargo clippy --all-features -- -D warnings + - run: cargo clippy --no-default-features -- -D warnings doc: name: Build documentation From 403ec925b64fc58c335c670f72c5495680550b3d Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Thu, 11 Apr 2024 19:40:47 -0400 Subject: [PATCH 19/19] ci: use feature matrix for cargo test Adopts a similar feature matrix approach as the asn1-rs CI. `cargo test` will be run for no default features, default features, and all features. The asn1-rs matrix differs only by having a separate "no std" job that uses `--no-default-features`. Since this crate doesn't offer a std feature we roll this step into the same matrix as the other feature configs. --- .github/workflows/rust.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 59b0f60..fb51eda 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -29,12 +29,17 @@ jobs: test: name: Test Suite runs-on: ubuntu-latest + strategy: + matrix: + features: + - --no-default-features + - --features=default + - --all-features steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - run: cargo test - - run: cargo test --all-features - - run: cargo test --no-default-features + - name: Install stable toolchain + uses: dtolnay/rust-toolchain@stable + - run: cargo test ${{ matrix.features }} fmt: name: Rustfmt