diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-09-29 14:44:47 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-09-29 14:44:47 +0200 |
| commit | f2d3b7b4ae6345c8579008c9deb3e63ba50997af (patch) | |
| tree | ad2f99c245f7ee9278eed65bef0180c1b4ab0683 | |
| parent | cf5358473839638940dcf43f83fe3afe298cf112 (diff) | |
| download | ele-f2d3b7b4ae6345c8579008c9deb3e63ba50997af.tar.gz ele-f2d3b7b4ae6345c8579008c9deb3e63ba50997af.zip | |
Declare tested Rust minimum and add release CI checks
| -rw-r--r-- | .github/workflows/ci.yml | 55 | ||||
| -rw-r--r-- | Cargo.toml | 7 | ||||
| -rw-r--r-- | README.md | 23 |
3 files changed, 82 insertions, 3 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0285c9d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + test: + name: Test (${{ matrix.os }}, Rust ${{ matrix.rust }}) + runs-on: ${{ matrix.os }} + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + rust: ["1.88.0", stable] + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + persist-credentials: false + - name: Install Rust + run: rustup toolchain install ${{ matrix.rust }} --profile minimal + - name: Test default dependencies + run: cargo +${{ matrix.rust }} test --locked + - name: Test arbitrary-precision JSON compatibility + run: cargo +${{ matrix.rust }} test --locked --features serde_json/arbitrary_precision + - name: Test release build + run: cargo +${{ matrix.rust }} test --release --locked + + quality: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + persist-credentials: false + - name: Install Rust tools + run: rustup toolchain install stable --profile minimal --component rustfmt --component clippy + - name: Check formatting + run: cargo +stable fmt --all -- --check + - name: Check lints + run: cargo +stable clippy --all-targets --locked -- -D warnings + - name: Check feature compatibility lints + run: cargo +stable clippy --all-targets --locked --features serde_json/arbitrary_precision -- -D warnings + - name: Verify package + run: cargo +stable package --locked + - name: Test packaged crate + shell: bash + run: | + package=$(cargo +stable metadata --no-deps --format-version 1 | python3 -c 'import json, sys; p = json.load(sys.stdin)["packages"][0]; print(p["name"] + "-" + p["version"])') + cargo +stable test --locked --manifest-path "target/package/$package/Cargo.toml" @@ -2,6 +2,13 @@ name = "aip_filter" version = "0.1.0" edition = "2024" +rust-version = "1.88" +description = "AIP-160-style filtering for Rust values and newline-delimited JSON" +repository = "https://github.com/tetsuo/aip-filter" +documentation = "https://docs.rs/aip_filter" +readme = "README.md" +keywords = ["aip-160", "filter", "json", "cli"] +categories = ["command-line-utilities", "parser-implementations"] [dependencies] regex = "1" @@ -1,13 +1,13 @@ # aip-filter -Parses and evaluates [AIP-160](https://google.aip.dev/160) filter expressions. +Parses and evaluates an [AIP-160](https://google.aip.dev/160)-style filter language for JSON and Rust values. ## Install -Clone the repository and install it with Cargo: +Rust 1.88 or newer is required. Clone the repository and install it with Cargo: ```bash -cargo install --path . +cargo install --path . --locked ``` ## CLI usage @@ -39,6 +39,10 @@ usage: aip-filter [-p|--print] [--max-record-bytes N] [--] <expr> [file...] * The CLI compiles filters before reading records. Regexes, numeric literals, and field paths are reused across records. Filters can contain at most 32 regexes; each regex has a 1 MiB compiled-size limit and a 256 KiB DFA cache limit. * Filters are limited to 64 KiB, 512 non-whitespace tokens, 64 recursive parser calls, and an expression tree of at most 128 levels and 512 nodes. Excessive filters return errors instead of recursing without a bound. +### Compatibility + +This is a schema-free evaluator, not a complete implementation of a typed AIP-160 API. Missing fields are non-matches, and operand types are determined from each record. There is no schema validation, timestamp or duration type, or function registry. Regex operators, quoted left-hand literals, boolean field shorthand, and list equality are extensions. The matching rules above define the supported behavior. + ### Examples ```bash @@ -57,6 +61,19 @@ echo '{"user": {"settings": {"theme": "dark"}}}' | \ aip-filter "user.settings.theme = dark" ``` +## Development and release checks + +```bash +cargo fmt --all -- --check +cargo clippy --all-targets --locked -- -D warnings +cargo test --locked +cargo test --locked --features serde_json/arbitrary_precision +cargo test --release --locked +cargo package --locked +``` + +CI checks Rust 1.88 and stable Rust on Linux, macOS, and Windows. The quality job also checks formatting, linting, and the packaged crate. Do not tag or publish until the hosted CI checks are complete. + ## Performance Release builds optimize for speed rather than minimum executable size. The evaluator reuses compiled regexes and literals, borrows JSON collections, and searches overlapping phrases in linear time. JSON parsing still allocates memory for each record. |
