Skip to content

Commit

Permalink
feat(Makefile): install clang-format and clang-tidy from PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
XuehaiPan committed May 10, 2024
1 parent d81999c commit f6bc95b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ jobs:
- name: clang-format
run: |
(
source /etc/os-release
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME} llvm-toolchain-${UBUNTU_CODENAME} main" --yes
)
sudo apt-get update && sudo apt-get install clang-format --yes
make clang-format
- name: addlicense
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ FROM builder AS devel-builder

# Install extra dependencies
RUN sudo apt-get update && \
sudo apt-get install -y golang clang-format clang-tidy && \
sudo apt-get install -y golang && \
sudo chown -R "$(whoami):$(whoami)" "$(realpath /usr/lib/go)" && \
sudo rm -rf /var/lib/apt/lists/*

Expand Down
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ CUDA_FILES = $(shell find $(SOURCE_FOLDERS) -type f -name "*.cuh" -o -name "
COMMIT_HASH = $(shell git log -1 --format=%h)
PATH := $(HOME)/go/bin:$(PATH)
PYTHON ?= $(shell command -v python3 || command -v python)
CLANG_FORMAT ?= $(shell command -v clang-format-17 || command -v clang-format)
PYTESTOPTS ?=

.PHONY: default
Expand Down Expand Up @@ -96,12 +95,10 @@ cpplint-install:
$(call check_pip_install,cpplint)

clang-format-install:
command -v clang-format-17 || command -v clang-format || \
sudo apt-get install -y clang-format-17 || \
sudo apt-get install -y clang-format
$(call check_pip_install,clang-format)

clang-tidy-install:
command -v clang-tidy || sudo apt-get install -y clang-tidy
$(call check_pip_install,clang-tidy)

go-install:
# requires go >= 1.16
Expand Down Expand Up @@ -172,8 +169,8 @@ cpplint: cpplint-install
$(PYTHON) -m cpplint $(CXX_FILES) $(CUDA_FILES)

clang-format: clang-format-install
$(CLANG_FORMAT) --version
$(CLANG_FORMAT) --style=file -i $(CXX_FILES) $(CUDA_FILES) -n --Werror
clang-format --version
clang-format --style=file -i $(CXX_FILES) $(CUDA_FILES) -n --Werror

clang-tidy: clang-tidy-install cmake-configure
clang-tidy --version
Expand Down
2 changes: 2 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ doc8
pydocstyle[toml]
pyenchant
cpplint
clang-format
clang-tidy
pre-commit

0 comments on commit f6bc95b

Please sign in to comment.