[gjs/iwyu-job: 2/3] CI: Add iwyu job



commit 8672b33d0e7b1b1c8d5cadaa6414637973b7e48b
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Jun 2 21:42:37 2020 -0700

    CI: Add iwyu job
    
    FIXME: needs commit message

 .gitlab-ci.yml              | 20 ++++++++++--
 test/extra/Dockerfile.debug | 77 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+), 2 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2e74055c..98e4030c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -188,6 +188,16 @@ eslint:
       - .eslintrc.yml
       - '**/.eslintrc.yml'
 
+iwyu:
+  when: on_success
+  stage: source_check
+  image: registry.gitlab.gnome.org/ptomato/gjs:fedora.mozjs68-debug
+  script:
+    - git describe $CI_MERGE_REQUEST_TARGET_BRANCH_SHA
+    - ./tools/run_iwyu.sh $CI_MERGE_REQUEST_TARGET_BRANCH_SHA
+  only:
+    - merge_requests
+
 #############################################
 #                Manual Jobs                #
 #############################################
@@ -199,6 +209,13 @@ coverage:
   except:
     - schedules
 
+iwyu-full:
+  when: manual
+  stage: manual
+  image: registry.gitlab.gnome.org/ptomato/gjs:fedora.mozjs68-debug
+  script:
+    - ./tools/run_iwyu.sh
+
 sanitizer_clang:
   <<: *build
   stage: manual
@@ -329,5 +346,4 @@ fedora.mozjs68-debug:
   <<: *create_docker_image
   variables:
     <<: *docker_variables
-    DOCKERFILE: test/extra/Dockerfile
-    ARGS: "--build-arg BUILD_OPTS=--enable-debug"
+    DOCKERFILE: test/extra/Dockerfile.debug
diff --git a/test/extra/Dockerfile.debug b/test/extra/Dockerfile.debug
new file mode 100644
index 00000000..fd3dd6b6
--- /dev/null
+++ b/test/extra/Dockerfile.debug
@@ -0,0 +1,77 @@
+# === Build stage ===
+
+FROM fedora:32 AS build
+ARG MOZJS_BRANCH=mozjs68
+ARG BUILD_OPTS=
+
+ENV SHELL=/bin/bash
+
+RUN dnf -y install 'dnf-command(builddep)' clang-devel cmake git llvm-devel \
+    make ninja-build which
+RUN dnf -y builddep mozjs68
+
+WORKDIR /root
+
+ADD https://include-what-you-use.org/downloads/include-what-you-use-0.14.src.tar.gz /root/
+RUN tar xzf include-what-you-use-0.14.src.tar.gz
+RUN mkdir -p include-what-you-use/_build
+
+WORKDIR /root/include-what-you-use/_build
+
+RUN cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr ..
+RUN ninja
+RUN DESTDIR=/root/iwyu-install ninja install
+
+WORKDIR /root
+
+RUN git clone --depth 1 https://github.com/ptomato/mozjs.git -b ${MOZJS_BRANCH}
+RUN mkdir -p mozjs/_build
+
+WORKDIR /root/mozjs/_build
+
+RUN ../js/src/configure --prefix=/usr --libdir=/usr/lib64 --disable-jemalloc \
+    --enable-posix-nspr-emulation --enable-unaligned-private-values \
+    --with-system-zlib --with-intl-api --enable-debug AUTOCONF=autoconf \
+    ${BUILD_OPTS}
+RUN make -j$(nproc)
+RUN DESTDIR=/root/mozjs-install make install
+RUN rm -f /root/mozjs-install/usr/lib64/libjs_static.ajs
+
+# === Actual Docker image ===
+
+FROM fedora:32
+
+ENV SHELL=/bin/bash
+
+# List is comprised of base dependencies for CI scripts, gjs, and debug packages
+# needed for informative stack traces, e.g. in Valgrind.
+#
+# Do everything in one RUN command so that the dnf cache is not cached in the
+# final Docker image.
+RUN dnf -y install --enablerepo=fedora-debuginfo,updates-debuginfo \
+    binutils cairo-debuginfo cairo-debugsource cairo-gobject-devel clang \
+    compiler-rt dbus-daemon diffutils fontconfig-debuginfo \
+    fontconfig-debugsource gcc-c++ git glib2-debuginfo glib2-debugsource \
+    glib2-devel glibc-debuginfo glibc-debuginfo-common gnome-desktop-testing \
+    gobject-introspection-debuginfo gobject-introspection-debugsource \
+    gobject-introspection-devel gtk3-debuginfo gtk3-debugsource gtk3-devel \
+    gtk4-debuginfo gtk4-debugsource gtk4-devel lcov libasan libubsan libtsan \
+    meson ninja-build pkgconf readline-devel sysprof-devel systemtap-sdt-devel \
+    valgrind which Xvfb xz && \
+    dnf clean all && rm -rf /var/cache/dnf
+
+COPY --from=build /root/mozjs-install/usr /usr
+COPY --from=build /root/iwyu-install/usr /usr
+RUN ln -s /usr/bin/iwyu_tool.py /usr/bin/iwyu_tool
+
+# Enable sudo for wheel users
+RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' \
+    /etc/sudoers
+
+ENV HOST_USER_ID 5555
+RUN useradd -u $HOST_USER_ID -G wheel -ms /bin/bash user
+
+USER user
+WORKDIR /home/user
+
+ENV LANG C.UTF-8


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