Skip to content

Commit 5744650

Browse files
lorenzobertsdavidbtadokoro
authored andcommitted
feat: setup GitHub Actions workflow for running formatting and linting
The workflow will run in all pull requests and consists of two simple steps: The first one runs the script and the second one checks if there were any code changes Thanks-to: OJarrisonn <[email protected]> Signed-off-by: Lorenzo Bertin Salvador <[email protected]> Signed-off-by: David Tadokoro <[email protected]>
1 parent 7c564dc commit 5744650

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/format_and_lint.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Format and Lint
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- ready_for_review
10+
- labeled
11+
paths:
12+
- src/**
13+
push:
14+
paths:
15+
- src/**
16+
branches:
17+
- master
18+
- unstable
19+
20+
jobs:
21+
format:
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 2
24+
if: '!github.event.pull_request.draft'
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Update rustup and install rustfmt
29+
shell: bash
30+
run: |
31+
rustup update
32+
rustup component add rustfmt
33+
rustup install stable
34+
35+
- name: Check rustfmt errors
36+
shell: bash
37+
run: |
38+
cargo fmt --all -- --check
39+
40+
lint:
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 2
43+
if: '!github.event.pull_request.draft'
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- name: Update rustup and install clippy
48+
shell: bash
49+
run: |
50+
rustup update
51+
rustup component add clippy
52+
rustup install stable
53+
54+
- name: Check clippy errors
55+
shell: bash
56+
run: |
57+
cargo clippy --all-features --all-targets --tests -- --allow=clippy::too-many-arguments --deny=warnings --deny=clippy::map_unwrap_or --deny=unconditional_recursion

0 commit comments

Comments
 (0)