fractal/.gitlab-ci.yml
Christopher Davis 919037495f build: Place target in meson build dir
Instead of putting target/ and in the source
directory, we can tell our cargo script to put both target
and our cargo-home in meson's build directory. This means
that when triggering a rebuild through meson via tooling
like Builder, Fractal will actually rebuild.
2019-04-27 16:24:08 +00:00

119 lines
3.2 KiB
YAML

stages:
- check
- test
- review
- deploy
variables:
BUNDLE: "org.gnome.FractalDevel.flatpak"
MANIFEST_PATH: "flatpak/org.gnome.Fractal.json"
MANIFEST_PATH: "flatpak/org.gnome.Fractal.json"
FLATPAK_MODULE: "fractal"
DBUS_ID: "org.gnome.FractalDevel"
.flatpak_cache_template: &flatpak_cache
cache:
key: "flatpak"
paths:
- .flatpak-builder/cache/
- _build/target/
- target_docs/
- target_test/
check:
image: "registry.gitlab.com/alatiera/rustfmt-oci-image/rustfmt:stable"
stage: "check"
script:
- rustc -Vv && cargo -Vv
- cargo --version
- cargo fmt --all -- --check
flatpak:
image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
stage: "test"
script:
- flatpak-builder --stop-at=${FLATPAK_MODULE} --force-clean app ${MANIFEST_PATH}
# Build the flatpak repo
- flatpak-builder --run app ${MANIFEST_PATH} meson --prefix=/app -Dprofile=development _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
<<: *flatpak_cache
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@GNOME/fractal
- tags
stop_review:
stage: review
script:
- echo "Stopping flatpak deployment"
when: manual
environment:
name: "review/${CI_COMMIT_REF_NAME}"
action: stop
except:
- master@GNOME/fractal
- tags
pages:
image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
stage: deploy
script:
- flatpak-builder --stop-at=${FLATPAK_MODULE} --force-clean app ${MANIFEST_PATH}
- flatpak-builder --run app ${MANIFEST_PATH} meson _build
- |
flatpak-builder --run \
--env=CARGO_HOME="target/cargo-home" \
app ${MANIFEST_PATH} \
cargo doc --no-deps
- |
flatpak-builder --run \
--env=CARGO_HOME="target/cargo-home" \
app ${MANIFEST_PATH} \
cargo rustdoc -p fractal-gtk -- --document-private-items
- rm -rf public
- mv target/doc/ public
artifacts:
paths:
- public
only:
- master
<<: *flatpak_cache