Add gitlab-ci support using a prebuilt docker image
authorChristoph Reiter <creiter@src.gnome.org>
Tue, 13 Feb 2018 16:21:18 +0000 (17:21 +0100)
committerChristoph Reiter <creiter@src.gnome.org>
Sun, 4 Mar 2018 09:52:49 +0000 (10:52 +0100)
This uses autotools and just calls make

.gitlab-ci.yml [new file with mode: 0644]
.gitlab-ci/Dockerfile [new file with mode: 0644]
.gitlab-ci/run-docker.sh [new file with mode: 0755]
.gitlab-ci/test-docker.sh [new file with mode: 0755]

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..a2e32a2
--- /dev/null
@@ -0,0 +1,18 @@
+image: lazka/gitlab-gtk-3-22:v1
+
+stages:
+  - build
+
+before_script:
+  - mkdir -p _ccache
+  - export CCACHE_BASEDIR=${PWD}
+  - export CCACHE_DIR=${PWD}/_ccache
+
+cache:
+  paths:
+    - _ccache/
+
+build:
+  stage: build
+  script:
+   - bash -x ./.gitlab-ci/test-docker.sh
diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile
new file mode 100644 (file)
index 0000000..f0c5372
--- /dev/null
@@ -0,0 +1,60 @@
+FROM fedora:27
+
+RUN dnf -y install \
+    adwaita-icon-theme \
+    atk-devel \
+    at-spi2-atk-devel \
+    avahi-gobject-devel \
+    cairo-devel \
+    cairo-gobject-devel \
+    ccache \
+    colord-devel \
+    cups-devel \
+    fribidi-devel \
+    gcc \
+    gcc-c++ \
+    gdk-pixbuf2-devel \
+    gdk-pixbuf2-modules \
+    gettext \
+    gettext-devel \
+    git \
+    glib2-devel \
+    gobject-introspection-devel \
+    graphene-devel \
+    gtk-doc \
+    hicolor-icon-theme \
+    itstool \
+    json-glib-devel \
+    libepoxy-devel \
+    libmount-devel \
+    librsvg2 \
+    libXcomposite-devel \
+    libXcursor-devel \
+    libXcursor-devel \
+    libXdamage-devel \
+    libXfixes-devel \
+    libXi-devel \
+    libXinerama-devel \
+    libxkbcommon-devel \
+    libXrandr-devel \
+    libXrender-devel \
+    make \
+    mesa-libEGL-devel \
+    mesa-libwayland-egl-devel \
+    meson \
+    pango-devel \
+    redhat-rpm-config \
+    vulkan-devel \
+    wayland-devel \
+    wayland-protocols-devel \
+    xorg-x11-server-Xvfb
+
+ARG HOST_USER_ID=5555
+ENV HOST_USER_ID ${HOST_USER_ID}
+RUN useradd -u $HOST_USER_ID -ms /bin/bash user
+
+USER user
+WORKDIR /home/user
+
+ENV LANG C.utf8
+ENV PATH="/usr/lib64/ccache:${PATH}"
diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh
new file mode 100755 (executable)
index 0000000..699d209
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# This script builds an image from the Dockerfile, starts a container with
+# the parent directory mounted as working directory and start a bash session
+# there so you can test things.
+# Once you are happy you can push it to the docker hub:
+#     sudo docker push "${TAG}"
+
+set -e
+
+TAG="lazka/gitlab-gtk-3-22:v1"
+
+# HOST_USER_ID gets used to create a user with the same ID so that files
+# created in the mounted volume have the same owner
+sudo docker build \
+    --build-arg HOST_USER_ID="$UID" --tag "${TAG}" --file "Dockerfile" .
+sudo docker run \
+    --rm --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
+    --tty --interactive "${TAG}" bash
diff --git a/.gitlab-ci/test-docker.sh b/.gitlab-ci/test-docker.sh
new file mode 100755 (executable)
index 0000000..da7b4d5
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+set -e
+
+./autogen.sh
+make -j8