Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 3702a796 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

CI: Update the CI

- Clean all the generated files and folders, even on failed pipeline
- Add the format checking test at initialization
parent 49590175
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!105Refactor and more
......@@ -12,8 +12,8 @@ stages:
- main
- merge_requests
variables:
SRC_DIR: $CI_PROJECT_DIR # Where the sources are
WORK_DIR: "/home/gitlab-runner/CI_$CI_PIPELINE_ID" # Where we will work, so that it's not erased
SRC_DIR: $CI_PROJECT_DIR # Where the sources are
WORK_DIR: "/home/gitlab-runner/CI_$CI_PIPELINE_ID" # Where we will work, so that it's not erased
.breaking_tests: &breaking_tests
allow_failure: true
......@@ -29,16 +29,24 @@ env_sanitize:
<<: *main_tests
stage: initialization
script:
- cd $CI_PROJECT_DIR
- export # For debug purpose
- scripts/validate.bash --build=gcc --step=prepare
- scripts/validate.bash --build=clang --step=prepare
- echo "Env is intialized"
style_verification:
<<: *main_tests
stage: initialization
script:
- cd $CI_PROJECT_DIR
- scripts/validate.bash --step=format
env_finalize:
<<: *main_tests
stage: finalization
allow_failure: true
when: on_success
when: always
script: rm -rf $WORK_DIR
#################################################
......
#!/bin/sh
#!/bin/bash
OPTIONS='
--style=linux -s4
--pad-oper --pad-header --pad-comma
--align-pointer=name --align-reference=name
--break-one-line-headers
--remove-braces
--break-return-type
--convert-tabs
--close-templates
--max-code-length=101
--mode=c
--lineend=linux
--attach-inlines
--indent-labels
--indent-col1-comments
--indent-preproc-block
--quiet'
--style=linux -s4
--pad-oper --pad-header --pad-comma
--align-pointer=name --align-reference=name
--break-one-line-headers
--remove-braces
--break-return-type
--convert-tabs
--close-templates
--max-code-length=101
--mode=c
--lineend=linux
--attach-inlines
--indent-labels
--indent-col1-comments
--indent-preproc-block'
if [ $# -gt 0 ] && [ "$1" = "--check" ] ; then
astyle $OPTIONS --dry-run -R ./*.c | grep Formatted
[ $? -eq 1 ] && exit 0 || exit 1
fi
find . -iname '*.c' -exec astyle $OPTIONS {} \;
find . -iname '*.h' -exec astyle $OPTIONS {} \;
find . -iname '*.hpp' -exec astyle $OPTIONS {} \;
find . -iname '*.cpp' -exec astyle $OPTIONS {} \;
find . -iname '*.orig' -exec rm {} \;
find . -name '*.c' -exec astyle $OPTIONS --quiet {} \;
find . -name '*.h' -exec astyle $OPTIONS --quiet {} \;
find . -name '*.hpp' -exec astyle $OPTIONS --quiet {} \;
find . -name '*.cpp' -exec astyle $OPTIONS --quiet {} \;
find . -name '*.orig' -exec rm {} \;
......@@ -25,7 +25,7 @@ LKT_BUILD="" # Build folder of lektor
function test_simple ()
{
check_cd $LKT_INSTALL
check_cd $LKT_INSTALL/bin/
./lektord &
local _child_pid=$!
./lkt pwd=hashire adm kil
......@@ -33,7 +33,7 @@ function test_simple ()
kill $_child_pid
wait $_child_pid
local _child_sta=$?
[ _child_sta -ne 0 ] && die "The lektord process exited with $_child_sta"
[ $_child_sta -ne 0 ] && die "The lektord process exited with $_child_sta"
}
### Utility functions ########################################################
......@@ -72,7 +72,8 @@ Usage validate.bash --build=* --step=* [option]
--help, -h Prints this help message.
--build=comp Specify the compiler.
--step=AA,BB,.. Specify the steps to do. The list may contains the
following items: configure, launch, build.
following items: prepare, configure, launch, build,
cleanup, format.
Step configure options:
--debug Perform a debug build.
......@@ -135,19 +136,24 @@ function do_steps ()
local _build=""
local _configure=""
local _launch=""
local _cleanup=""
local _format=""
for step in $LKT_STEP ; do
case "$step" in
build) _build="yes";;
configure) _configure="yes";;
launch) _launch="yes";;
prepare) _prepare="yes";;
format) _format="yes";;
esac
done
[ "x$_format" = "xyes" ] && do_format
[ "x$_prepare" = "xyes" ] && do_prepare
[ "x$_configure" = "xyes" ] && do_configure
[ "x$_build" = "xyes" ] && do_build
[ "x$_launch" = "xyes" ] && do_launch
[ "x$_cleanup" = "xyes" ] && do_cleanup
}
### PERFORM THE TESTS ########################################################
......@@ -164,6 +170,22 @@ function do_launch ()
done
}
### PERFORM THE FORMAT CHECK #################################################
function do_format ()
{
./scripts/astyle.bash --check
! [ $? -eq 0 ] && die "Format is incorrect, use 'scripts/astyle.bash'"
}
### CLEANUP THE BUILD AND INSTALL FOLDERS ####################################
# Globals: #
# - LKT_WORK The folder in which everything is compiled and #
# installed with tests and others #
function do_cleanup ()
{
rm -rf $LKT_WORK || die "Failed to clean directory $LKT_WORK"
}
### PROCESS ARGS #############################################################
# Globals: #
# - LKT_DEBUG Whether or not to build in debug mode #
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter