fix: mitigate CBOR resource exhaustion risks #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUSTFLAGS: -Dwarnings | |
| jobs: | |
| test: | |
| name: test (${{ matrix.toolchain }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| toolchain: [stable, "1.85"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.toolchain }} | |
| - run: cargo build --workspace --all-targets --all-features | |
| - run: cargo test --workspace --all-targets --all-features | |
| feature-tests: | |
| name: feature tests (${{ matrix.name }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: default | |
| command: cargo test -p cbor2 --all-targets | |
| - name: derive | |
| command: cargo test -p cbor2 --all-targets --features derive | |
| - name: futures | |
| command: cargo test -p cbor2 --all-targets --features futures | |
| - name: tokio | |
| command: cargo test -p cbor2 --all-targets --features tokio | |
| - name: futures+tokio | |
| command: cargo test -p cbor2 --all-targets --features futures,tokio | |
| - name: no-default-futures+tokio | |
| command: cargo test -p cbor2 --lib --no-default-features --features futures,tokio | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - run: ${{ matrix.command }} | |
| no-std: | |
| name: no_std (${{ matrix.name }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: core | |
| feature_args: "" | |
| - name: alloc | |
| feature_args: "--features alloc" | |
| - name: alloc,derive | |
| feature_args: "--features alloc,derive" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| targets: thumbv7em-none-eabihf | |
| # A bare-metal target proves no std dependency leaks in; the host | |
| # build runs the feature-gated unit tests. | |
| - run: cargo build --no-default-features ${{ matrix.feature_args }} --target thumbv7em-none-eabihf | |
| - run: cargo test --lib --no-default-features ${{ matrix.feature_args }} | |
| - run: cargo clippy --no-default-features ${{ matrix.feature_args }} -- -Dwarnings | |
| lint: | |
| name: rustfmt and clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - run: cargo fmt --all --check | |
| - run: cargo clippy --workspace --all-targets --all-features -- -Dwarnings | |
| docs: | |
| name: docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - run: cargo doc --no-deps --all-features | |
| env: | |
| RUSTDOCFLAGS: -Dwarnings |