Skip to content

Commit

Permalink
feat(CI): add linting CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bliutech committed Nov 6, 2023
1 parent 45f177e commit 78b50a5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies.
run: sudo apt-get install -y clang-format
- name: Lint
run: make check
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ run: default
dockerun:
$(QEMU) -drive format=raw,file=$(BUILD_DIR)/os_image

check:
@grep -RE "\r" source/ && echo "Found carriage returns in source files. Please run 'make format' to fix them." && exit 1 || exit 0
@find source/ -type f -name '*.c' -or -name '*.h' | xargs $(FORMAT) --dry-run --Werror

format:
find source -type f -name '*.c' -or -name '*.h' -or -name '*.asm' | xargs dos2unix
find source/ -type f -name '*.c' -or -name '*.h' | xargs $(FORMAT)
Expand Down

0 comments on commit 78b50a5

Please sign in to comment.