Skip to content

Commit

Permalink
Add check code format to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
joii2020 committed Jan 9, 2024
1 parent 1ed4ee6 commit 7267f4f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Format check
run: cd tests && make check-code-format
- name: Install tools
run: cd tests && make install-all
- name: Build contract
Expand Down
18 changes: 18 additions & 0 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ spawn-tests:
clean-spawn-tests:
rm -rf auth-spawn-tests/target

check-code-format: \
check-c-code-format \
check-rust-code-format

check-c-code-format:
cd .. && make fmt-via-docker
cd .. && make tests/auth-c-lock/Makefile fmt-via-docker
@if [ -n "$$(cd .. && git diff --name-only HEAD | grep -E '\.(c|h)$$')" ]; then \
echo "Code formatting issues found. Please run make fmt-via-docker on your code."; \
exit 1; \
fi

check-rust-code-format:
cd auth-c-tests && cargo fmt --all --check
cd auth-rust-lock && cargo fmt --all --check
cd auth-spawn-tests && cargo fmt --all --check
cd ../tools/ckb-auth-cli && cargo fmt --all --check

install-all: \
install-ckb-tools \
install-litecoin-tools \
Expand Down

0 comments on commit 7267f4f

Please sign in to comment.