diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5098d07..3b61c78 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,7 @@ variables: variables: FDO_DISTRIBUTION_VERSION: "38" # Update this to trigger a container rebuild - FDO_DISTRIBUTION_TAG: "2023-08-25.1" + FDO_DISTRIBUTION_TAG: $GST_RS_FDO_IMG_TAG before_script: - source ./ci/env.sh - mkdir .cargo && echo -e "[net]\ngit-fetch-with-cli = true" > .cargo/config @@ -60,7 +60,8 @@ build-fedora-container: bison FDO_DISTRIBUTION_EXEC: >- ci/install-rust.sh stable && - pip3 install meson + pip3 install meson && + pip3 install pre-commit .windows rust docker build: stage: prepare @@ -120,15 +121,27 @@ windows installer stable: expire_in: 10 days when: "manual" -rustfmt-clippy: +pre-commit: + stage: "lint" + extends: + - .fedora + - .fdo.distribution-image@fedora + variables: + PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit + cache: + paths: + - ${PRE_COMMIT_HOME} + script: + - meson setup build + - pre-commit run --all-files + +clippy: extends: - .fedora - .fdo.distribution-image@fedora stage: lint script: - meson build - - cargo fmt --version - - cargo fmt -- --color=always --check - cargo clippy --version - cargo clippy --color=always --all-targets -- -D warnings diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..6b08106 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,29 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: check-yaml + - id: check-added-large-files + + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.1.11 + hooks: + # Run the linter. + - id: ruff + # Run the formatter. + - id: ruff-format + + - repo: https://github.com/crate-ci/typos + rev: v1.17.0 + hooks: + - id: typos + exclude: '^$|\.svg$' + + - repo: https://github.com/doublify/pre-commit-rust + rev: v1.0 + hooks: + - id: fmt diff --git a/ci/images_template.yml b/ci/images_template.yml index 447ef4a..b763fa1 100644 --- a/ci/images_template.yml +++ b/ci/images_template.yml @@ -1,4 +1,4 @@ variables: GST_RS_WIN_IMG_TAG: "2023-12-22.0" - GST_RS_FDO_IMG_TAG: "2023-08-25.1" + GST_RS_FDO_IMG_TAG: "2024-01-05.0" GST_RS_STABLE: "1.70.0"