stages: - test - lint - review variables: BUNDLE: "hammond-dev.flatpak" .cargo_cache_template: &cargo_cache 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: - target/ - .cargo_cache/ .cargo_test_template: &cargo_test stage: test variables: RUSTFLAGS: "--cfg rayon_unstable" RUST_BACKTRACE: "FULL" before_script: - apt-get update -yqq - apt-get install -yqq --no-install-recommends build-essential libgtk-3-dev meson - mkdir -p .cargo_cache # Only stuff inside the repo directory can be cached # Override the CARGO_HOME variable to force it location - export CARGO_HOME="${PWD}/.cargo_cache" script: - rustc -Vv && cargo -Vv # Force regeneration of gresources regardless of artifacts chage - cd hammond-gtk/resources/ && glib-compile-resources --generate resources.xml && cd ../../ - cargo build - cargo test -- --test-threads=1 - cargo test -- --test-threads=1 --ignored <<: *cargo_cache rust:stable: # https://hub.docker.com/_/rust/ image: "rust" <<: *cargo_test rust:nightly: # https://hub.docker.com/r/rustlang/rust/ image: "rustlang/rust:nightly" <<: *cargo_test only: - schedule - web flatpak: image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:3.28 stage: test script: - flatpak-builder --stop-at=hammond app org.gnome.Hammond.json # https://gitlab.gnome.org/World/hammond/issues/55 # Force regeneration of gresources regardless of artifacts chage - flatpak-builder --run app org.gnome.Hammond.json glib-compile-resources --sourcedir=hammond-gtk/resources/ hammond-gtk/resources/resources.xml # Build the flatpak repo - flatpak-builder --run app org.gnome.Hammond.json meson --prefix=/app --libdir=/app/lib _build - flatpak-builder --run app org.gnome.Hammond.json ninja -C _build install - flatpak-builder --finish-only app org.gnome.Hammond.json - flatpak build-export repo app # Create a flatpak bundle - flatpak build-bundle repo ${BUNDLE} org.gnome.Hammond # Run the tests # - flatpak-builder --run app org.gnome.Hammond.json cargo test -- --test-threads=1 # - flatpak-builder --run app org.gnome.Hammond.json cargo test -- --test-threads=1 --ignored artifacts: paths: - $BUNDLE expire_in: 30 days 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/ 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/hammond stop_review: stage: review script: - echo "Stopping flatpak deployment" when: manual environment: name: review/$CI_COMMIT_REF_NAME action: stop except: - master@World/hammond # Configure and run rustfmt on nightly # Exits and builds fails if on bad format rustfmt: image: "registry.gitlab.com/alatiera/rustfmt-oci-image/rustfmt:nightly" stage: lint script: - rustc -Vv && cargo -Vv - cargo fmt --version - cargo fmt --all -- --check # Configure and run clippy on nightly # Only fails on errors atm. clippy: image: "registry.gitlab.gnome.org/alatiera/hammond-container-images/clippy:nightly" stage: lint variables: RUSTFLAGS: "--cfg rayon_unstable" CARGO_HOME: ".cargo_cache" script: - rustc --version && cargo --version - cargo clippy --version # Force regeneration of gresources regardless of artifacts chage - cd hammond-gtk/resources/ && glib-compile-resources --generate resources.xml && cd ../../ - cargo clippy --all <<: *cargo_cache