[epiphany] ci: Add new build step publishing builds including WebKitGTK nightlies
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] ci: Add new build step publishing builds including WebKitGTK nightlies
- Date: Mon, 2 Aug 2021 12:04:05 +0000 (UTC)
commit accd0c61df833e0fd9f1437e5018294f72a7a064
Author: Philippe Normand <philn igalia com>
Date: Sun Jul 25 12:56:10 2021 +0100
ci: Add new build step publishing builds including WebKitGTK nightlies
WebKitGTK nightlies are downloaded from the Igalia built-products website. The
resulting Epiphany flatpak builds depend on the WebKit Flatpak SDK runtime.
Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/989>
.gitlab-ci.yml | 46 +++++++++
generate-canary-manifest.py | 110 ++++++++++++++++++++
org.gnome.Epiphany.Canary.json.in | 212 ++++++++++++++++++++++++++++++++++++++
3 files changed, 368 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9d77d4f1a..568e49cab 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -68,3 +68,49 @@ nightly:
extends: '.publish_nightly'
stage: .post
dependencies: ['flatpak master']
+
+canary:
+ image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master'
+ stage: 'test'
+ interruptible: true
+ tags:
+ - flatpak
+ variables:
+ SDK_REPO: 'https://software.igalia.com/flatpak-refs/webkit-sdk.flatpakrepo'
+ BUNDLE: 'epiphany-canary.flatpak'
+ script:
+ - pip3 install --user requests
+ # TODO: Switch to debug? 5GB downloads though.
+ - python generate-canary-manifest.py --release
+ - flatpak remote-add --user --if-not-exists webkit-sdk ${SDK_REPO}
+ - flatpak-builder --user --install-deps-from=webkit-sdk --disable-rofiles-fuse --repo=repo
canary_flatpak_app org.gnome.Epiphany.Canary.json
+ - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${SDK_REPO} org.gnome.Epiphany.Canary
+ - tar cf canary-repo.tar repo/
+ - rm -rf canary-repo canary_flatpak_app org.gnome.Epiphany.Canary.json webkitgtk.zip
+
+ artifacts:
+ name: 'Canary Flatpak artifacts'
+ expose_as: 'Get Canary Flatpak bundle here'
+ when: 'always'
+ paths:
+ - "${BUNDLE}"
+ - "canary-repo.tar"
+ expire_in: 14 days
+ cache:
+ - key: "$CI_JOB_NAME"
+ paths:
+ - '.flatpak-builder/downloads'
+ - '.flatpak-builder/git'
+ - key: "$CI_JOB_NAME"
+ paths:
+ - '.flatpak-builder/cache'
+ - '.flatpak-builder/ccache'
+ except:
+ - gnome-*
+
+canary nightly:
+ extends: '.publish_nightly'
+ stage: .post
+ dependencies: ['canary']
+ before_script:
+ - mv canary-repo.tar repo.tar
diff --git a/generate-canary-manifest.py b/generate-canary-manifest.py
new file mode 100644
index 000000000..1e62ea819
--- /dev/null
+++ b/generate-canary-manifest.py
@@ -0,0 +1,110 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2021 Igalia S.L.
+#
+# This file is part of Epiphany.
+#
+# Epiphany is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Epiphany is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Epiphany. If not, see <http://www.gnu.org/licenses/>.
+
+from html.parser import HTMLParser
+import argparse
+import hashlib
+import json
+import os
+import re
+import sys
+import urllib.request
+import requests
+
+ZIP_FILE = "webkitgtk.zip"
+
+# FIXME: Might be worth adding some JSON file listing builds on the servers.
+class MyHTMLParser(HTMLParser):
+ builds = []
+ def handle_starttag(self, tag, attrs):
+ if tag != "a":
+ return
+ for (name, value) in attrs:
+ if name == "href" and (value.startswith("release") or value.startswith("debug")):
+ self.builds.append(value)
+
+def download_zipped_build(build_type):
+ url = f"https://webkitgtk-{build_type}.igalia.com/built-products/"
+ with urllib.request.urlopen(url) as page_fd:
+ parser = MyHTMLParser()
+ parser.feed(page_fd.read().decode("utf-8"))
+ try:
+ latest = parser.builds[-1]
+ except IndexError:
+ print(f"No build found in {url}")
+ return ("", "")
+
+ print(f"Downloading build {latest} from {url}")
+ zip_file = open(ZIP_FILE, "wb")
+
+ # https://sumit-ghosh.com/articles/python-download-progress-bar/
+ response = requests.get(f"{url}/{latest}", stream=True)
+ total = response.headers.get('content-length')
+ h = hashlib.new('sha256')
+ if total is None:
+ h.update(response.content)
+ zip_file.write(response.content)
+ else:
+ downloaded = 0
+ total = int(total)
+ for data in response.iter_content(chunk_size=max(int(total / 1000), 1024 * 1024)):
+ downloaded += len(data)
+ h.update(data)
+ zip_file.write(data)
+ done = int(50 * downloaded / total)
+ sys.stdout.write('\r[{}{}]'.format('█' * done, '.' * (50 - done)))
+ sys.stdout.flush()
+ sys.stdout.write('\n')
+ checksum = h.hexdigest()
+ return (ZIP_FILE, checksum)
+
+def main(args):
+ parser = argparse.ArgumentParser()
+ type_group = parser.add_mutually_exclusive_group()
+ type_group.add_argument("--debug", help="Download a debug build.",
+ dest='build_type', action="store_const", const="Debug")
+ type_group.add_argument("--release", help="Download a release build.",
+ dest='build_type', action="store_const", const="Release")
+
+ if len(args) == 0:
+ parser.print_help(sys.stderr)
+ return 1
+
+ parsed, _ = parser.parse_known_args(args=args)
+ zip_filename, checksum = download_zipped_build(parsed.build_type.lower())
+ if not zip_filename:
+ return 2
+
+ manifest_path = "org.gnome.Epiphany.Canary.json"
+ with open(f"{manifest_path}.in") as fd_in:
+ json_input = json.load(fd_in)
+ pwd = os.path.abspath(os.curdir)
+ for module in json_input['modules']:
+ if module['name'] == 'webkitgtk':
+ path = os.path.join(pwd, zip_filename)
+ module['sources'] = [{'type': 'archive', 'url': f'file://{path}', 'sha256': checksum,
+ 'strip-components': 0}]
+ elif module['name'] == 'epiphany':
+ module['sources'] = [{'type': 'dir', 'path': pwd}]
+ with open(manifest_path, 'w') as fd_out:
+ json.dump(json_input, fd_out, indent=4)
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv[1:]))
diff --git a/org.gnome.Epiphany.Canary.json.in b/org.gnome.Epiphany.Canary.json.in
new file mode 100644
index 000000000..17d4755f3
--- /dev/null
+++ b/org.gnome.Epiphany.Canary.json.in
@@ -0,0 +1,212 @@
+{
+ "app-id" : "org.gnome.Epiphany.Canary",
+ "runtime" : "org.webkit.Platform",
+ "runtime-version" : "0.3",
+ "sdk" : "org.webkit.Sdk",
+ "command" : "ephy-wrapper",
+ "tags" : [
+ "nightly"
+ ],
+ "desktop-file-name-suffix" : " (Canary)",
+ "finish-args" : [
+ "--device=dri",
+ "--filesystem=/run/.heim_org.h5l.kcm-socket",
+ "--filesystem=xdg-download",
+ "--share=ipc",
+ "--share=network",
+ "--socket=fallback-x11",
+ "--socket=pulseaudio",
+ "--socket=wayland",
+ "--system-talk-name=org.freedesktop.GeoClue2"
+ ],
+ "modules" : [
+ {
+ "name": "elementary-icons",
+ "buildsystem": "meson",
+ "sources": [
+ {
+ "type": "git",
+ "url": "https://github.com/elementary/icons.git"
+ }
+ ],
+ "modules": [
+ {
+ "name": "xcursorgen",
+ "cleanup": [ "*" ],
+ "sources": [
+ {
+ "type": "git",
+ "url": "https://gitlab.freedesktop.org/xorg/app/xcursorgen.git",
+ "tag": "xcursorgen-1.0.7"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "elementary-stylesheet",
+ "buildsystem": "meson",
+ "sources": [
+ {
+ "type": "git",
+ "url": "https://github.com/elementary/stylesheet.git"
+ }
+ ],
+ "modules": [
+ {
+ "name": "sassc",
+ "cleanup": [ "*" ],
+ "sources": [
+ {
+ "type": "git",
+ "url": "https://github.com/sass/sassc.git",
+ "tag": "3.6.1"
+ },
+ {
+ "type": "script",
+ "dest-filename": "autogen.sh",
+ "commands": [ "autoreconf -si" ]
+ }
+ ],
+ "modules": [
+ {
+ "name": "libsass",
+ "cleanup": [ "*" ],
+ "sources": [
+ {
+ "type": "git",
+ "url": "https://github.com/sass/libsass.git",
+ "tag": "3.6.4"
+ },
+ {
+ "type": "script",
+ "dest-filename": "autogen.sh",
+ "commands": [ "autoreconf -si" ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name" : "libdazzle",
+ "buildsystem" : "meson",
+ "config-opts" : [
+ "-Dwith_vapi=false"
+ ],
+ "sources" : [
+ {
+ "type" : "git",
+ "url" : "https://gitlab.gnome.org/GNOME/libdazzle.git"
+ }
+ ]
+ },
+ {
+ "name" : "libportal",
+ "buildsystem" : "meson",
+ "config-opts" : [
+ "-Dgtk_doc=false"
+ ],
+ "sources" : [
+ {
+ "type" : "git",
+ "url" : "https://github.com/flatpak/libportal.git"
+ }
+ ]
+ },
+ {
+ "name": "gcr",
+ "buildsystem" : "meson",
+ "config-opts" : [
+ "-Dgtk_doc=false",
+ "-Dintrospection=false",
+ "-Dssh_agent=false"
+ ],
+ "sources" : [
+ {
+ "type" : "git",
+ "url" : "https://gitlab.gnome.org/GNOME/gcr.git"
+ }
+ ]
+ },
+ {
+ "name" : "json-glib",
+ "buildsystem" : "meson",
+ "sources" : [
+ {
+ "type" : "git",
+ "url" : "https://gitlab.gnome.org/GNOME/json-glib.git"
+ }
+ ]
+ },
+ {
+ "name": "libhandy",
+ "buildsystem" : "meson",
+ "config-opts" : [
+ "-Dgtk_doc=false",
+ "-Dvapi=false",
+ "-Dtests=false",
+ "-Dexamples=false",
+ "-Dglade_catalog=disabled"
+ ],
+ "sources" : [
+ {
+ "type" : "git",
+ "url" : "https://gitlab.gnome.org/GNOME/libhandy.git"
+ }
+ ]
+ },
+ {
+ "name" : "webkitgtk",
+ "buildsystem" : "simple",
+ "build-commands" : [
+ "cp -a lib/libjavascriptcore* /app/lib",
+ "cp -a lib/libwebkit2gtk* /app/lib",
+ "mkdir -p /app/libexec",
+ "cp bin/WebKit*Process /app/libexec",
+ "cp -r install/lib/pkgconfig /app/lib/",
+ "sed -i 's;/app/webkit/WebKitBuild/Release/install;/app;g' /app/lib/pkgconfig/*.pc",
+ "cp -r install/include /app/"
+ ],
+ "sources" : [
+ ]
+ },
+ {
+ "name" : "epiphany",
+ "buildsystem" : "meson",
+ "config-opts" : [
+ "-Dprofile=Canary",
+ "-Dsoup2=disabled"
+ ],
+ "sources" : [
+ {
+ "type" : "git",
+ "url" : "https://gitlab.gnome.org/GNOME/epiphany.git",
+ "disable-shallow-clone" : true
+ }
+ ],
+ "post-install" : [
+ "sed -i 's;Exec=epiphany;Exec=ephy-wrapper;g'
/app/share/applications/org.gnome.Epiphany.Canary.desktop"
+ ]
+ },
+ {
+ "name" : "ephy-wrapper",
+ "buildsystem" : "simple",
+ "build-commands" : [
+ "install -m a+rx ephy-wrapper.sh /app/bin/ephy-wrapper"
+ ],
+ "sources" : [
+ {
+ "type" : "script",
+ "dest-filename" : "ephy-wrapper.sh",
+ "commands" : [
+ "export WEBKIT_INJECTED_BUNDLE_PATH=/app/lib",
+ "export WEBKIT_EXEC_PATH=/app/libexec",
+ "exec epiphany \"$@\""
+ ]
+ }
+ ]
+ }
+ ]
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]