# Configure and run code checks include: '.gitlab-ci/utils.yml' # Checks from the pre-commit hook pre-commit-checks: stage: check image: "rustlang/rust:nightly-slim" interruptible: true script: - RUST_BACKTRACE=1 cargo run --manifest-path hooks/checks/Cargo.toml -- --verbose --force-install --cargo-binstall # Checks needing dependencies in the Flatpak runtime flatpak-checks: extends: - .remove_build_only_modules stage: check image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master' tags: - flatpak interruptible: true variables: CARGO_CODECLIMATE_DOWNLOAD_URL: "https://gitlab.com/woshilapin/cargo-sonar/-/releases/1.3.1/downloads/bin/x86_64-unknown-linux-musl/cargo-codeclimate" CARGO_CODECLIMATE_SHA256SUM: "401d1cf22d2f1b6f1986b479517c31e0544e8b7ecbb70f30e684ca7c171a0f17" script: # Initialize the Flatpak sandbox. - flatpak-builder --keep-build-dirs --user --disable-rofiles-fuse --stop-at=${FLATPAK_MODULE} flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH} # Lint the Rust code with clippy. - echo "cargo clippy --message-format=json -- -D warnings > clippy-report.json " | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH} # Lint the Blueprint files. - echo "blueprint-compiler format ../src" | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH} # Lint the Meson files. - echo "meson format -qr .." | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH} - ls -la . after_script: # Download cargo-codeclimate - curl -L -o cargo-codeclimate ${CARGO_CODECLIMATE_DOWNLOAD_URL} - echo "${CARGO_CODECLIMATE_SHA256SUM} cargo-codeclimate" > cargo-codeclimate.sha256sum - sha256sum -c cargo-codeclimate.sha256sum - chmod +x cargo-codeclimate # Convert the clippy report to CodeClimate / GitLab Code Quality format. - ./cargo-codeclimate --clippy --clippy-path .flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/clippy-report.json artifacts: reports: codequality: codeclimate.json