Files
unison/utils/tests/gitlab-ci-code-linting.yml
2022-12-19 10:59:52 +00:00

94 lines
2.4 KiB
YAML

# ns-3 CI/CD script with the code-linting stage
#
# Contains jobs to check the ns-3 coding style and perform lint checking.
# Clang-format
check-style-clang-format:
stage: code-linting
image: ubuntu:latest
before_script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -y
python3
clang-format-14
script:
- python3 utils/check-style-clang-format.py .
timeout: 1h
# Clang-tidy
.base-clang-tidy:
stage: code-linting
image: ubuntu:latest
variables:
MPI_CI: 1
CLANG_TIDY_OUTPUT: clang-tidy-output.log
before_script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -y
clang cmake
clang-tidy clang-tidy-14
python3 python3-pip
libboost-all-dev libgtk-3-dev libopenmpi-dev libsqlite3-dev
gsl-bin libgsl-dev libgsl27
git ssh
- pip3 install cppyy
- ./ns3 configure -d debug
--enable-clang-tidy
--enable-examples --enable-tests --enable-asserts
--enable-mpi --enable-python-bindings
artifacts:
paths:
- $CLANG_TIDY_OUTPUT
when: on_failure
timeout: 3h
clang-tidy:
extends: .base-clang-tidy
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_success
- changes:
paths:
- .clang-tidy
compare_to: master
when: on_success
script:
- run-clang-tidy-14 -p cmake-cache/ -quiet
1> $CLANG_TIDY_OUTPUT
2> /dev/null
- (! egrep -A 3 "error:|warning:|note:" $CLANG_TIDY_OUTPUT)
- echo "No clang-tidy errors found"
clang-tidy-diff:
extends: .base-clang-tidy
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: never
- changes:
paths:
- .clang-tidy
compare_to: master
when: never
- when: on_success
script:
- git remote add upstream https://gitlab.com/nsnam/ns-3-dev.git
- git fetch upstream master
- git diff -U0 upstream/master |
clang-tidy-diff-14.py -path cmake-cache/ -p1 -quiet
1> $CLANG_TIDY_OUTPUT
2> /dev/null
- (! egrep -A 3 "error:|warning:|note:" $CLANG_TIDY_OUTPUT)
- echo "No clang-tidy errors found"
# Emacs line
emacs-line:
stage: code-linting
image: ubuntu:latest
script:
- (! grep -rn --include="*.h" --include="*.cc" "c-file-style:\"gnu\"" ) ||
(echo "Found Emacs lines on the above C++ files" && exit 1)
- echo "No Emacs lines found on C++ files"
timeout: 1h