Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Makefile): install clang-format and clang-tidy from PyPI #197

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,15 @@ jobs:
run: |
make cpplint

- name: clang-format
run: |
make clang-format

- name: clang-tidy
run: |
sudo apt-get update && sudo apt-get install libomp-dev --yes
make clang-tidy

- 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
run: |
make 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
Loading