diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0a527d0cb64e33d6c2c0dcd27c19b31256217978..7eb5799002d6bf8eed308ad6e3a8b8f2c6481461 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,8 +12,8 @@ stages: - main - merge_requests variables: - SRC_DIR: $CI_PROJECT_DIR # Where the sources are - WORK_DIR: $HOME/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,7 +29,9 @@ env_sanitize: <<: *main_tests stage: initialization script: - - mkdir -p $WORK_DIR/{build.clang,build.gcc,install.clang,install.gcc} + - export # For debug purpose + - scripts/validate.bash --build=gcc --step=prepare + - scripts/validate.bash --build=clang --step=prepare - echo "Env is intialized" env_finalize: diff --git a/scripts/validate.bash b/scripts/validate.bash index 7d817ee8a0ab190edeebefdeb929ea64580b8c5b..ebc421520e66dcff059bf5e44396956c58d13876 100755 --- a/scripts/validate.bash +++ b/scripts/validate.bash @@ -15,6 +15,7 @@ LKT_CONFIGURE_OPTIONS="" # Options to pass to the configure command LKT_CORE_NUMBER=4 # Number of cores to use with make LKT_TEST="" # Which tests to perform LKT_SRC=$SRC_DIR # Where to find the sources of lektor +LKT_WORK=$WORK_DIR # The work dir, where to play # Below: global variables that will be initialized latter LKT_INSTALL="" # Install folder of lektor @@ -45,6 +46,11 @@ function check_cd () cd $1 || die "Can't go to folder $1" } +function check_mkdir () +{ + mkdir $* || die "Failed to mkdir '$*'" +} + function check_configure () { $LKT_DIR/configure $* || die "Failed to configure with $LKT_COMPILER" @@ -82,6 +88,17 @@ fi SQLITE3=$(which sqlite3) [ $? -ne 0 ] && die "Can't find the sqlite3 executable" +### PREPARE ################################################################## +# Globals: # +# - LKT_COMPILER Which compiler to use # +# - LKT_WORK The base folder which will contains all the # +# builds and installs # +function do_prepare () +{ + check_mkdir -p $LKT_WORK/{build.$LKT_COMPILER,install.$LKT_COMPILER} + echo "Created folders $LKT_WORK/{build.$LKT_COMPILER,install.$LKT_COMPILER}" +} + ### CONFIGURE ################################################################ # Globals: # # - LKT_DIR Project root directory # @@ -113,6 +130,7 @@ function do_build () # - LKT_STEP Steps to perform # function do_steps () { + local _prepare="" local _build="" local _configure="" local _launch="" @@ -121,9 +139,11 @@ function do_steps () build) _build="yes";; configure) _configure="yes";; launch) _launch="yes";; + prepare) _prepare="yes";; esac done + [ "x$_prepare" = "xyes" ] && do_prepare [ "x$_configure" = "xyes" ] && do_configure [ "x$_build" = "xyes" ] && do_build [ "x$_launch" = "xyes" ] && do_launch