diff --git a/.ci.yml b/.ci.yml index 92869c7..7545807 100644 --- a/.ci.yml +++ b/.ci.yml @@ -8,7 +8,7 @@ test-and-lint: image: "verilator/verilator:v5.016" tags: ['ace-x86_64'] script: - - apt-get -qqy update && apt-get -qqy --no-install-recommends install cmake build-essential git ca-certificates python3 clang-format-14 mold ninja-build + - apt-get -qqy update && apt-get -qqy --no-install-recommends install cmake build-essential git ca-certificates python3 clang-format-14 mold ninja-build shellcheck - cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=mold" -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=mold" - cmake --build build -j"$(nproc)" - PATH="$PWD/build:$PWD/scripts:$PATH" && make -j"$(nproc)" -O -k --no-print-directory -f check.mk diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d55fc42..0e79cf3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install deps - run: apt-get -qqy update && apt-get -qqy --no-install-recommends install cmake build-essential git ca-certificates python3 clang-format-14 + run: apt-get -qqy update && apt-get -qqy --no-install-recommends install cmake build-essential git ca-certificates python3 clang-format-14 shellcheck - name: Build run: | cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo diff --git a/check.mk b/check.mk index 28c03b2..6f468f7 100644 --- a/check.mk +++ b/check.mk @@ -7,6 +7,9 @@ test_and_lint_dont_abort_after_err: .PHONY: test_and_lint test_and_lint: test lint +.PHONY: autofix +autofix: autofmt shellcheck_autofix + .PHONY: autofmt autofmt: clang-format-14 -i source/*.cpp source/*.hpp @@ -16,7 +19,7 @@ test: @$(MAKE) -C tests .PHONY: lint -lint: fmt_check +lint: fmt_check shellcheck .PHONY: fmt_check fmt_check: @@ -24,3 +27,17 @@ fmt_check: diff "$$i" <(clang-format-14 "$$i") --label "original $$i" --label "formatted $$i" --color=always -u; \ done @echo # blank line for consistency + + +SCRIPTS=scripts/* tests/*.sh tests/run_test \ + examples/caliptra_vcd/sv-bugpoint-check.sh \ + examples/caliptra_verilation_err/sv-bugpoint-check.sh + +.PHONY: shellcheck +shellcheck: + shellcheck $(SCRIPTS) --color + +.PHONY: shellcheck +shellcheck_autofix: + shellcheck $(SCRIPTS) -f diff --color || exit 0 + shellcheck $(SCRIPTS) -f diff | git apply