Skip to content

Commit

Permalink
ci: test all parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma-s1n committed Jun 3, 2024
1 parent b910bbc commit 40659ed
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,43 @@ env:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
- strace-parser: [combinator, peg, regex]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- run: cargo build --verbose
- run: cargo build --no-default-features --features strace-parser-${{matrix.strace-parser}} --verbose

test:
runs-on: ubuntu-latest
strategy:
matrix:
- strace-parser: [combinator, peg, regex]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- run: cargo test --bins --verbose
- run: cargo test --bins --no-default-features --features strace-parser-${{matrix.strace-parser}} --verbose

clippy:
runs-on: ubuntu-latest
strategy:
matrix:
- strace-parser: [combinator, peg, regex]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
- run: cargo clippy -- -D warnings
- run: cargo clippy --no-default-features --features strace-parser-${{matrix.strace-parser}} -- -D warnings

fmt:
runs-on: ubuntu-latest
Expand Down
9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ predicates = { version = "3.0.3", default-features = false, features = ["color"]
pretty_assertions = { version = "1.4.0", default-features = false, features = ["std"] }

[features]
default = ["parser-combinator"]
default = ["strace-parser-combinator"]
as-root = [] # for tests only
nightly = [] # for benchmarks only
parser-combinator = ["dep:function_name", "dep:nom"]
parser-peg = ["dep:pest", "dep:pest_derive"]
parser-regex = []
function_name = ["dep:function_name"]
strace-parser-combinator = ["dep:function_name", "dep:nom"]
strace-parser-peg = ["dep:pest", "dep:pest_derive"]
strace-parser-regex = []

[lints.rust]
missing_docs = "warn"
Expand Down
12 changes: 6 additions & 6 deletions src/strace/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ use std::{

use crate::strace::Syscall;

#[cfg(feature = "parser-combinator")]
#[cfg(feature = "strace-parser-combinator")]
mod combinator;
#[cfg(feature = "parser-peg")]
#[cfg(feature = "strace-parser-peg")]
mod peg;
#[cfg(feature = "parser-regex")]
#[cfg(feature = "strace-parser-regex")]
mod regex;

#[cfg(feature = "parser-combinator")]
#[cfg(feature = "strace-parser-combinator")]
use combinator::parse_line;
#[cfg(feature = "parser-peg")]
#[cfg(feature = "strace-parser-peg")]
use peg::parse_line;
#[cfg(feature = "parser-regex")]
#[cfg(feature = "strace-parser-regex")]
use regex::parse_line;

pub struct LogParser {
Expand Down

0 comments on commit 40659ed

Please sign in to comment.