mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-02 13:53:06 +02: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:
|
variables:
|
||||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v9"
|
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v9"
|
||||||
COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v1"
|
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"
|
ANDROID_IMAGE: "registry.gitlab.gnome.org/gnome/glib/android-ndk:v3"
|
||||||
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v2"
|
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v2"
|
||||||
MESON_TEST_TIMEOUT_MULTIPLIER: 2
|
MESON_TEST_TIMEOUT_MULTIPLIER: 2
|
||||||
@ -40,6 +40,29 @@ variables:
|
|||||||
only:
|
only:
|
||||||
- schedules
|
- 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:
|
style-check-diff:
|
||||||
extends: .only-default
|
extends: .only-default
|
||||||
image: $DEBIAN_IMAGE
|
image: $DEBIAN_IMAGE
|
||||||
|
@ -2,6 +2,7 @@ FROM debian:buster
|
|||||||
|
|
||||||
RUN apt-get update -qq && apt-get install --no-install-recommends -qq -y \
|
RUN apt-get update -qq && apt-get install --no-install-recommends -qq -y \
|
||||||
bindfs \
|
bindfs \
|
||||||
|
black \
|
||||||
clang \
|
clang \
|
||||||
clang-tools-7 \
|
clang-tools-7 \
|
||||||
clang-format-7 \
|
clang-format-7 \
|
||||||
@ -9,6 +10,7 @@ RUN apt-get update -qq && apt-get install --no-install-recommends -qq -y \
|
|||||||
desktop-file-utils \
|
desktop-file-utils \
|
||||||
elfutils \
|
elfutils \
|
||||||
findutils \
|
findutils \
|
||||||
|
flake8 \
|
||||||
fuse \
|
fuse \
|
||||||
gcc \
|
gcc \
|
||||||
g++ \
|
g++ \
|
||||||
@ -36,6 +38,7 @@ RUN apt-get update -qq && apt-get install --no-install-recommends -qq -y \
|
|||||||
python3-setuptools \
|
python3-setuptools \
|
||||||
python3-wheel \
|
python3-wheel \
|
||||||
shared-mime-info \
|
shared-mime-info \
|
||||||
|
shellcheck \
|
||||||
systemtap-sdt-dev \
|
systemtap-sdt-dev \
|
||||||
unzip \
|
unzip \
|
||||||
wget \
|
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
|
#!/bin/sh -e
|
||||||
|
|
||||||
list_leaked_symbols () {
|
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 () {
|
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:
|
echo File "$1" possibly leaking symbols:
|
||||||
list_leaked_symbols "$1" "$2"
|
list_leaked_symbols "$1" "$2"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#! /bin/sh
|
#! /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"
|
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"
|
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
|
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"
|
fail "__glib_assert_msg does not have assertion message"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user