Skip to content

feat: add CI workflows #6

feat: add CI workflows

feat: add CI workflows #6

Workflow file for this run

name: Lint
on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
branches:
- main
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: --deny warnings
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
commits: ${{ steps.commits.outputs.hashes }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Get all commit hashes
id: commits
run: |
echo "hashes=[$(git log -z --pretty=format:"'%H'," ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | sed 's/.$//')]" >> "$GITHUB_OUTPUT"
commit-lint:
name: Conventional Commits
needs: generate-matrix
strategy:
matrix:
commit: ${{ fromJson(needs.generate-matrix.outputs.commits) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.commit }}
- uses: bugbundle/[email protected]
cargo:
name: Rustfmt and Clippy
needs: generate-matrix
strategy:
matrix:
commit: ${{ fromJson(needs.generate-matrix.outputs.commits) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.commit }}
- name: Install toolchain and tools
run: |
rustup toolchain install nightly --profile minimal
rustup default nightly
rustup component add clippy rustfmt
- name: Check Code Formatting
run: cargo fmt -- --check
- name: Lint with Clippy
run: cargo clippy -- -D warnings