diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b26ab5d098eb29fcb5ede105fb7bea473c8fc26..54c80cca042fc224c4cb450888ad45a4c9ea4547 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,14 +14,6 @@ stages: - test - deploy -#before_script: -# - apt-get update -qq && apt-get -qq -y install python3-pip && python3 -m pip install --upgrade pip -# - python3 -V -# - python3 -m pip --version -# - g++ --version -# - cat /etc/*-release -# - python3 -m pip install gcovr - build: stage: build variables: @@ -29,9 +21,9 @@ build: GCC_COLORS: "error=31;1:warning=35;1:note=36;1:range1=32:range2=34:locus=39;1:quote=39;1:fixit-insert=32:fixit-delete=31:diff-filename=39;1:diff-hunk=32:diff-delete=31:diff-insert=32:type-diff=32;1" CLICOLOR_FORCE: 1 # Necessary for cmake to output colours script: -# - cmake . -DCMAKE_CXX_FLAGS="-Werror -fdiagnostics-color=always" -# - make -j4 -# - make clean + - cmake . -DCMAKE_CXX_FLAGS="-Werror -fdiagnostics-color=always" + - make -j4 + - make clean - cmake . -DCMAKE_CXX_FLAGS="-Wall -Wextra -fdiagnostics-color=always" # Build again, but with more warnings - make -j4 @@ -54,8 +46,6 @@ tests: cppcheck: stage: build before_script: -# - echo deb http://deb.debian.org/debian testing main > /etc/apt/sources.list -# - apt-get update -qq && apt-get -t testing install -y cppcheck - cppcheck --version script: - ci/cppcheck.sh @@ -63,9 +53,6 @@ cppcheck: cppcheck-misra: stage: build before_script: - # install cppcheck from the testing repos in order to get the latest version -# - echo deb http://deb.debian.org/debian testing main > /etc/apt/sources.list -# - apt-get update -qq && apt-get -t testing install -y cppcheck && apt-get -t testing install -y python3 - cppcheck --version script: - ci/cppcheck-misra.sh @@ -73,25 +60,18 @@ cppcheck-misra: vera: stage: build before_script: -# - apt-get update -qq && apt-get install -y -qq vera++ - vera++ --version - - sudo cp ci/vera.profile /usr/lib/vera++/profiles/custom + - cp ci/vera.profile /usr/lib/vera++/profiles/custom script: - ci/vera.sh -#clang-tidy: -# stage: build -# variables: -# GIT_SUBMODULE_STRATEGY: normal -# TERM: xterm-color -# before_script: - # Installing the `sid` repository to get the latest version of clang -# - echo deb http://deb.debian.org/debian sid main > /etc/apt/sources.list -# - apt-get update -qq && apt-get -t sid install -y -qq clang-tidy-7 -# - clang-tidy-7 --version -# script: - # Running with `script` to give clang a tty so that it outputs colours -# - script -c "bash -x ci/clang-tidy.sh" +clang-tidy: + stage: build + variables: + GIT_SUBMODULE_STRATEGY: normal + TERM: xterm-color + script: + - ./ci/clang-tidy.sh pages: stage: deploy @@ -102,8 +82,6 @@ pages: - public variables: GIT_SUBMODULE_STRATEGY: normal -# script: -# - apt-get install -qq -y doxygen graphviz lcov script: - ./ci/pages_deploy.sh - echo -e "\e[1;36mPublic directory contents\e[0m" && ls -l public/coverage # Print directory contents for debugging diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..79e12dc6eca05fa2cc7668c18fb7597f7719905f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +# This is the Dockerfile for the lightspot21/acubesat-ci:latest +# Docker image used at the pipeline. Please take care to generate +# and push a new image to the lightspot21/acubesat-ci repo every +# 1-2 weeks in order to ensure that the tools are at the latest version. +# +# P.S. Tag properly your images with --tag lightspot21/acubesat-ci when +# building. + +FROM alpine:latest + +# Set a new work directory. DO NOT DELETE THE LINE BELOW +WORKDIR /root/ + +# Set up clang-tidy version 8 +RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" \ + >> /etc/apk/repositories && apk update && \ + apk add --no-cache --virtual git-deps git && \ + apk add --no-cache build-base cmake && \ + git clone --depth=1 https://github.com/llvm/llvm-project.git -b release/8.x && \ + cmake \ + -DLLVM_ENABLE_PROJECTS="clang-tools-extra;clang" \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ + -DLLVM_TARGETS_TO_BUILD="host" \ + -G "Unix Makefiles" ./llvm-project/llvm && \ + make -j$(nproc) clang-tidy && mv bin/clang-tidy /usr/bin/clang-tidy && \ + rm -rf * && apk del git-deps + +# Update package lists and install cmake, cppcheck, doxygen, vera++, +# gcc and lcov with their dependencies +RUN apk add --no-cache findutils python3 python3-dev \ + cppcheck doxygen vera++@testing lcov@testing + +# Install gcovr +RUN python3 -m pip install gcovr + +# Start a new shell +ENTRYPOINT ["/bin/sh", "-c"] \ No newline at end of file diff --git a/ci/clang-tidy.sh b/ci/clang-tidy.sh index bdff8166981a4312ab0a2c28423a5359af80ad59..886417d0950a74e8256ae1bfa48f975d5fb39004 100755 --- a/ci/clang-tidy.sh +++ b/ci/clang-tidy.sh @@ -10,6 +10,6 @@ echo -e "\033[0;34mRunning clang-tidy...\033[0m" cd "$(dirname "$0")" -clang-tidy-7 `find ../src/ -type f -regextype posix-egrep -regex '.*\.(cpp|hpp|c|h)'` \ +clang-tidy `find ../src/ -type f -regextype posix-egrep -regex '.*\.(cpp|hpp|c|h)'` \ -extra-arg=-fcolor-diagnostics -- -std=c++17 -I../inc \ -I/usr/include/c++/7/ -I/usr/include/x86_64-linux-gnu/c++/7 -I../lib/etl/include