From 46aed0c6b9be60355d89b4a9cf264f45290986b7 Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Fri, 10 May 2024 21:45:26 +0000 Subject: Download mplint release instead of recompiling every time Saves 1min10s by not compiling and another 15s by moving it together with linters. Squashed with: * Make sure mplint internal error or failure to run is detected * Make mplint breaking cause job to fail * Move linters out of lightweight.. goes faster, 3m46s -> 1m45s * Make script fail if any command returns nonzero or if any variable is unset. * Donwload mplint instead of building it **** mana/plus!80 --- .gitlab-ci.yml | 16 ++++++---------- tools/ci/jobs/mplint.sh | 25 +++++++------------------ tools/ci/scripts/exit.sh | 2 +- tools/ci/scripts/init.sh | 39 +++++++++++++++++++++------------------ 4 files changed, 35 insertions(+), 47 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 116bceed0..f7b8e107c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -327,30 +327,26 @@ gcc-8_unittestsbin: tags: - docker -mplint: - stage: lint - script: - - ./tools/ci/jobs/mplint.sh src po data - <<: *job-push - variables: - PACKAGES: gcc g++ git - make autoconf automake autopoint gettext tags: - docker + linters: stage: lint image: debian:buster script: + - ./tools/ci/jobs/mplint.sh src po data - ./tools/ci/jobs/pngcheck.sh - ./tools/ci/jobs/imagemagiccheck.sh - ./tools/ci/jobs/cpplint.sh - ./tools/ci/jobs/nsiqcppstyle.sh <<: *job-push variables: - PACKAGES: python wget pngcheck imagemagick git grep + MPLINT_PACKAGE_URL: "$CI_API_V4_URL/projects/mana%2Fmplint/jobs/artifacts/master/download?job=package_debian10_buster" + PACKAGES: git grep imagemagick pngcheck python unzip wget tags: - - lightweight + - docker + gcc-5_h_all: stage: prebuild diff --git a/tools/ci/jobs/mplint.sh b/tools/ci/jobs/mplint.sh index 573cd1c85..60422e5f6 100755 --- a/tools/ci/jobs/mplint.sh +++ b/tools/ci/jobs/mplint.sh @@ -1,29 +1,18 @@ #!/usr/bin/env bash -export CC=gcc -export CXX=g++ - -if [ "$NEWCC" != "" ]; then - export CC="$NEWCC" -fi -if [ "$NEWCXX" != "" ]; then - export CXX="$NEWCXX" -fi +set -e # Fail if any command fails +set -u # Fail if any variable is unset when used export LOGFILE=mplint_po.log - source ./tools/ci/scripts/init.sh -export CXXFLAGS="-std=gnu++11" +rm -rf mplint || true +tools/ci/scripts/retry.sh wget -O mplint-release.zip "$MPLINT_PACKAGE_URL" +unzip mplint-release.zip -do_init +read mplint_commit < mplint-version.txt +printf "Using mplint: %s\n" "$mplint_commit" -rm -rf mplint || true -gitclone https://git.themanaworld.org/mana mplint.git -cd mplint -run_configure_simple -run_make -cd .. echo " " >config.h for task in "$@"; do run_mplint $task diff --git a/tools/ci/scripts/exit.sh b/tools/ci/scripts/exit.sh index 1f13618c1..5c63a1d1b 100755 --- a/tools/ci/scripts/exit.sh +++ b/tools/ci/scripts/exit.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -rm $ERRFILE +rm -f "$ERRFILE" diff --git a/tools/ci/scripts/init.sh b/tools/ci/scripts/init.sh index 9512e9b66..ed25a59e8 100755 --- a/tools/ci/scripts/init.sh +++ b/tools/ci/scripts/init.sh @@ -3,7 +3,7 @@ export dir=$(pwd) export ERRFILE=${dir}/logs/${LOGFILE} -rm ${ERRFILE} +rm -f "$ERRFILE" function do_init { $CC --version @@ -104,11 +104,11 @@ function check_error { } function run_configure_simple { - rm $ERRFILE + rm -f "$ERRFILE" echo "autoreconf -i" autoreconf -i 2>$ERRFILE check_error $? - rm $ERRFILE + rm -f "$ERRFILE" echo "./configure $*" ./configure $* 2>$ERRFILE check_error $? @@ -117,14 +117,14 @@ function run_configure_simple { function run_configure { run_configure_simple $* - rm $ERRFILE + rm -f "$ERRFILE" cd po echo "make update-gmo" make update-gmo 2>$ERRFILE check_error $? cd .. - rm $ERRFILE + rm -f "$ERRFILE" cd po echo "make update-po" make update-po 2>$ERRFILE @@ -133,14 +133,14 @@ function run_configure { } function run_cmake { - rm $ERRFILE + rm -f "$ERRFILE" echo "cmake ." cmake . 2>$ERRFILE check_error $? } function run_make { - rm $ERRFILE + rm -f "$ERRFILE" if [ "$JOBS" == "" ]; then export JOBS=2 echo "No JOBS defined" @@ -153,7 +153,7 @@ function run_make { } function run_make_check { - rm $ERRFILE + rm -f "$ERRFILE" if [ "$JOBS" == "" ]; then export JOBS=2 echo "No JOBS defined" @@ -211,7 +211,7 @@ function run_check_warnings { } function run_h { - rm $ERRFILE + rm -f "$ERRFILE" echo "$CC -c -x c++ $* $includes */*/*/*/*.h */*/*/*.h */*/*.h */*.h *.h" $CC -c -x c++ $* $includes */*/*/*/*.h */*/*/*.h */*/*.h */*.h *.h 2>$ERRFILE if [[ -s "$ERRFILE" ]]; then @@ -221,7 +221,7 @@ function run_h { } function run_tarball { - rm $ERRFILE + rm -f "$ERRFILE" echo "make dist-xz" make dist-xz 2>$ERRFILE check_error $? @@ -234,14 +234,17 @@ function run_tarball { } function run_mplint { - rm $ERRFILE - echo "mplint/src/mplint $*" - mplint/src/mplint "$@" \ - | grep -v \ - -e "src/unittests/doctest.h" \ - -e "src/unittests/catch.hpp" \ - -e "src/debug/" \ - > "$ERRFILE" + rm -f "$ERRFILE" + echo "\$ ./mplint $*" + + ./mplint "$@" > "$ERRFILE.unfiltered" + + # if grep does not find any messages, it exits non-zero + grep -v \ + -e "src/unittests/doctest.h" \ + -e "src/unittests/catch.hpp" \ + -e "src/debug/" \ + < "$ERRFILE.unfiltered" > "$ERRFILE" || true run_check_warnings } -- cgit v1.2.3-60-g2f50