[libsoup] ci: Add Dockerfile
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] ci: Add Dockerfile
- Date: Mon, 17 Dec 2018 15:49:46 +0000 (UTC)
commit 5242cd9068b5a61ba5370642b0774f16331ef10c
Author: Xavier Claessens <xavier claessens collabora com>
Date: Mon Dec 10 21:17:13 2018 -0500
ci: Add Dockerfile
It is a waste of time to reinstall all fedora packages for each job.
Copy and adapt Dockerfile and scripts from glib.
.gitlab-ci.yml | 39 ++++++++++++++++++++-------------------
.gitlab-ci/Dockerfile | 25 +++++++++++++++++++++++++
.gitlab-ci/README.md | 23 +++++++++++++++++++++++
.gitlab-ci/run-docker.sh | 18 ++++++++++++++++++
4 files changed, 86 insertions(+), 19 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d2710039..a181736c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,27 +1,28 @@
-image: fedora:28
+image: registry.gitlab.gnome.org/gnome/libsoup/master:v1
-variables:
- ADDITIONAL_DEPENDENCIES: which gtk-doc libpsl-devel make httpd php php-xmlrpc mod_ssl redhat-rpm-config
- USER: user
- BUILDDIR: $CI_PROJECT_DIR/build
+fedora-autotools-x86_64:
+ tags:
+ - non_aws
+ script:
+ - mkdir -p _build
+ - cd _build
+ - ../autogen.sh
+ - make
+ - make check
+ artifacts:
+ paths:
+ - _build/config.log
+ - _build/tests/test-suite.log
+ when: on_failure
-build:
+fedora-meson-x86_64:
tags:
- non_aws
- before_script:
- - dnf update -y --nogpgcheck
- - dnf install -y 'dnf-command(builddep)'
- - dnf builddep -y --nogpgcheck libsoup
- - dnf install -y --nogpgcheck $ADDITIONAL_DEPENDENCIES
script:
- - adduser $USER
- - su -c 'mkdir -p $BUILDDIR' $USER
- - cd $BUILDDIR
- - su -c $CI_PROJECT_DIR/autogen.sh $USER
- - su -c make $USER
- - su -c 'make check' $USER
+ - meson _build
+ - ninja -C _build
+ - ninja -C _build test
artifacts:
paths:
- - $BUILDDIR/config.log
- - $BUILDDIR/tests/test-suite.log
+ - "_build/meson-logs"
when: on_failure
diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile
new file mode 100644
index 00000000..b8ce5e8c
--- /dev/null
+++ b/.gitlab-ci/Dockerfile
@@ -0,0 +1,25 @@
+FROM fedora:29
+
+RUN dnf update -y \
+ && dnf install -y 'dnf-command(builddep)' \
+ && dnf builddep -y libsoup \
+ && dnf install -y which \
+ gtk-doc \
+ libpsl-devel \
+ make \
+ httpd \
+ php \
+ php-xmlrpc \
+ mod_ssl \
+ redhat-rpm-config \
+ meson \
+ && dnf clean all
+
+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.UTF-8
diff --git a/.gitlab-ci/README.md b/.gitlab-ci/README.md
new file mode 100644
index 00000000..41dfd755
--- /dev/null
+++ b/.gitlab-ci/README.md
@@ -0,0 +1,23 @@
+# CI support stuff
+
+## Docker image
+
+GitLab CI jobs run in a Docker image, defined here. To update that image
+(perhaps to install some more packages):
+
+1. Edit `.gitlab-ci/Dockerfile` with the changes you want
+2. Edit `.gitlab-ci/run-docker.sh` and bump the version in `TAG`
+3. Run `.gitlab-ci/run-docker.sh` to build the new image, and launch a shell
+ inside it
+ * When you're done, exit the shell in the usual way
+4. Run `.gitlab-ci/run-docker.sh --push` to upload the new image to the GNOME
+ GitLab Docker registry
+ * If this is the first time you're doing this, you'll need to log into the
+ registry
+ * If you use 2-factor authentication on your GNOME GitLab account, you'll
+ need to [create a personal access token][pat] and use that rather than
+ your normal password
+5. Edit `.gitlab-ci.yml` (in the root of this repository) to use your new
+ image
+
+[pat]: https://gitlab.gnome.org/profile/personal_access_tokens
diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh
new file mode 100755
index 00000000..f34ccbdf
--- /dev/null
+++ b/.gitlab-ci/run-docker.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+set -e
+
+TAG="registry.gitlab.gnome.org/gnome/libsoup/master:v1"
+
+cd "$(dirname "$0")"
+docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
+ --file "Dockerfile" .
+
+if [ "$1" = "--push" ]; then
+ docker login registry.gitlab.gnome.org
+ docker push $TAG
+else
+ docker run --rm \
+ --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
+ --tty --interactive "${TAG}" bash
+fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]