Use pre-commit as a step in CI

This commit is contained in:
Sameer Rahmani 2022-06-12 21:44:49 +01:00
parent 71c1e1731e
commit 02b3674436
3 changed files with 28 additions and 11 deletions

21
.ci.yml
View File

@ -5,12 +5,21 @@ platform:
os: linux
arch: arm64
steps:
- name: Build
image: rg.fr-par.scw.cloud/serene/llvm:15-7
commands:
- cmake --version
- ./builder build
trigger:
when:
branch:
- master
steps:
- name: Build
image: rg.fr-par.scw.cloud/serene/llvm:15-8
commands:
- cmake --version
- ./builder build
- name: Lint
image: rg.fr-par.scw.cloud/serene/llvm:15-8
commands:
- pre-commit clang-tidy -a
- pre-commit cppcheck -a
- pre-commit include-what-you-use -a
- pre-commit shell-lint -a

View File

@ -13,8 +13,6 @@ repos:
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-yaml
- id: forbid-new-submodules
- id: end-of-file-fixer
- id: trailing-whitespace
@ -24,7 +22,7 @@ repos:
hooks:
- id: clang-format
#- id: clang-tidy
- id: oclint
#- id: oclint
- id: cppcheck
args: ['--project=compile_commands.json']
#- id: cpplint

View File

@ -17,6 +17,8 @@ RUN apt-get update && apt-get install -y apt-utils && apt-get install -y wget \
software-properties-common \
zlib1g \
apt-utils \
cppcheck \
shellcheck \
zlib1g-dev
RUN wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh
@ -27,11 +29,15 @@ RUN apt-get update --fix-missing && \
libmlir-${VERSION} \
libmlir-${VERSION}-dbgsym \
liblld-${VERSION} \
liblld-${VERSION}-dev
liblld-${VERSION}-dev \
clang-format-${VERSION} \
clang-tidy-${VERSION}
RUN ln -s `which lld-${VERSION}` /usr/bin/lld && \
ln -s `which clang-${VERSION}` /usr/bin/clang && \
ln -s `which clang++-${VERSION}` /usr/bin/clang++ && \
ln -s `which clang-format-${VERSION}` /usr/bin/clang-format && \
ln -s `which clang-tidy-${VERSION}` /usr/bin/clang-tidy && \
ln -s `which mlir-tblgen-${VERSION}` /usr/bin/mlir-tblgen
ENV MLIR_DIR /usr/lib/llvm-${VERSION}
@ -46,5 +52,9 @@ RUN git clone https://github.com/include-what-you-use/include-what-you-use.git -
cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/usr/lib/llvm-${VERSION} ../include-what-you-use && \
make && make install
WORKDIR /
WORKDIR /app
RUN rm /iwuy -rf
COPY .pre-commit-config.yaml .
RUN git init .
RUN apt-get install -y --no-install-recommends pre-commit && pre-commit autoupdate && rm /app/.pre-commit-config.yaml