diff options
| author | Philip Chimento <philip.chimento@gmail.com> | 2019-09-20 00:56:12 +0000 |
|---|---|---|
| committer | Philip Chimento <philip.chimento@gmail.com> | 2019-09-20 00:56:12 +0000 |
| commit | be50074e4d07e118636c1187e8654e08dff52ab4 (patch) | |
| tree | 220f08a6f81466b38f0d96d5c8e95667b12b9542 | |
| parent | cb5139185724e947a5afda9f185a5fc33699d333 (diff) | |
| parent | bfb7de0d381fa774d158e05960e3d57cb72b87f3 (diff) | |
| download | gjs-be50074e4d07e118636c1187e8654e08dff52ab4.tar.gz | |
Merge branch 'smaller-ci-phase1' into 'master'
Smaller CI, phase 1
See merge request GNOME/gjs!339
| -rw-r--r-- | .gitlab-ci.yml | 257 | ||||
| -rw-r--r-- | .lint-condo.yaml | 3 | ||||
| -rw-r--r-- | README.md | 1 | ||||
| -rwxr-xr-x | test/ci-images.sh | 7 | ||||
| -rw-r--r-- | test/extra/Dockerfile.arm64v8.fedora.29 | 11 | ||||
| -rw-r--r-- | test/extra/Dockerfile.fedora.static-analysis | 4 | ||||
| -rw-r--r-- | test/extra/Dockerfile.ppc64le.fedora.29 | 11 | ||||
| -rwxr-xr-x | test/extra/do_basic.sh | 79 | ||||
| -rwxr-xr-x | test/extra/do_docker.sh | 20 | ||||
| -rwxr-xr-x | test/extra/do_environment.sh | 90 | ||||
| -rwxr-xr-x | test/extra/do_mozilla.sh | 39 | ||||
| -rw-r--r-- | test/gjs-test-coverage.cpp | 3 | ||||
| -rw-r--r-- | test/org.gnome.GjsDevel.json | 52 | ||||
| -rwxr-xr-x | test/test-ci.sh | 175 |
14 files changed, 141 insertions, 611 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f1a9afdc..1f1d068a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,16 +21,8 @@ stages: echo "*********************************************"; ' -.JHBuild files: &JHB_files [.cache/jhbuild/build/gjs/*.log, .cache/jhbuild/build/gjs/Makefile, .cache/jhbuild/build/gjs/configure] -.Coverage files: &cov_files [configure, Makefile, analysis/, ./*.log, ./*.trs, ./installed-tests/scripts/*.log, ./installed-tests/scripts/*.trs, coverage/] -.Regular files: ®_files [configure, Makefile, analysis/, ./*.log, ./*.trs, ./installed-tests/scripts/*.log, ./installed-tests/scripts/*.trs] -.Flatpak files: &pak_files [./*.flatpak] - -.jhbuild: &jhbuild - artifacts: - name: log_jhbuild - when: always - paths: *JHB_files +.Coverage files: &cov_files [configure, Makefile, ./*.log, ./*.trs, ./installed-tests/scripts/*.log, ./installed-tests/scripts/*.trs, coverage/] +.Regular files: ®_files [configure, Makefile, ./*.log, ./*.trs, ./installed-tests/scripts/*.log, ./installed-tests/scripts/*.trs] .coverage: &coverage artifacts: @@ -38,11 +30,6 @@ stages: when: always paths: *cov_files -.package: &package - artifacts: - name: log_package - paths: *pak_files - # Regular build .build: &build when: on_success @@ -94,35 +81,6 @@ stages: # Done - *CI_footer -# Cross (multi architecture) build -.qemu: &multiarch - artifacts: - name: log - when: always - paths: *reg_files - - image: docker:19.03.0 - services: - - docker:19.03.0-dind - variables: - DOCKER_TLS_CERTDIR: "" - - script: - # CI starts here. Previous messages are from GitLab Runner setup. - - *CI_header - - # Register QEMU archs - - docker run --rm --privileged multiarch/qemu-user-static:register --reset - - # Run the multiarch test job using QEMU - - 'docker run -v $(pwd):/cwd - -e TEST=check -e TASK_ID=$TASK_ID $IMAGE - bash -e -c "cd /cwd && test/test-ci.sh GJS" - ' - - # Done - - *CI_footer - ############################################# # Regular tests # ############################################# @@ -204,15 +162,13 @@ coverage-automatic: - master@GNOME/gjs # Publishes -# The reports (coverage and code statistics) +# The code coverage report pages: stage: deploy dependencies: - coverage-automatic - - code_statistics script: - mv $(pwd)/coverage/ public/ || true - - mv $(pwd)/analysis/report.txt public/ || true artifacts: paths: - public @@ -227,15 +183,22 @@ pages: # Static Analyzers # ############################################# cppcheck: - <<: *build + when: on_success + image: uilianries/docker-cppcheck stage: source_check - image: registry.gitlab.gnome.org/gnome/gjs:fedora.static-analysis - variables: - TASK_ID: "cppcheck" - CODECHECK: "CPPCHECK" + script: + - cppcheck . -v -f -q --error-exitcode=1 --inline-suppr --enable=warning,performance,portability except: - - schedules - - tags + refs: + - schedules + - tags + variables: + - $CI_COMMIT_MESSAGE =~ /\[skip cppcheck\]/ + only: + changes: + - '**/*.c' + - '**/*.cpp' + - '**/*.h' cpplint: <<: *build @@ -245,19 +208,32 @@ cpplint: TASK_ID: "cpplint" CODECHECK: "CPPLINT" except: - - schedules - - tags + refs: + - schedules + - tags + variables: + - $CI_COMMIT_MESSAGE =~ /\[skip cpplint\]/ + only: + changes: + - '**/*.c' + - '**/*.cpp' + - '**/*.h' eslint: - <<: *build + when: on_success + image: singapore/lint-condo stage: source_check - image: registry.gitlab.gnome.org/gnome/gjs:fedora.static-analysis - variables: - TASK_ID: "eslint" - CODECHECK: "ESLINT" + script: + - node /usr/src/lint-condo except: - - schedules - - tags + refs: + - schedules + - tags + variables: + - $CI_COMMIT_MESSAGE =~ /\[skip eslint\]/ + only: + changes: + - '**/*.js' ############################################# # Manual Jobs # @@ -281,22 +257,11 @@ codequality: except: - schedules -code_statistics: - <<: *build - stage: manual - image: registry.gitlab.gnome.org/gnome/gjs:fedora.static-analysis - variables: - TASK_ID: "code_statistics" - CODECHECK: "TOKEI" - when: manual - except: - - schedules - coverage: <<: *build <<: *coverage stage: manual - image: registry.gitlab.gnome.org/gnome/gjs:SM60-gcc.ubuntu-dev + image: registry.gitlab.gnome.org/gnome/gjs:SM60-gcc.fedora-dev variables: TASK_ID: "coverage" BUILD_OPTS: "--enable-code-coverage" @@ -308,9 +273,9 @@ coverage: sanitizer_clang: <<: *build stage: manual - image: registry.gitlab.gnome.org/gnome/gjs:SM60-gcc.ubuntu-dev + image: registry.gitlab.gnome.org/gnome/gjs:SM60-gcc.fedora-dev variables: - TASK_ID: "ubuntu-x86_64-clang_ubsan_asan-default-default-check" + TASK_ID: "fedora-x86_64-clang_ubsan_asan-default-default-check" CC: clang BUILD_OPTS: "--enable-asan --enable-ubsan" TEST: "check" @@ -318,7 +283,7 @@ sanitizer_clang: except: - schedules -fedora_gcc: +distcheck: <<: *build stage: manual image: registry.gitlab.gnome.org/gnome/gjs:SM60-gcc.fedora-dev @@ -340,30 +305,6 @@ installed_tests: except: - schedules -# Planned as weekly -ubuntu_gcc: - <<: *build - stage: manual - image: registry.gitlab.gnome.org/gnome/gjs:SM60-gcc.ubuntu-dev - variables: - TASK_ID: "ubuntu-x86_64-gcc-default-default-distcheck" - TEST: "distcheck" - when: manual - except: - - schedules - -ubuntu_clang: - <<: *build - stage: manual - image: registry.gitlab.gnome.org/gnome/gjs:SM60-gcc.ubuntu-dev - variables: - TASK_ID: "ubuntu-x86_64-clang-default-default-distcheck" - CC: clang - TEST: "distcheck" - when: manual - except: - - schedules - valgrind: <<: *build stage: manual @@ -377,26 +318,6 @@ valgrind: except: - schedules -# Flatpak packaging (weekly) -flatpak: - <<: *build - <<: *package - stage: manual - image: registry.gitlab.gnome.org/gnome/gnome-nightly-oci/nightly:master - variables: - TASK_ID: "flatpak packaging" - CODECHECK: "FLATPAK" - BUNDLE: "org.gnome.GjsDevel.flatpak" - MANIFEST: org.gnome.GjsDevel.json - RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo" - - environment: - name: review/$CI_COMMIT_REF_NAME - url: https://gitlab.gnome.org/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/raw/${BUNDLE} - when: manual - except: - - schedules - # SpiderMonkey GC Tests (weekly) zeal_2: <<: *build @@ -434,29 +355,6 @@ zeal_11: except: - schedules -# Multiarch Tests (weekly) -armv8: - <<: *multiarch - stage: manual - variables: - TASK_ID: "fedora-armv8-gcc-default-default-check" - DOCKER_DRIVER: overlay - IMAGE: "registry.gitlab.gnome.org/gnome/gjs:SM60-gcc.fedora-dev.aarch64" - when: manual - except: - - schedules - -ppc64le: - <<: *multiarch - stage: manual - variables: - TASK_ID: "fedora-ppc64le-gcc-default-default-check" - DOCKER_DRIVER: overlay - IMAGE: "registry.gitlab.gnome.org/gnome/gjs:SM60-gcc.fedora-dev.ppc64le" - when: manual - except: - - schedules - ############################################# # Create CI Docker Images # ############################################# @@ -473,20 +371,6 @@ ppc64le: # CI starts here. Previous messages are from GitLab Runner setup. - *CI_header - # Skip the build (if requested) - - | - if [[ -z "${CI_COMMIT_MESSAGE##*[skip images]*}" && -z "${CI_COMMIT_MESSAGE##*$NAME*}" ]]; then - echo "== Nothing to do ==" - exit 0 - fi - - # Get multiarch stuff - - | - if [[ -n "${TARGET_ARCH}" ]]; then - docker run --rm --privileged multiarch/qemu-user-static:register --reset - wget https://github.com/multiarch/qemu-user-static/releases/download/v2.12.0/x86_64_qemu-${TARGET_ARCH}-static.tar.gz - fi - # Build using the Dockerfile - | if [[ -n "${DOCKERFILE}" ]]; then @@ -497,7 +381,7 @@ ppc64le: - | if [[ -n "${IMAGE}" ]]; then docker run --name $NAME -v $(pwd):/on-host \ - -e BASE=$BASE -e OS=$IMAGE -e BUILD_OPTS=$BUILD_OPTS -e DEV=$DEV -e CC=gcc -e STATIC=$STATIC $IMAGE \ + -e OS=$IMAGE -e BUILD_OPTS=$BUILD_OPTS -e CC=gcc -e MOZJS_BRANCH=$MOZJS_BRANCH $IMAGE \ bash -e -c "cd /on-host && test/ci-images.sh BUILD_MOZ" docker commit $NAME "$CI_REGISTRY_IMAGE:$NAME" fi @@ -519,71 +403,36 @@ ppc64le: fedora.static-analysis: <<: *create_docker_image variables: - BASE: "fedora" DOCKER_DRIVER: overlay # https://about.gitlab.com/2019/07/31/docker-in-docker-with-docker-19-dot-03 DOCKER_TLS_CERTDIR: "" DOCKERFILE: "test/extra/Dockerfile.fedora.static-analysis" NAME: "fedora.static-analysis" + except: + variables: + - $CI_COMMIT_MESSAGE =~ /\[skip images\]/ && $CI_COMMIT_MESSAGE =~ /fedora.static-analysis/ SM60-gcc.fedora-dev: <<: *create_docker_image variables: - BASE: "fedora" - DEV: "devel" DOCKER_DRIVER: overlay # https://about.gitlab.com/2019/07/31/docker-in-docker-with-docker-19-dot-03 DOCKER_TLS_CERTDIR: "" IMAGE: "fedora:rawhide" NAME: "SM60-gcc.fedora-dev" + except: + variables: + - $CI_COMMIT_MESSAGE =~ /\[skip images\]/ && $CI_COMMIT_MESSAGE =~ /SM60-gcc.fedora-dev/ SM60-debug-gcc.fedora-dev: <<: *create_docker_image variables: - BASE: "fedora" BUILD_OPTS: "--enable-debug" - DEV: "devel" DOCKER_DRIVER: overlay # https://about.gitlab.com/2019/07/31/docker-in-docker-with-docker-19-dot-03 DOCKER_TLS_CERTDIR: "" IMAGE: "fedora:rawhide" NAME: "SM60-debug-gcc.fedora-dev" - -SM60-gcc.fedora-dev.aarch64: - <<: *create_docker_image - variables: - BASE: "fedora" - DEV: "devel" - DOCKER_DRIVER: overlay - # https://about.gitlab.com/2019/07/31/docker-in-docker-with-docker-19-dot-03 - DOCKER_TLS_CERTDIR: "" - DOCKERFILE: "test/extra/Dockerfile.arm64v8.fedora.29" - IMAGE: "${CI_REGISTRY_IMAGE}:SM60-gcc.fedora-dev.aarch64" - NAME: "SM60-gcc.fedora-dev.aarch64" - STATIC: "qemu" - TARGET_ARCH: "aarch64" - -SM60-gcc.fedora-dev.ppc64le: - <<: *create_docker_image - variables: - BASE: "fedora" - DEV: "devel" - DOCKER_DRIVER: overlay - # https://about.gitlab.com/2019/07/31/docker-in-docker-with-docker-19-dot-03 - DOCKER_TLS_CERTDIR: "" - DOCKERFILE: "test/extra/Dockerfile.ppc64le.fedora.29" - IMAGE: "${CI_REGISTRY_IMAGE}:SM60-gcc.fedora-dev.ppc64le" - NAME: "SM60-gcc.fedora-dev.ppc64le" - STATIC: "qemu" - TARGET_ARCH: "ppc64le" - -SM60-gcc.ubuntu-dev: - <<: *create_docker_image - variables: - BASE: "debian" - DEV: "devel" - DOCKER_DRIVER: overlay - # https://about.gitlab.com/2019/07/31/docker-in-docker-with-docker-19-dot-03 - DOCKER_TLS_CERTDIR: "" - IMAGE: "ubuntu:devel" - NAME: "SM60-gcc.ubuntu-dev" + except: + variables: + - $CI_COMMIT_MESSAGE =~ /\[skip images\]/ && $CI_COMMIT_MESSAGE =~ /SM60-debug-gcc.fedora-dev/ diff --git a/.lint-condo.yaml b/.lint-condo.yaml new file mode 100644 index 00000000..6da1d58c --- /dev/null +++ b/.lint-condo.yaml @@ -0,0 +1,3 @@ +--- +linters: + - eslint . --format unix @@ -1,7 +1,6 @@ [](https://gitlab.gnome.org/GNOME/gjs/pipelines) [](https://gnome.pages.gitlab.gnome.org/gjs/) [](https://gitlab.gnome.org/GNOME/gjs/graphs/master) -[](https://gnome.pages.gitlab.gnome.org/gjs/report.txt) [](https://gitlab.gnome.org/GNOME/gjs/commits/master) [](https://github.com/search?utf8=%E2%9C%93&q=gjs&type=) [](https://gitlab.gnome.org/GNOME/gjs/blob/master/COPYING) diff --git a/test/ci-images.sh b/test/ci-images.sh index 6c685e8a..a60dc8c2 100755 --- a/test/ci-images.sh +++ b/test/ci-images.sh @@ -8,7 +8,6 @@ function do_Set_Env(){ mkdir -p /on-host/.cache export XDG_CACHE_HOME=/on-host/.cache - export JHBUILD_RUN_AS_ROOT=1 export SHELL=/bin/bash PATH=$PATH:~/.local/bin @@ -26,15 +25,15 @@ if [[ -n "${BUILD_OPTS}" ]]; then extra_opts="($BUILD_OPTS)" fi -if [[ -n "${STATIC}" ]]; then - extra_opts="$extra_opts ($STATIC)" +if [[ -n "${MOZJS_BRANCH}" ]]; then + extra_opts="$extra_opts ($MOZJS_BRANCH)" fi source test/extra/do_environment.sh # Show some environment info do_Print_Labels 'ENVIRONMENT' -echo "Running on: $BASE $OS" +echo "Running on: $OS" echo "Doing: $1 $extra_opts" source test/extra/do_basic.sh diff --git a/test/extra/Dockerfile.arm64v8.fedora.29 b/test/extra/Dockerfile.arm64v8.fedora.29 deleted file mode 100644 index 92a6b03e..00000000 --- a/test/extra/Dockerfile.arm64v8.fedora.29 +++ /dev/null @@ -1,11 +0,0 @@ -FROM arm64v8/fedora:rawhide -MAINTAINER Claudio AndrĂ© (c) 2018 V1.0 - -LABEL architecture="aarch64" -LABEL version="1.0" -LABEL description="Multiarch docker image to run CI for GNOME GJS." - -ADD x86_64_qemu-aarch64-static.tar.gz /usr/bin - -CMD ["/bin/bash"] - diff --git a/test/extra/Dockerfile.fedora.static-analysis b/test/extra/Dockerfile.fedora.static-analysis index 70f62115..05b3d60a 100644 --- a/test/extra/Dockerfile.fedora.static-analysis +++ b/test/extra/Dockerfile.fedora.static-analysis @@ -6,11 +6,9 @@ LABEL version="1.0" LABEL description="Docker image to run CI for GNOME GJS (JavaScript bindings for GNOME)." RUN dnf -y --nogpgcheck upgrade && \ - dnf -y install \ - git cppcheck tokei nodejs python-devel && \ + dnf -y install git python-devel && \ mkdir -p /cwd && \ pip install cpplint && \ - npm install -g eslint && \ dnf -y clean all && \ rm -rf /var/cache/dnf diff --git a/test/extra/Dockerfile.ppc64le.fedora.29 b/test/extra/Dockerfile.ppc64le.fedora.29 deleted file mode 100644 index 400d81c3..00000000 --- a/test/extra/Dockerfile.ppc64le.fedora.29 +++ /dev/null @@ -1,11 +0,0 @@ -FROM ppc64le/fedora:rawhide -MAINTAINER Claudio AndrĂ© (c) 2018 V1.0 - -LABEL architecture="ppc64le" -LABEL version="1.0" -LABEL description="Multiarch docker image to run CI for GNOME GJS." - -ADD x86_64_qemu-ppc64le-static.tar.gz /usr/bin - -CMD ["/bin/bash"] - diff --git a/test/extra/do_basic.sh b/test/extra/do_basic.sh index aa7a6bf2..65b74160 100755 --- a/test/extra/do_basic.sh +++ b/test/extra/do_basic.sh @@ -4,65 +4,22 @@ function do_Install_Dependencies(){ echo echo '-- Installing Base Dependencies --' - if [[ $BASE == "debian" ]]; then - apt-get update - - # Base dependencies - apt-get -y install build-essential git clang patch bison flex \ - meson ninja-build python-dev python3-dev \ - autotools-dev autoconf gettext pkgconf autopoint yelp-tools \ - docbook docbook-xsl libtext-csv-perl \ - zlib1g-dev libdbus-glib-1-dev \ - libtool libicu-dev libnspr4-dev \ - policykit-1 python3-setuptools \ - libgtk-3-dev gir1.2-gtk-3.0 xvfb gnome-desktop-testing dbus-x11 dbus \ - libedit-dev libgl1-mesa-dev lcov libreadline-dev - - elif [[ $BASE == "fedora" ]]; then - if [[ $STATIC == *"qemu"* ]]; then - dnf -y --nogpgcheck upgrade --best --allowerasing - else - dnf -y upgrade --best --allowerasing - fi - - # Base dependencies - dnf -y install @c-development @development-tools clang redhat-rpm-config gnome-common python-devel \ - pygobject2 dbus-python perl-Text-CSV perl-XML-Parser gettext-devel gtk-doc \ - meson ninja-build zlib-devel libffi-devel \ - libtool libicu-devel nspr-devel systemtap-sdt-devel \ - gtk3 gtk3-devel gobject-introspection Xvfb gnome-desktop-testing dbus-x11 \ - cairo intltool libxslt bison nspr python3-devel dbus-glib libicu \ - libxslt libtool flex \ - cairo-devel zlib-devel libffi-devel pcre-devel libxml2-devel libxslt-devel \ - libedit-devel libasan libubsan libtsan compiler-rt \ - sysprof-devel lcov mesa-libGL-devel readline-devel \ - webkit2gtk3 - - if [[ $DEV == "devel" ]]; then - dnf -y install time - fi - else - echo - echo '-- Error: invalid BASE code --' - exit 1 - fi -} - -function do_Install_Extras(){ - echo - echo '-- Installing Extra Dependencies --' - - if [[ $BASE == "debian" ]]; then - # Distros development versions of needed libraries - apt-get -y install libgirepository1.0-dev libwebkit2gtk-4.0-dev notify-osd - - elif [[ $BASE == "fedora" ]]; then - # Distros development versions of needed libraries - dnf -y install gobject-introspection-devel - - if [[ $STATIC != *"qemu"* ]]; then - # Distros debug info of needed libraries - dnf -y debuginfo-install glib2-devel gobject-introspection-devel gtk3-devel expat fontconfig cairo glibc - fi - fi + dnf -y upgrade --best --allowerasing + + # Base dependencies + dnf -y install @c-development @development-tools clang redhat-rpm-config gnome-common python-devel \ + pygobject2 dbus-python perl-Text-CSV perl-XML-Parser gettext-devel gtk-doc \ + autoconf-archive meson ninja-build zlib-devel libffi-devel \ + libtool libicu-devel nspr-devel systemtap-sdt-devel \ + gtk3 gtk3-devel gobject-introspection-devel Xvfb gnome-desktop-testing dbus-x11 \ + cairo intltool libxslt bison nspr python3-devel dbus-glib libicu \ + libxslt libtool flex \ + cairo-devel zlib-devel libffi-devel pcre-devel libxml2-devel libxslt-devel \ + libedit-devel libasan libubsan libtsan compiler-rt \ + sysprof-devel lcov mesa-libGL-devel readline-devel \ + webkit2gtk3 time + + # Distros debug info of needed libraries + dnf -y debuginfo-install glib2-devel gobject-introspection-devel \ + gtk3-devel expat fontconfig cairo glibc } diff --git a/test/extra/do_docker.sh b/test/extra/do_docker.sh index 3930e3c9..b92c9899 100755 --- a/test/extra/do_docker.sh +++ b/test/extra/do_docker.sh @@ -6,14 +6,8 @@ function do_Shrink_Image(){ PATH=$PATH:~/.local/bin rm -rf ~/jhbuild/install/lib/libjs_static.ajs - if [[ $BASE == "ubuntu" ]]; then - apt-get -y clean - rm -rf /var/lib/apt/lists/* - - elif [[ $BASE == "fedora" ]]; then - dnf -y clean all - rm -rf /var/cache/dnf - fi + dnf -y clean all + rm -rf /var/cache/dnf echo '-- Done --' } @@ -21,18 +15,8 @@ function do_Shrink_Image(){ if [[ $1 == "BUILD_MOZ" ]]; then do_Install_Dependencies do_Set_Env - - if [[ $DEV == "devel" ]]; then - do_Install_Extras - fi do_Show_Info - do_Get_JHBuild - do_Build_JHBuild do_Build_Mozilla - - # Build JHBuild to create a docker image ready to go - jhbuild build m4-common - do_Shrink_Image fi # Clear the environment diff --git a/test/extra/do_environment.sh b/test/extra/do_environment.sh index 957b6ff3..514d48ce 100755 --- a/test/extra/do_environment.sh +++ b/test/extra/do_environment.sh @@ -1,86 +1,20 @@ -#!/bin/bash -e +#!/bin/sh -e -function do_Get_JHBuild(){ - do_Print_Labels 'Download JHBuild' +do_Configure_MainBuild () { + do_Print_Labels 'Set Main Build Configuration' - 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 - - # A patch is no longer required - cd /jhbuild - - echo '-- Done --' - cd - -} - -function do_Configure_JHBuild(){ - do_Print_Labels 'Set JHBuild Configuration' - - mkdir -p ~/.config - - cat <<EOFILE > ~/.config/jhbuildrc -skip = ['gettext', 'yelp-xsl', 'yelp-tools', 'gtk-doc'] -use_local_modulesets = True -EOFILE - - echo '-- Done --' -} - -function do_Configure_MainBuild(){ - do_Print_Labels 'Set Main JHBuild Configuration' - - mkdir -p ~/.config autogenargs="--enable-compile-warnings=yes" - if [[ -n "${BUILD_OPTS}" ]]; then + if test -n "$BUILD_OPTS"; then autogenargs="$autogenargs $BUILD_OPTS" fi export ci_autogenargs="$autogenargs" - cat <<EOFILE > ~/.config/jhbuildrc -module_autogenargs['gjs'] = "$autogenargs" -module_makeargs['gjs'] = '-s -j 1' -skip = ['gettext', 'yelp-xsl', 'yelp-tools', 'gtk-doc'] -use_local_modulesets = True -disable_Werror = False -EOFILE - echo '-- Done --' } -function do_Build_Package_Dependencies(){ - do_Print_Labels "Building Dependencies for $1" - jhbuild list "$1" - - # Build package dependencies - jhbuild build $(jhbuild list "$1" | sed '$d') -} - -function do_Build_JHBuild(){ - do_Print_Labels 'Building JHBuild' - - # Build JHBuild - cd /jhbuild - git log --pretty=format:"%h %cd %s" -1 - echo - ./autogen.sh PYTHON=$(which python2) - make -sj2 - make install - PATH=$PATH:~/.local/bin - - if [[ $1 == "RESET" ]]; then - git reset --hard HEAD - fi - echo '-- Done --' - cd - -} - -function do_Print_Labels(){ - - if [[ -n "${1}" ]]; then +do_Print_Labels () { + if test -n "$1"; then label_len=${#1} span=$(((54 - $label_len) / 2)) @@ -94,15 +28,13 @@ function do_Print_Labels(){ fi } -function do_Done(){ - +do_Done () { # Done. De-initializes whatever is needed do_Print_Labels 'FINISHED' } -function do_Show_Info(){ - - local compiler=gcc +do_Show_Info () { + local compiler="${CC:-gcc}" echo '-----------------------------------------' echo 'Build system information' @@ -113,10 +45,6 @@ function do_Show_Info(){ echo '-----------------------------------------' cat /etc/*-release echo '-----------------------------------------' - - if [[ ! -z $CC ]]; then - compiler=$CC - fi echo 'Compiler version' $compiler --version echo '-----------------------------------------' diff --git a/test/extra/do_mozilla.sh b/test/extra/do_mozilla.sh index ef7342f0..f3b768d4 100755 --- a/test/extra/do_mozilla.sh +++ b/test/extra/do_mozilla.sh @@ -1,46 +1,11 @@ #!/bin/bash -e -function do_Configure_MozBuild(){ - echo - echo '-- Set JHBuild Configuration --' - - mkdir -p ~/.config - autogenargs="" - - if [[ -n "${BUILD_OPTS}" ]]; then - autogenargs="$autogenargs $BUILD_OPTS" - fi - - cat <<EOFILE >> ~/.config/jhbuildrc -module_autogenargs['mozjs60'] = "$autogenargs" -module_makeargs['mozjs60'] = '-s' -EOFILE - - echo '-- Done --' -} - -function do_Build_Mozilla_jhbuild(){ - echo - echo '-- Building Mozilla SpiderMonkey --' - - # Configure the Mozilla build - do_Configure_MozBuild - - # Build Mozilla Stuff - jhbuild build mozjs60 -} - function do_Build_Mozilla(){ echo echo '-- Building Mozilla SpiderMonkey --' - if [[ $STATIC == "moz52" ]]; then - git clone --depth 1 https://github.com/ptomato/mozjs.git -b mozjs52 /on-host/spider - cd /on-host/spider - else - git clone --depth 1 https://github.com/ptomato/mozjs.git -b mozjs60 /on-host/spider - cd /on-host/spider - fi + git clone --depth 1 https://github.com/ptomato/mozjs.git -b "${MOZJS_BRANCH:-mozjs60}" /on-host/spider + cd /on-host/spider mkdir -p _build cd _build diff --git a/test/gjs-test-coverage.cpp b/test/gjs-test-coverage.cpp index d477d5ec..78ed0dd3 100644 --- a/test/gjs-test-coverage.cpp +++ b/test/gjs-test-coverage.cpp @@ -792,7 +792,8 @@ hit_count_is_more_than_for_function(const char *line, max_buf_size = strcspn(line, "\n"); detected_function = g_new(char, max_buf_size + 1); - nmatches = sscanf(line, "%u,%s", &hit_count, detected_function); + GjsAutoChar format_string = g_strdup_printf("%%5u,%%%zus", max_buf_size); + nmatches = sscanf(line, format_string, &hit_count, detected_function); g_assert_cmpint(nmatches, ==, 2); g_assert_cmpstr(data->function, ==, detected_function); diff --git a/test/org.gnome.GjsDevel.json b/test/org.gnome.GjsDevel.json deleted file mode 100644 index 659e6aee..00000000 --- a/test/org.gnome.GjsDevel.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "id": "org.gnome.GjsDevel", - "branch": "master", - "runtime": "org.gnome.Platform", - "runtime-version": "master", - "sdk": "org.gnome.Sdk", - "command": "gjs-console", - "tags": ["unstable", "development"], - "finish-args": [ - "--filesystem=host", - "--share=ipc", - "--share=network", - "--device=dri", - "--socket=x11", - "--socket=wayland", - "--socket=pulseaudio" - ], - "modules": [ - { - "name": "sysprof", - "builddir": true, - "buildsystem": "meson", - "config-opts": [ - "-Denable_gtk=false", - "-Dhelp=false", - "-Dlibsysprof=false", - "-Dwith_sysprofd=none" - ], - "sources": [ - { - "type": "git", - "branch": "master", - "url": "https://gitlab.gnome.org/GNOME/sysprof.git" - } - ] - }, - { - "name": "gjs", - "builddir": true, - "config-opts": [ - "--enable-profiler" - ], - "sources": [ - { - "type": "git", - "branch": "HEAD", - "path": "." - } - ] - } - ] -} diff --git a/test/test-ci.sh b/test/test-ci.sh index bbc2921e..166a4919 100755 --- a/test/test-ci.sh +++ b/test/test-ci.sh @@ -1,7 +1,6 @@ -#!/bin/bash -e - -function do_Set_Env(){ +#!/bin/sh -e +do_Set_Env () { #Save cache on $pwd (required by artifacts) mkdir -p "$(pwd)"/.cache XDG_CACHE_HOME="$(pwd)"/.cache @@ -18,21 +17,21 @@ function do_Set_Env(){ export SHELL=/bin/bash PATH=$PATH:~/.local/bin - if [[ -z "${DISPLAY}" ]]; then - export DISPLAY=":0" - fi + export DISPLAY="${DISPLAY:-:0}" } -function do_Get_Upstream_Master(){ - - if [[ "$CI_PROJECT_PATH_SLUG" == "gnome-gjs" && \ - ("$CI_BUILD_REF_SLUG" == "master" || "$CI_BUILD_REF_SLUG" == "gnome-"* || -n "${CI_COMMIT_TAG}") ]]; then - echo '-----------------------------------------' - echo 'Running against upstream' - echo "=> $1 Nothing to do" - - do_Done - exit 0 +do_Get_Upstream_Master () { + if test "$CI_PROJECT_PATH_SLUG" = "gnome-gjs"; then + if test "$CI_BUILD_REF_SLUG" = "master" -o \ + "$CI_BUILD_REF_SLUG" = "gnome-"* -o \ + -n "$CI_COMMIT_TAG"; then + echo '-----------------------------------------' + echo 'Running against upstream' + echo "=> $1 Nothing to do" + + do_Done + exit 0 + fi fi echo '-----------------------------------------' @@ -43,13 +42,15 @@ function do_Get_Upstream_Master(){ echo '-----------------------------------------' } -function do_Compare_With_Upstream_Master(){ - +do_Compare_With_Upstream_Master () { echo '-----------------------------------------' echo 'Compare the working code with upstream master' - NEW_WARNINGS=$(comm -13 <(sort < /cwd/master-report.txt) <(sort < /cwd/current-report.txt) | wc -l) - REMOVED_WARNINGS=$(comm -23 <(sort < /cwd/master-report.txt) <(sort < /cwd/current-report.txt) | wc -l) + sort < /cwd/master-report.txt > /cwd/master-report-sorted.txt + sort < /cwd/current-report.txt > /cwd/current-report-sorted.txt + + NEW_WARNINGS=$(comm -13 /cwd/master-report-sorted.txt /cwd/current-report-sorted.txt | wc -l) + REMOVED_WARNINGS=$(comm -23 /cwd/master-report-sorted.txt /cwd/current-report-sorted.txt | wc -l) if test "$NEW_WARNINGS" -ne 0; then echo '-----------------------------------------' echo "### $NEW_WARNINGS new warning(s) found by $1 ###" @@ -63,19 +64,17 @@ function do_Compare_With_Upstream_Master(){ fi } -function do_Create_Artifacts_Folder(){ - +do_Create_Artifacts_Folder () { # Create the artifacts folders save_dir="$(pwd)" - if [[ $1 == "GJS_COVERAGE" ]]; then + if test "$1" = "GJS_COVERAGE"; then mkdir -p "$save_dir"/coverage; touch "$save_dir"/coverage/doing-"$1" fi mkdir -p "$save_dir"/analysis; touch "$save_dir"/analysis/doing-"$1" } -function do_Get_Commit_Message(){ - +do_Get_Commit_Message () { # Allow CI to skip jobs. Its goal is to simplify housekeeping. # Disable tasks using the commit message. Possibilities are (and/or): # [skip eslint] [skip cpplint] [skip cppcheck] @@ -84,8 +83,7 @@ function do_Get_Commit_Message(){ log_message=$(git log -n 1) } -function do_Check_Warnings(){ - +do_Check_Warnings () { local total=0 cat compilation.log | grep "warning:" | awk '{total+=1}END{print "Total number of warnings: "total}' @@ -97,7 +95,7 @@ function do_Check_Warnings(){ total=$(awk '{total+=1}END{print total}' warnings.log) - if [[ $total > 0 ]]; then + if test "$total" -gt 0; then echo '-----------------------------------------' echo "### $total new warning(s) found by compiler ###" echo '-----------------------------------------' @@ -107,12 +105,11 @@ function do_Check_Warnings(){ fi } -function do_Check_Script_Errors(){ - +do_Check_Script_Errors () { local total=0 total=$(cat scripts.log | grep 'not ok ' | awk '{total+=1}END{print total}') - if [[ $total > 0 ]]; then + if test "$total" -gt 0; then echo '-----------------------------------------' echo "### Found $total errors on scripts.log ###" echo '-----------------------------------------' @@ -121,11 +118,11 @@ function do_Check_Script_Errors(){ } # ----------- Run the Tests ----------- -if [[ -n "${TEST}" ]]; then +if test -n "$TEST"; then extra_opts="($TEST)" fi -source test/extra/do_environment.sh +. test/extra/do_environment.sh # Show some environment info do_Print_Labels 'ENVIRONMENT' @@ -137,19 +134,10 @@ echo "Doing: $1 $extra_opts" do_Create_Artifacts_Folder "$1" do_Get_Commit_Message -if [[ $1 == "GJS" ]]; then +if test "$1" = "GJS"; then do_Set_Env do_Show_Info - if [[ "$DEV" == "jhbuild" ]]; then - do_Get_JHBuild - do_Build_JHBuild - do_Configure_JHBuild - do_Build_Package_Dependencies gjs - - else - mkdir -p ~/jhbuild/checkout/gjs - fi do_Configure_MainBuild # Build and test the latest commit (merged or from a merge/pull request) of @@ -159,53 +147,42 @@ if [[ $1 == "GJS" ]]; then do_Print_Labels 'Do the GJS build' - if [[ "$DEV" == "jhbuild" ]]; then - cp -r ./ ~/jhbuild/checkout/gjs - cd ~/jhbuild/checkout/gjs + export AM_DISTCHECK_CONFIGURE_FLAGS="--enable-compile-warnings=yes" - jhbuild make --check - else - export AM_DISTCHECK_CONFIGURE_FLAGS="--enable-compile-warnings=yes" - - # Regular (autotools only) build - echo "Autogen options: $ci_autogenargs" - eval ./autogen.sh "$ci_autogenargs" + # Regular (autotools only) build + echo "Autogen options: $ci_autogenargs" + eval ./autogen.sh "$ci_autogenargs" - make -sj 2>&1 | tee compilation.log + make -sj 2>&1 | tee compilation.log - if [[ $TEST == "distcheck" ]]; then - xvfb-run -a make -s distcheck - elif [[ $TEST == "check" ]]; then - xvfb-run -a make -s check - fi - make -sj install + if test "$TEST" = "distcheck"; then + xvfb-run -a make -s distcheck + elif test "$TEST" = "check"; then + xvfb-run -a make -s check fi + make -sj install - if [[ $WARNINGS == "count" ]]; then + if test "$WARNINGS" = "count"; then do_Print_Labels 'Warnings Report ' do_Check_Warnings do_Print_Labels fi -elif [[ $1 == "GJS_EXTRA" ]]; then +elif test "$1" = "GJS_EXTRA"; then # It doesn't (re)build, just run the 'Installed Tests' do_Print_Labels 'Run GJS installed tests' do_Set_Env - if [[ "$DEV" == "jhbuild" ]]; then - xvfb-run -a jhbuild run dbus-run-session -- gnome-desktop-testing-runner gjs - else - xvfb-run -a dbus-run-session -- gnome-desktop-testing-runner gjs - fi + xvfb-run -a dbus-run-session -- gnome-desktop-testing-runner gjs -elif [[ $1 == "VALGRIND" ]]; then +elif test "$1" = "VALGRIND"; then # It doesn't (re)build, just run the 'Valgrind Tests' do_Print_Labels 'Valgrind Report' do_Set_Env make check-valgrind -elif [[ $1 == "SH_CHECKS" ]]; then +elif test "$1" = "SH_CHECKS"; then # It doesn't (re)build, just run the 'Tests' do_Print_Labels 'Shell Scripts Check' do_Set_Env @@ -218,7 +195,7 @@ elif [[ $1 == "SH_CHECKS" ]]; then installed-tests/scripts/testExamples.sh > scripts.log do_Check_Script_Errors -elif [[ $1 == "GJS_COVERAGE" ]]; then +elif test "$1" = "GJS_COVERAGE"; then # It doesn't (re)build, just run the 'Coverage Tests' do_Print_Labels 'Code Coverage Report' do_Set_Env @@ -231,24 +208,7 @@ elif [[ $1 == "GJS_COVERAGE" ]]; then sed -e 's/<[^>]*>//g' "$save_dir"/coverage/index.html | tr -d ' \t' | grep -A3 -P '^Lines:$' | tr '\n' ' '; echo echo '-----------------------------------------' -elif [[ $1 == "CPPCHECK" && "$log_message" != *'[skip cppcheck]'* ]]; then - do_Print_Labels 'Static code analyzer report ' - - cppcheck --inline-suppr --enable=warning,performance,portability,information,missingInclude --force -q . 2>&1 | \ - tee "$save_dir"/analysis/current-report.txt | sed -E 's/:[0-9]+]/:LINE]/g' > /cwd/current-report.txt - cat "$save_dir"/analysis/current-report.txt - echo - - # Get the code committed at upstream master - do_Get_Upstream_Master "cppCheck" - cppcheck --inline-suppr --enable=warning,performance,portability,information,missingInclude --force -q . 2>&1 | \ - tee "$save_dir"/analysis/master-report.txt | sed -E 's/:[0-9]+]/:LINE]/g' > /cwd/master-report.txt - echo - - # Compare the report with master and fail if new warnings are found - do_Compare_With_Upstream_Master "cppCheck" - -elif [[ $1 == "CPPLINT" && "$log_message" != *'[skip cpplint]'* ]]; then +elif test "$1" = "CPPLINT"; then do_Print_Labels 'C/C++ Linter report ' cpplint --quiet $(find . -name \*.cpp -or -name \*.c -or -name \*.h | sort) 2>&1 >/dev/null | \ @@ -268,45 +228,6 @@ elif [[ $1 == "CPPLINT" && "$log_message" != *'[skip cpplint]'* ]]; then # Compare the report with master and fail if new warnings are found do_Compare_With_Upstream_Master "cppLint" - -elif [[ $1 == "ESLINT" && "$log_message" != *'[skip eslint]'* ]]; then - do_Print_Labels 'Javascript Linter report' - - tmp_path=$(dirname "$CI_PROJECT_DIR") - - eslint examples installed-tests modules --format unix 2>&1 | \ - tee "$save_dir"/analysis/current-report.txt | \ - sed -E -e 's/:[0-9]+:[0-9]+:/:LINE:COL:/' -e 's/[0-9]+ problems//' -e 's/\/root\/tmp-upstream//' -e "s,$tmp_path,," \ - > /cwd/current-report.txt - cat "$save_dir"/analysis/current-report.txt - echo - - # Get the code committed at upstream master - do_Get_Upstream_Master "esLint" - cp "$save_dir"/.eslint* . - eslint examples installed-tests modules --format unix 2>&1 | \ - tee "$save_dir"/analysis/master-report.txt | \ - sed -E -e 's/:[0-9]+:[0-9]+:/:LINE:COL:/' -e 's/[0-9]+ problems//' -e 's/\/root\/tmp-upstream//' -e "s,$tmp_path,," \ - > /cwd/master-report.txt - echo - - # Compare the report with master and fail if new warnings are found - do_Compare_With_Upstream_Master "esLint" - -elif [[ $1 == "TOKEI" ]]; then - do_Print_Labels 'Project statistics' - - tokei . | tee "$save_dir"/analysis/report.txt - -elif [[ $1 == "FLATPAK" ]]; then - do_Print_Labels 'Flatpak packaging' - - # Move the manifest file to the root folder - cp "test/$MANIFEST" . - - flatpak-builder --version - flatpak-builder --bundle-sources --repo=devel build "$MANIFEST" - flatpak build-bundle devel ${BUNDLE} --runtime-repo=${RUNTIME_REPO} org.gnome.GjsDevel fi # Releases stuff and finishes |
