From 5997568a10afc8e44d00b287fd937fdfcab467a1 Mon Sep 17 00:00:00 2001 From: Slesarev Date: Thu, 29 Feb 2024 00:22:16 +0200 Subject: [PATCH] ci: init --- .github/dependabot.yml | 12 ++++++++ .github/workflows/rust-cargo-deny.yml | 29 ++++++++++++++++++ .github/workflows/rust-clippy.yml | 38 +++++++++++++++++++++++ .github/workflows/rust-fmt.yml | 35 +++++++++++++++++++++ .github/workflows/rust-test.yml | 44 +++++++++++++++++++++++++++ .github/workflows/semantic.yml | 36 ++++++++++++++++++++++ 6 files changed, 194 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/rust-cargo-deny.yml create mode 100644 .github/workflows/rust-clippy.yml create mode 100644 .github/workflows/rust-fmt.yml create mode 100644 .github/workflows/rust-test.yml create mode 100644 .github/workflows/semantic.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..347d75c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: + - package-ecosystem: "cargo" + directory: "/" + labels: ["dependabot"] + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + labels: ["dependabot-ci"] + schedule: + interval: "weekly" diff --git a/.github/workflows/rust-cargo-deny.yml b/.github/workflows/rust-cargo-deny.yml new file mode 100644 index 0000000..20d883e --- /dev/null +++ b/.github/workflows/rust-cargo-deny.yml @@ -0,0 +1,29 @@ +name: Check cargo deny + +on: + pull_request: + push: + branches: + - main + - stable + +jobs: + cargo-deny: + name: Cargo deny + runs-on: ubuntu-latest + strategy: + matrix: + checks: + - advisories + + continue-on-error: ${{ matrix.checks == 'advisories' }} + + steps: + - name: Checkout Sources + uses: actions/checkout@v4.1.1 + + - name: Run cargo-deny + uses: EmbarkStudios/cargo-deny-action@v1 + with: + command: check ${{ matrix.checks }} + diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml new file mode 100644 index 0000000..c449e56 --- /dev/null +++ b/.github/workflows/rust-clippy.yml @@ -0,0 +1,38 @@ +name: Rust clippy + +on: + pull_request: + push: + branches: + - main + - stable + +jobs: + linter: + name: Cargo clippy + runs-on: ubuntu-latest + steps: + + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Checkout sources + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 50 + submodules: 'recursive' + + - name: Install Rust stable toolchain + uses: actions-rs/toolchain@v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + + - name: Rust Cache + uses: Swatinem/rust-cache@v2.7.3 + + - name: cargo clippy + run: cargo clippy --all-targets -- -D warnings diff --git a/.github/workflows/rust-fmt.yml b/.github/workflows/rust-fmt.yml new file mode 100644 index 0000000..efe05e3 --- /dev/null +++ b/.github/workflows/rust-fmt.yml @@ -0,0 +1,35 @@ +name: Rustfmt + +on: + pull_request: + push: + branches: + - main + - stable + +jobs: + rustfmt: + name: Cargo fmt + runs-on: ubuntu-latest + steps: + + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Checkout sources + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 50 + submodules: 'recursive' + + - name: Install Rust stable toolchain + uses: actions-rs/toolchain@v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + + - name: cargo fmt + run: cargo fmt --all -- --check diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml new file mode 100644 index 0000000..355083e --- /dev/null +++ b/.github/workflows/rust-test.yml @@ -0,0 +1,44 @@ +name: Rust test + +on: + pull_request: + push: + branches: + - main + - stable + +jobs: + check: + name: Cargo test + runs-on: ubuntu-latest + steps: + + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Checkout sources + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 50 + submodules: 'recursive' + + - name: Install Rust stable toolchain + uses: actions-rs/toolchain@v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + + - name: Install cargo-nextest + uses: baptiste0928/cargo-install@v3 + with: + crate: cargo-nextest + version: 0.9 + + - name: Rust Cache + uses: Swatinem/rust-cache@v2.7.3 + + - name: cargo nextest + run: cargo nextest run diff --git a/.github/workflows/semantic.yml b/.github/workflows/semantic.yml new file mode 100644 index 0000000..d515295 --- /dev/null +++ b/.github/workflows/semantic.yml @@ -0,0 +1,36 @@ +name: Semantic PR + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + # By default, these PR titles are allowed: + # https://github.com/commitizen/conventional-commit-types + name: Validate PR title + runs-on: ubuntu-latest + steps: + + # Documentation: https://github.com/amannn/action-semantic-pull-request + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + types: | + major + feat + fix + chore + docs + style + refactor + test + build + ci + revert + validateSingleCommit: true + wip: true