Skip to content

Commit

Permalink
chore: add github actions check for rust lint
Browse files Browse the repository at this point in the history
Signed-off-by: Tiago Castro <[email protected]>
  • Loading branch information
tiagolobocastro committed Aug 15, 2022
1 parent fb45044 commit d3abc6c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pr-commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint Commit Messages
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
push:
branches:
- staging

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install CommitLint and Dependencies
run: npm install @commitlint/config-conventional @commitlint/cli
- name: Lint Commits
run: |
# Only run for PR's and simply succeed the bors staging branch
if [ ! ${{ github.ref }} = "refs/heads/staging" ]; then
first_commit=${{ github.event.pull_request.base.sha }}
last_commit=${{ github.event.pull_request.head.sha }}
npx commitlint --from $first_commit --to $last_commit -V
fi
23 changes: 23 additions & 0 deletions .github/workflows/pr-rust-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Code Linter
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
push:
branches:
- staging
jobs:
rustlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: cachix/install-nix-action@v15
with:
nix_path: nixpkgs=channel:nixos-22.05
- name: nix-shell
run: nix-shell --pure --run exit
- name: cargo-fmt
run: nix-shell --run 'cargo-fmt --all -- --check'
- name: cargo-clippy
run: nix-shell --run 'cargo-clippy --all --all-targets -- -D warnings'

0 comments on commit d3abc6c

Please sign in to comment.