diff --git a/.github/workflows/clippy-check.yml b/.github/workflows/clippy-check.yml deleted file mode 100644 index 6010bf2..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@v1 - - run: rustup component add clippy - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 04f20d7..31e5840 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,8 +1,26 @@ -on: [push, pull_request] - name: Continuous integration +on: + push: + pull_request: + merge_group: + schedule: + - cron: '0 18 * * *' + jobs: + pre_commit: + timeout-minutes: 5 + name: prek + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + # tools used in pre-commit hooks + - id: cargo-rdme + uses: rusticata/ci-action-rdme@v1 + # /tools + - id: prek + uses: rusticata/ci-action-prek@v1 + check: name: Check runs-on: ubuntu-latest @@ -13,63 +31,53 @@ jobs: - 1.63.0 - nightly steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v5 + - name: Install ${{ matrix.rust }} toolchain + 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: RUSTFLAGS="-D warnings" cargo check test: name: Test Suite runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: test + - uses: actions/checkout@v5 + - name: Install stable toolchain + uses: dtolnay/rust-toolchain@stable + - run: cargo test fmt: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v5 + - name: Install stable rustfmt + uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + components: rustfmt + - run: cargo fmt --all -- --check clippy: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 + - uses: actions/checkout@v5 + - name: Install nightly clippy + uses: dtolnay/rust-toolchain@nightly with: - command: clippy - args: -- -D warnings + components: clippy + - run: cargo clippy -- -D warnings + + readme: + name: Check if README is up to date + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - id: cargo-rdme + uses: rusticata/ci-action-rdme@v1 doc: name: Build documentation @@ -77,13 +85,7 @@ jobs: env: RUSTDOCFLAGS: --cfg docsrs steps: - - uses: actions/checkout@v2 - - 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: actions/checkout@v5 + - name: Install nightly rust + uses: dtolnay/rust-toolchain@nightly + - run: cargo doc --workspace --no-deps --all-features diff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.yml index 7641204..fcd4046 100644 --- a/.github/workflows/security-audit.yml +++ b/.github/workflows/security-audit.yml @@ -9,7 +9,7 @@ jobs: security_audit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v5 - uses: actions-rs/audit-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7518fca --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,40 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +fail_fast: true + +exclude: | + (?x)^( + .*/(assets)/.*| + )$ + +repos: + - repo: 'https://github.com/pre-commit/pre-commit-hooks' + rev: v6.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + + - repo: local + hooks: + - id: cargo-fmt + name: cargo fmt + entry: cargo fmt -- + language: system + types: [rust] + pass_filenames: false # This makes it a lot faster + + - id: cargo-clippy + name: cargo clippy + language: system + types: [rust] + pass_filenames: false + entry: cargo clippy --all-targets --all-features -- -D warnings + + - id: cargo-rdme + name: cargo rdme + language: system + types: [rust] + pass_filenames: false + entry: cargo rdme -c diff --git a/README.md b/README.md index eda0934..d14a143 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ -# ipsec-parser - +![Maintenance](https://img.shields.io/badge/maintenance-activly--developed-brightgreen.svg) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE-MIT) [![Apache License 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](./LICENSE-APACHE) [![Build Status](https://travis-ci.org/rusticata/ipsec-parser.svg?branch=master)](https://travis-ci.org/rusticata/ipsec-parser) - + # IPsec parsers @@ -60,7 +59,7 @@ fn test_ikev2_init_resp() { } ``` - + ## Changelog