From 182fa11c0e750f6d69f238448dfd5958682b5857 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Thu, 24 Aug 2023 11:34:48 +0300 Subject: [PATCH] ci: Check the formatting of rust files Part of #2930 Part-of: --- .gitlab-ci.yml | 12 ++++++++++++ .gitlab-image-tags.yml | 2 +- ci/docker/fedora/prepare.sh | 2 +- scripts/format-rust | 5 +++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100755 scripts/format-rust diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e44f940d11..4cdf4c5be1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -211,6 +211,18 @@ gst indent: - if: '$CI_PROJECT_NAMESPACE != "gstreamer" || $CI_COMMIT_BRANCH != $GST_UPSTREAM_BRANCH' when: 'always' +rustfmt: + extends: + - '.fedora image' + - '.fdo.suffixed-image@fedora' + stage: 'preparation' + needs: + - "fedora amd64 docker" + script: + - export RUSTUP_HOME="/usr/local/rustup" + - export PATH="/usr/local/cargo/bin:$PATH" + - ./scripts/format-rust --check + commitlint: extends: - '.commitlint image' diff --git a/.gitlab-image-tags.yml b/.gitlab-image-tags.yml index 7f943de2a3..ff4086e401 100644 --- a/.gitlab-image-tags.yml +++ b/.gitlab-image-tags.yml @@ -5,7 +5,7 @@ variables: # If you are hacking on them or need a them to rebuild, its enough # to change any part of the string of the image you want. ### - FEDORA_TAG: '2023-08-24.0' + FEDORA_TAG: '2023-08-25.1' INDENT_TAG: '2023-06-14.1' diff --git a/ci/docker/fedora/prepare.sh b/ci/docker/fedora/prepare.sh index 0dc86aa96f..a6111ef980 100644 --- a/ci/docker/fedora/prepare.sh +++ b/ci/docker/fedora/prepare.sh @@ -232,7 +232,7 @@ export CARGO_HOME="/usr/local/cargo" export PATH="/usr/local/cargo/bin:$PATH" chmod +x rustup-init; -./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; +./rustup-init -y --no-modify-path --default-toolchain $RUST_VERSION; rm rustup-init; chmod -R a+w $RUSTUP_HOME $CARGO_HOME diff --git a/scripts/format-rust b/scripts/format-rust new file mode 100755 index 0000000000..23437a7bd9 --- /dev/null +++ b/scripts/format-rust @@ -0,0 +1,5 @@ +#! /bin/bash + +set -e + +find -name "*.rs" -exec rustfmt "$@" --edition 2021 {} +