[gjs: 1/2] CI: do a faster build



commit 2671fba882693364946eeb2ade704b8a6dbda56a
Author: Claudio André <claudioandre br gmail com>
Date:   Mon Feb 5 17:03:42 2018 -0200

    CI: do a faster build
    
    Docker images have a few more libraries installed.

 .gitlab-ci.yml           | 12 +++---------
 test/extra/do_jhbuild.sh | 30 +++++++++---------------------
 test/test-ci.sh          | 44 ++++++++++++++++++++++----------------------
 3 files changed, 34 insertions(+), 52 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1605a19d..0df943b0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,10 +6,6 @@ stages:
 - failure
 - deploy
 
-before_script:
-  - rm -rf /cwd
-  - ln -sf $(pwd) /cwd
-
 .build: &build
   stage: build
   artifacts:
@@ -17,6 +13,9 @@ before_script:
     when: always
     paths:
     - $(pwd)/.cache/jhbuild/build/gjs/test-suite.log
+    - $(pwd)/.cache/jhbuild/build/gjs/config.log
+    - $(pwd)/.cache/jhbuild/build/gjs/Makefile
+    - $(pwd)/coverage/
 
   script:
     # Run static code analysis OR
@@ -91,11 +90,6 @@ coverage:
     CC: gcc
     BUILD_OPTS: "--enable-code-coverage"
     coverage: '/^Lines:.\d+.\d+.(\d+\.\d+\%)/'
-  artifacts:
-    name: coverage
-    paths:
-    - $(pwd)/coverage/
-    - $(pwd)/.cache/jhbuild/build/gjs/test-suite.log
 
 cppcheck:
   <<: *build
diff --git a/test/extra/do_jhbuild.sh b/test/extra/do_jhbuild.sh
index 0ce07c03..e4e65d02 100755
--- a/test/extra/do_jhbuild.sh
+++ b/test/extra/do_jhbuild.sh
@@ -1,29 +1,17 @@
 #!/bin/bash -e
 
-function do_Patch_JHBuild(){
+function do_Get_JHBuild(){
     echo
-    echo '-- Patching JHBuild --'
+    echo '-- Download JHBuild --'
 
-    if [[ ! -d jhbuild ]]; then
-      git clone --depth 1 https://github.com/GNOME/jhbuild.git
+    if [[ -d /jhbuild ]]; then
+        # For a clean build, update and rebuild jhbuild. And avoid git pull.
+        rm -rf /jhbuild
     fi
+    git clone --depth 1 https://github.com/GNOME/jhbuild.git /jhbuild
 
-    # Create and apply a patch
-    cd jhbuild
-    patch -p1 <<ENDPATCH
-diff --git a/jhbuild/utils/systeminstall.py b/jhbuild/utils/systeminstall.py
-index 75b0849..08965fa 100644
---- a/jhbuild/utils/systeminstall.py
-+++ b/jhbuild/utils/systeminstall.py
-@@ -428,7 +428,7 @@ class AptSystemInstall(SystemInstall):
-
-     def _install_packages(self, native_packages):
-         logging.info(_('Installing: %(pkgs)s') % {'pkgs': ' '.join(native_packages)})
--        args = self._root_command_prefix_args + ['apt-get', 'install']
-+        args = ['apt-get', '-y', 'install']
-         args.extend(native_packages)
-         subprocess.check_call(args)
-ENDPATCH
+    # A patch is no longer required
+    cd /jhbuild
 
     echo '-- Done --'
     cd -
@@ -70,7 +58,7 @@ function do_Build_JHBuild(){
     echo '-- Building JHBuild --'
 
     # Build JHBuild
-    cd jhbuild
+    cd /jhbuild
     git log --pretty=format:"%h %cd %s" -1
     echo
     ./autogen.sh
diff --git a/test/test-ci.sh b/test/test-ci.sh
index 0d63f577..8f7593b1 100755
--- a/test/test-ci.sh
+++ b/test/test-ci.sh
@@ -4,11 +4,14 @@ function do_Set_Env(){
     echo
     echo '-- Set Environment --'
 
-    #Save cache on host
-    mkdir -p /cwd/.cache
-    export XDG_CACHE_HOME=/cwd/.cache
+    #Save cache on $pwd (required by artifacts)
+    mkdir -p $(pwd)/.cache
+    export XDG_CACHE_HOME=$(pwd)/.cache
+    cp -r /cwd/.cache $(pwd)/.cache
+
     export JHBUILD_RUN_AS_ROOT=1
     export SHELL=/bin/bash
+    PATH=$PATH:~/.local/bin
 
     if [[ -z "${DISPLAY}" ]]; then
         export DISPLAY=":0"
@@ -46,35 +49,33 @@ function do_Show_Info(){
 }
 
 # ----------- Run the Tests -----------
-cd /cwd
-
-source test/extra/do_basic.sh
-source test/extra/do_jhbuild.sh
-source test/extra/do_cache.sh
-source test/extra/do_mozilla.sh
-source test/extra/do_docker.sh
+if [[ -n "${BUILD_OPTS}" ]]; then
+    extra_opts="($BUILD_OPTS)"
+fi
 
 # Show some environment info
 echo
 echo '-- Environment --'
-echo "Running on: $BASE $OS"
+echo "Running on: $BASE $OS  $extra_opts"
 echo "Doing: $1"
 
+source test/extra/do_jhbuild.sh
+
+# Create the coverage artifacts folders
+mkdir -p $(pwd)/coverage; touch $(pwd)/coverage/doing-"$1"
+
 if [[ $1 == "GJS" ]]; then
     do_Set_Env
-
     do_Show_Info
-    do_Patch_JHBuild
-    do_Build_JHBuild
-    do_Configure_JHBuild
 
     if [[ $2 != "devel" ]]; then
+        do_Get_JHBuild
+        do_Build_JHBuild
+        do_Configure_JHBuild
         do_Build_Package_Dependencies gjs
-    else
-        jhbuild build m4-common
 
+    else
         mkdir -p ~/jhbuild/checkout/gjs
-        do_Install_Extras
     fi
     do_Configure_MainBuild
 
@@ -109,12 +110,11 @@ elif [[ $1 == "GJS_COVERAGE" ]]; then
     PATH=$PATH:~/.local/bin
 
     jhbuild run --in-builddir=gjs make check-code-coverage
-    mkdir -p /cwd/coverage
-    cp /cwd/.cache/jhbuild/build/gjs/gjs-?.*.*-coverage.info /cwd/coverage/
-    cp -r /cwd/.cache/jhbuild/build/gjs/gjs-?.*.*-coverage/* /cwd/coverage/
+    cp $(pwd)/.cache/jhbuild/build/gjs/gjs-?.*.*-coverage.info $(pwd)/coverage/
+    cp -r $(pwd)/.cache/jhbuild/build/gjs/gjs-?.*.*-coverage/* $(pwd)/coverage/
 
     echo '-----------------------------------------------------------------'
-    sed -e 's/<[^>]*>//g' /cwd/coverage/index.html | tr -d ' \t' | grep -A3 -P '^Lines:$'  | tr '\n' ' '; 
echo
+    sed -e 's/<[^>]*>//g' $(pwd)/coverage/index.html | tr -d ' \t' | grep -A3 -P '^Lines:$'  | tr '\n' ' '; 
echo
     echo '-----------------------------------------------------------------'
 
 elif [[ $1 == "CPPCHECK" ]]; then


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]