fractal/.gitlab-ci.yml
Jordan Petridis 58c589731c
CI: Add review apps setup
Also refactor the flatpak job
2018-08-18 19:49:34 +03:00

113 lines
3.1 KiB
YAML

stages:
- test
- review
- deploy
variables:
BUNDLE: "org.gnome.Fractal.${CI_COMMIT_SHA}.flatpak"
flatpak:
image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
stage: "test"
variables:
MANIFEST_PATH: "flatpak/org.gnome.Fractal.json"
FLATPAK_MODULE: "fractal"
DBUS_ID: "org.gnome.Fractal"
script:
- flatpak-builder --stop-at=${FLATPAK_MODULE} app ${MANIFEST_PATH}
# Force regeneration of gresources regardless of artifacts chage
- flatpak-builder --run app ${MANIFEST_PATH} glib-compile-resources --sourcedir=fractal-gtk/res/ fractal-gtk/res/resources.xml
# Build the flatpak repo
- flatpak-builder --run app ${MANIFEST_PATH} meson --prefix=/app _build
- flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build install
# Run the tests
- |
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:
paths:
- $BUNDLE
expire_in: 2 days
cache:
key: "flatpak"
paths:
- .flatpak-builder/cache/
- 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:
image: fedora
stage: deploy
only:
- master
before_script:
- dnf install -y rust cargo meson make gtk3-devel gtksourceview3-devel gspell-devel openssl-devel gmp-devel \
gstreamer1-devel gstreamer1-plugins-base-tools \
gstreamer1-plugins-base-devel \
gstreamer1-plugins-good gstreamer1-plugins-good-extras \
gstreamer1-plugins-bad-free gstreamer1-plugins-bad-free-devel \
gstreamer1-plugins-bad-free-extras
script:
# Setup the cargo cache
- mkdir -p .cargo_cache
- export CARGO_HOME="${PWD}/.cargo_cache"
- cargo doc --no-deps
- cargo rustdoc -p fractal-gtk -- --document-private-items
- rm -rf public
- mv target/doc/ public
artifacts:
paths:
- public
cache:
key: "$CI_JOB_NAME"
paths:
- target/
- .cargo_cache/