CI: Add review apps setup

Also refactor the flatpak job
This commit is contained in:
Jordan Petridis 2018-08-18 18:47:15 +03:00
parent f0c50ec46b
commit 58c589731c
No known key found for this signature in database
GPG key ID: E8523968931763BE

View file

@ -1,39 +1,84 @@
stages: stages:
- test - test
- review
- deploy - deploy
variables:
BUNDLE: "org.gnome.Fractal.${CI_COMMIT_SHA}.flatpak"
flatpak: flatpak:
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
stage: test stage: "test"
variables:
MANIFEST_PATH: "flatpak/org.gnome.Fractal.json"
FLATPAK_MODULE: "fractal"
DBUS_ID: "org.gnome.Fractal"
script: script:
# Build the flatpak deps - flatpak-builder --stop-at=${FLATPAK_MODULE} app ${MANIFEST_PATH}
- flatpak-builder --stop-at=fractal app flatpak/org.gnome.Fractal.json
# Force regeneration of gresources regardless of artifacts chage # Force regeneration of gresources regardless of artifacts chage
- flatpak-builder --run app flatpak/org.gnome.Fractal.json glib-compile-resources --sourcedir=fractal-gtk/res/ fractal-gtk/res/resources.xml - flatpak-builder --run app ${MANIFEST_PATH} glib-compile-resources --sourcedir=fractal-gtk/res/ fractal-gtk/res/resources.xml
- flatpak-builder --run app flatpak/org.gnome.Fractal.json meson --prefix=/app --libdir=/app/lib _build # Build the flatpak repo
- flatpak-builder --run app flatpak/org.gnome.Fractal.json ninja -C _build install - flatpak-builder --run app ${MANIFEST_PATH} meson --prefix=/app _build
- flatpak-builder --finish-only app flatpak/org.gnome.Fractal.json - flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build install
- flatpak build-export repo app
# Create a flatpak bundle for designers to use
- flatpak build-bundle repo fractal-dev.flatpak org.gnome.Fractal
# Run the tests # Run the tests
- flatpak-builder --run app flatpak/org.gnome.Fractal.json cargo test - |
xvfb-run -a -s "-screen 0 1024x768x24" \
flatpak-builder --run \
--env=CARGO_HOME="target/cargo-home" \
--env=CARGO_TARGET_DIR="target_test/" \
app ${MANIFEST_PATH} \
cargo test
# Create a flatpak bundle
- flatpak-builder --finish-only app ${MANIFEST_PATH}
- flatpak build-export repo app
- flatpak build-bundle repo ${BUNDLE} ${DBUS_ID}
artifacts: artifacts:
paths: paths:
- fractal-dev.flatpak - $BUNDLE
expire_in: 2 days expire_in: 2 days
cache: cache:
# JOB_NAME - Each job will have it's own cache key: "flatpak"
# ^ Keep diffrerent caches for each branch
key: "$CI_JOB_NAME"
paths: paths:
- .flatpak-builder/cache/ - .flatpak-builder/cache/
- target/ - target/
- target_test/
review:
stage: review
dependencies:
- flatpak
script:
- echo "Generating flatpak deployment"
artifacts:
paths:
- $BUNDLE
expire_in: 30 days
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://gitlab.gnome.org/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/raw/${BUNDLE}
on_stop: stop_review
except:
- master@World/fractal
- tags
stop_review:
stage: review
script:
- echo "Stopping flatpak deployment"
when: manual
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
except:
- master@World/fractal
- tags
.pages: .pages:
image: fedora image: fedora