Authenticator/.gitlab-ci.yml
2019-09-03 14:45:04 +02:00

90 lines
2.4 KiB
YAML

stages:
- lint
- test
- review
variables:
BUNDLE: "authenticator-nightly.flatpak"
flatpak:
image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
stage: "test"
variables:
MANIFEST_PATH: "build-aux/com.bilelmoussaoui.AuthenticatorDevel.json"
FLATPAK_MODULE: "authenticator"
MESON_ARGS: "-Dprofile=development"
APP_ID: "com.bilelmoussaoui.AuthenticatorDevel"
script:
- flatpak-builder --stop-at=${FLATPAK_MODULE} app ${MANIFEST_PATH}
# Build the flatpak repo
- flatpak-builder --run app ${MANIFEST_PATH} meson --prefix=/app ${MESON_ARGS} _build
- flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build install
# Run tests
- >
xvfb-run -a -s "-screen 0 1024x768x24"
flatpak build
--env=LANG=C.UTF-8
--env=NO_AT_BRIDGE=1
app
dbus-run-session
meson test -C _build --no-stdsplit --print-errorlogs
# Create a flatpak bundle
- flatpak-builder --finish-only app ${MANIFEST_PATH}
- flatpak build-export repo app
- flatpak build-bundle repo ${BUNDLE} ${APP_ID}
artifacts:
paths:
- $BUNDLE
expire_in: 5 days
cache:
key: "flatpak"
paths:
- .flatpak-builder/downloads/
- .flatpak-builder/git/
- 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
stop_review:
stage: review
script:
- echo "Stopping flatpak deployment"
when: manual
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
# Configure and run rustfmt
# Exits and builds fails if on bad format
rustfmt:
image: "rust:slim"
stage: "lint"
script:
- rustup component add rustfmt
# Create blank versions of our configured files
# so rustfmt does not yell about non-existent files or completely empty files
- echo -e "" >> src/config.rs
- echo -e "" >> src/static_resources.rs
- rustc -Vv && cargo -Vv
- cargo fmt --version
- cargo fmt --all -- --color=always --check