From 167530fada71c4712e18a42c20f4d268cfe9bac1 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Mon, 19 Mar 2018 12:49:11 +0200 Subject: [PATCH] gitlabci: Use flatpak for the CI build test. --- .gitlab-ci.yml | 63 +++++++++++++++++----------------- flatpak/org.gnome.Fractal.json | 5 +-- 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b6878c7d..fb12e31c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,39 +1,38 @@ stages: - test -variables: - RUST_BACKTRACE: "FULL" - CARGO_HOME: $CI_PROJECT_DIR/cargo +flatpak: + image: registry.gitlab.com/alatiera/gnome-nightly-oci/rust-bundle:latest + stage: test + before_script: + # same thing as https://gitlab.gnome.org/alatiera/Hammond/issues/55 + - dnf install -y glib2-devel + # Force regeneration of gresources regardless of artifacts chage + - cd fractal-gtk/res/ && glib-compile-resources --generate resources.xml && cd ../../ + script: + # Build the flatpak repo + - flatpak-builder --stop-at=fractal app flatpak/org.gnome.Fractal.json + - flatpak-builder --run app flatpak/org.gnome.Fractal.json meson --prefix=/app --libdir=/app/lib _build + - flatpak-builder --run app flatpak/org.gnome.Fractal.json ninja -C _build install + - flatpak-builder --finish-only app flatpak/org.gnome.Fractal.json + - flatpak build-export repo app -before_script: -- apt-get update -yqq -- apt-get install -yqq --no-install-recommends build-essential -- apt-get install -yqq --no-install-recommends libgtk-3-dev -- apt-get install -yqq libgmp-dev -# - apt-get install -yqq --no-install-recommends meson + # Create a flatpak bundle for designers to use + - flatpak build-bundle repo fractal-dev.flatpak org.gnome.Fractal + # Run the tests + - flatpak-builder --run app flatpak/org.gnome.Fractal.json cargo test -.cargo_test_template: &cargo_test - stage: test - script: - - rustc --version && cargo --version - # Force regeneration of gresources regardless of artifacts chage - - cd fractal-gtk/res/ && glib-compile-resources --generate resources.xml && cd ../../ - - cargo build - - cargo test --verbose -- --test-threads=1 - # cache: - # paths: - # - target/ - # - cargo/ + artifacts: + paths: + - fractal-dev.flatpak + expire_in: 2 days -test:stable: - # Stable img - # https://hub.docker.com/_/rust/ - image: "rust" - <<: *cargo_test - -# test:nightly: -# # Nightly -# # https://hub.docker.com/r/rustlang/rust/ -# image: "rustlang/rust:nightly" -# <<: *cargo_test + cache: + # JOB_NAME - Each job will have it's own cache + # COMMIT_REF_SLUG = Lowercase name of the branch + # ^ Keep diffrerent caches for each branch + key: "$CI_JOB_NAME" + paths: + - .flatpak-builder/cache/ + - target/ diff --git a/flatpak/org.gnome.Fractal.json b/flatpak/org.gnome.Fractal.json index 7b24706e..b918c197 100644 --- a/flatpak/org.gnome.Fractal.json +++ b/flatpak/org.gnome.Fractal.json @@ -12,12 +12,10 @@ ], "desktop-file-name-prefix" : "(Nightly) ", "finish-args" : [ - /** dconf permission for GtkInspector **/ "--filesystem=xdg-run/dconf", "--filesystem=~/.config/dconf:ro", "--talk-name=ca.desrt.dconf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf", - "--share=network", "--share=ipc", "--socket=x11", @@ -28,7 +26,6 @@ ], "build-options" : { "append-path" : "/usr/lib/sdk/rust-stable/bin", - /** Network needed for cargo deps **/ "build-args" : [ "--share=network" ], @@ -39,7 +36,7 @@ }, "modules" : [ { - "name" : "Fractal", + "name" : "fractal", "buildsystem" : "meson", "sources" : [ {