ci: Check the formatting of rust files

Part of #2930

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5235>
This commit is contained in:
Jordan Petridis 2023-08-24 11:34:48 +03:00
parent 25c9ca2d24
commit 182fa11c0e
4 changed files with 19 additions and 2 deletions

View file

@ -211,6 +211,18 @@ gst indent:
- if: '$CI_PROJECT_NAMESPACE != "gstreamer" || $CI_COMMIT_BRANCH != $GST_UPSTREAM_BRANCH' - if: '$CI_PROJECT_NAMESPACE != "gstreamer" || $CI_COMMIT_BRANCH != $GST_UPSTREAM_BRANCH'
when: 'always' 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: commitlint:
extends: extends:
- '.commitlint image' - '.commitlint image'

View file

@ -5,7 +5,7 @@ variables:
# If you are hacking on them or need a them to rebuild, its enough # 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. # 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' INDENT_TAG: '2023-06-14.1'

View file

@ -232,7 +232,7 @@ export CARGO_HOME="/usr/local/cargo"
export PATH="/usr/local/cargo/bin:$PATH" export PATH="/usr/local/cargo/bin:$PATH"
chmod +x rustup-init; 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; rm rustup-init;
chmod -R a+w $RUSTUP_HOME $CARGO_HOME chmod -R a+w $RUSTUP_HOME $CARGO_HOME

5
scripts/format-rust Executable file
View file

@ -0,0 +1,5 @@
#! /bin/bash
set -e
find -name "*.rs" -exec rustfmt "$@" --edition 2021 {} +