mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
Merge branch '2046-add-shellcheck-pylint-in-ci' into 'master'
resolve "Add pylint and shellcheck CI checks" Closes #2046 See merge request GNOME/glib!1743
This commit is contained in:
commit
053d2ae2b4
@ -12,7 +12,7 @@ cache:
|
||||
variables:
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v9"
|
||||
COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v1"
|
||||
DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v6"
|
||||
DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v7"
|
||||
ANDROID_IMAGE: "registry.gitlab.gnome.org/gnome/glib/android-ndk:v3"
|
||||
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v2"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 2
|
||||
@ -40,6 +40,29 @@ variables:
|
||||
only:
|
||||
- schedules
|
||||
|
||||
sh-check:
|
||||
extends: .only-default
|
||||
image: $DEBIAN_IMAGE
|
||||
stage: style-check
|
||||
allow_failure: true
|
||||
script:
|
||||
- .gitlab-ci/run-shellcheck.sh
|
||||
only:
|
||||
changes:
|
||||
- "**/*.sh"
|
||||
|
||||
py-check:
|
||||
extends: .only-default
|
||||
image: $DEBIAN_IMAGE
|
||||
stage: style-check
|
||||
allow_failure: true
|
||||
script:
|
||||
- .gitlab-ci/run-black.sh
|
||||
- .gitlab-ci/run-flake8.sh
|
||||
only:
|
||||
changes:
|
||||
- "**/*.py"
|
||||
|
||||
style-check-diff:
|
||||
extends: .only-default
|
||||
image: $DEBIAN_IMAGE
|
||||
|
@ -2,6 +2,7 @@ FROM debian:buster
|
||||
|
||||
RUN apt-get update -qq && apt-get install --no-install-recommends -qq -y \
|
||||
bindfs \
|
||||
black \
|
||||
clang \
|
||||
clang-tools-7 \
|
||||
clang-format-7 \
|
||||
@ -9,6 +10,7 @@ RUN apt-get update -qq && apt-get install --no-install-recommends -qq -y \
|
||||
desktop-file-utils \
|
||||
elfutils \
|
||||
findutils \
|
||||
flake8 \
|
||||
fuse \
|
||||
gcc \
|
||||
g++ \
|
||||
@ -36,6 +38,7 @@ RUN apt-get update -qq && apt-get install --no-install-recommends -qq -y \
|
||||
python3-setuptools \
|
||||
python3-wheel \
|
||||
shared-mime-info \
|
||||
shellcheck \
|
||||
systemtap-sdt-dev \
|
||||
unzip \
|
||||
wget \
|
||||
|
6
.gitlab-ci/run-black.sh
Executable file
6
.gitlab-ci/run-black.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
black --diff --check $(git ls-files '*.py')
|
6
.gitlab-ci/run-flake8.sh
Executable file
6
.gitlab-ci/run-flake8.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
flake8 --max-line-length=88 $(git ls-files '*.py')
|
7
.gitlab-ci/run-shellcheck.sh
Executable file
7
.gitlab-ci/run-shellcheck.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Ignoring third-party directories that we don't want to parse
|
||||
# shellcheck disable=SC2046
|
||||
shellcheck $(git ls-files '*.sh' | grep -Ev "glib/libcharset|glib/dirent")
|
@ -1,11 +1,11 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
list_leaked_symbols () {
|
||||
nm -D "$1" | grep ' T ' | cut -f 3 -d ' ' | egrep -v "$2"
|
||||
nm -D "$1" | grep ' T ' | cut -f 3 -d ' ' | grep -E -v "$2"
|
||||
}
|
||||
|
||||
check_symbols () {
|
||||
if [ "`list_leaked_symbols "$1" "$2" | wc -l`" -ne 0 ]; then
|
||||
if [ "$(list_leaked_symbols "$1" "$2" | wc -l)" -ne 0 ]; then
|
||||
echo File "$1" possibly leaking symbols:
|
||||
list_leaked_symbols "$1" "$2"
|
||||
exit 1
|
||||
|
@ -1,3 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
do something here
|
||||
# do something here
|
||||
|
40
sanity_check
40
sanity_check
@ -1,40 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
VERSION=$1
|
||||
|
||||
if [ ! -f glib-$VERSION.tar.gz ]; then
|
||||
echo "ERROR: glib-$VERSION.tar.gz does not exist..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
echo "Checking glib-$VERSION.tar.gz..."
|
||||
tar xfz glib-$VERSION.tar.gz
|
||||
|
||||
|
||||
for file in INSTALL NEWS
|
||||
do
|
||||
echo -n "$file... "
|
||||
if [ "x`grep $VERSION glib-$VERSION/$file | wc -l | awk -F' ' '{print $1}'`" = "x0" ]; then
|
||||
echo "failed."
|
||||
#exit 1
|
||||
else
|
||||
echo "ok"
|
||||
fi
|
||||
done
|
||||
|
||||
echo -n "INSTALL..."
|
||||
if [ "x`grep $VERSION glib-$VERSION/INSTALL | wc -l | awk -F' ' '{print $1}'`" = "x2" ]; then
|
||||
echo "ok"
|
||||
else
|
||||
echo "failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Number of lines in created documentation files:"
|
||||
|
||||
wc -l glib-$VERSION/docs/reference/*/html/*.html | grep total
|
||||
|
||||
rm -rf glib-$VERSION
|
@ -41,6 +41,7 @@ echo_v "Running gdb on assert-msg-test"
|
||||
OUT=$($LIBTOOL --mode=execute gdb --batch -x "${srcdir:-.}/assert-msg-test.gdb" ./assert-msg-test 2> $error_out) || fail "failed to run gdb"
|
||||
|
||||
echo_v "Checking if assert message is in __glib_assert_msg"
|
||||
# shellcheck disable=SC2016
|
||||
if ! echo "$OUT" | grep -q '^$1.*"GLib:ERROR:.*assert-msg-test.c:.*:.*main.*: assertion failed: (42 < 0)"'; then
|
||||
fail "__glib_assert_msg does not have assertion message"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user