diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..3644720 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,54 @@ +name: Lint + +on: + push: + branches: ["master"] + paths-ignore: + - "**/README.md" + pull_request: + paths-ignore: + - "**/README.md" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + RUSTC_WRAPPER: sccache + SCCACHE_GHA_ENABLED: true + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Cache cargo registry & git sources + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.os }}-cargo-lint- + ${{ runner.os }}-cargo- + + - name: Run sccache + uses: mozilla-actions/sccache-action@v0.0.5 + + - name: Install toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: 1.78.0 + components: rustfmt, clippy + + - name: Check format + run: cargo fmt --all -- --check + + - name: Check clippy + run: cargo clippy --all-targets --all-features -- -D warnings diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 57d63e8..25fefea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,32 +6,46 @@ on: paths-ignore: - "**/README.md" pull_request: - branches: ["master"] - -env: - CARGO_TERM_COLOR: always + paths-ignore: + - "**/README.md" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +env: + CARGO_TERM_COLOR: always + RUSTC_WRAPPER: sccache + SCCACHE_GHA_ENABLED: true + jobs: build: runs-on: ubuntu-latest steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Cache cargo registry & git sources + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.os }}-cargo-test- + ${{ runner.os }}-cargo- + + - name: Run sccache + uses: mozilla-actions/sccache-action@v0.0.5 + - name: Install toolchain uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly-2024-02-09 + toolchain: 1.78.0 components: rustfmt, clippy - - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Check format - run: cargo +nightly-2024-02-09 fmt --all -- --check - - name: Check clippy - run: cargo +nightly-2024-02-09 clippy --all-targets --all-features -- -D warnings - - name: Build - run: cargo build --verbose + - name: Run tests run: cargo test --verbose diff --git a/.rustfmt.toml b/.rustfmt.toml index 14f3e14..6953a45 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,6 +1,2 @@ reorder_imports = true max_width = 120 - -ignore = [ - "vendor/*", -] \ No newline at end of file