[epiphany/gnome-40] Bring back the custom CI container



commit 2d549d1769cbc7f5826789612d63872d3dea326a
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Apr 28 13:49:23 2021 -0500

    Bring back the custom CI container
    
    This is based on Jan-Michael's previous work, modified to use our custom
    container image with scan-build as well, and to retain the eslint check.
    
    
    (cherry picked from commit e86d01de69ebed244c7482266ddf122412f4cdda)

 .gitlab-ci.yml           | 15 ++++++---------
 .gitlab-ci/Dockerfile    | 16 ++++++++++++++++
 .gitlab-ci/README.md     | 23 +++++++++++++++++++++++
 .gitlab-ci/run-docker.sh | 18 ++++++++++++++++++
 4 files changed, 63 insertions(+), 9 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 896ba4d61..bbae1d127 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -16,11 +16,8 @@ stages:
   - test
 
 check-code-style:
-  image: alpine:latest
+  image: registry.gitlab.gnome.org/gnome/epiphany/master:v2
   interruptible: true
-  before_script:
-    - apk update && apk add uncrustify bash python3 nodejs nodejs-npm
-    - npm install -g eslint
   script:
     - bash data/check-code-style
     - eslint -o eslint-report.txt --no-color embed/web-process-extension/resources/js/ || { cat $ESLINT_LOG; 
false; }
@@ -43,14 +40,14 @@ flatpak master:
   only:
     - master
 
-flatpak scanbuild:
-  extends: '.flatpak'
+scanbuild:
+  image: registry.gitlab.gnome.org/gnome/epiphany/master:v2
   variables:
     CONFIG_OPTS: '-Dprofile=Devel -Dunit_tests=enabled --werror'
   script:
-    - flatpak-builder --user --disable-rofiles-fuse --stop-at=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
-    - flatpak build flatpak_app meson --prefix=/app ${CONFIG_OPTS} _build
-    - flatpak build flatpak_app ninja -C _build scan-build
+    - mkdir _build
+    - meson ${CONFIG_OPTS} _build
+    - ninja -C _build scan-build
     - bash -c 'if [[ -n "$(ls -A _build/meson-logs/scanbuild/)" ]]; then echo "Scan build log found, 
assuming defects exist"; exit 1; fi'
   artifacts:
     when: on_failure
diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile
new file mode 100644
index 000000000..ab651238d
--- /dev/null
+++ b/.gitlab-ci/Dockerfile
@@ -0,0 +1,16 @@
+FROM fedora:34
+
+RUN dnf update -y \
+    && dnf install -y uncrustify git nodejs clang-analyzer 'dnf-command(builddep)' \
+    && dnf builddep -y epiphany \
+    && dnf clean all
+RUN npm install -g eslint
+
+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 000000000..41dfd7559
--- /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 000000000..c83229c26
--- /dev/null
+++ b/.gitlab-ci/run-docker.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+set -e
+
+TAG="registry.gitlab.gnome.org/gnome/epiphany/master:v2"
+
+cd "$(dirname "$0")"
+
+podman build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" --file "Dockerfile" --format=docker .
+
+if [ "$1" = "--push" ]; then
+  podman login registry.gitlab.gnome.org
+  podman push $TAG
+else
+  podman 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]