From f23e9d8b845433dce00c1c180c8783a75a6cc5fd Mon Sep 17 00:00:00 2001 From: Simon Josefsson <simon@josefsson.org> Date: Tue, 19 Dec 2023 21:06:31 +0100 Subject: [PATCH] Add wrap-and-sort test job --- .gitlab-ci.yml | 4 ++++ CONTRIBUTORS | 1 + README.md | 31 +++++++++++++++++++++++++++++++ pipeline-jobs.yml | 3 +++ salsa-ci.yml | 23 +++++++++++++++++++++++ 5 files changed, 62 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b56636e7..f81d661c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -135,10 +135,14 @@ test-pipeline: parallel: matrix: - PROJECT_URL: https://salsa.debian.org/debian/grep + SALSA_CI_DISABLE_WRAP_AND_SORT: 0 + SALSA_CI_WRAP_AND_SORT_ARGS: '--wrap-always --short-indent --trailing-comma' - PROJECT_URL: https://salsa.debian.org/debian/grep SALSA_CI_ENABLE_BUILD_PACKAGE_PROFILES: 1 SALSA_CI_DISABLE_ALL_TESTS: 1 SALSA_CI_DISABLE_APTLY: 1 + SALSA_CI_ENABLE_WRAP_AND_SORT: 1 + SALSA_CI_WRAP_AND_SORT_ARGS: '--wrap-always --short-indent --trailing-comma' BUILD_PROFILES: - nocheck,nodoc # boxes is used to test gbp setup-gitattributes (#322) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 8052a684..d1502c2a 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -51,3 +51,4 @@ Colin Watson <cjwatson@debian.org> Maximilian Engelhardt <maxi@daemonizer.de> Sylvain Beucler <beuc@beuc.net> Vagrant Cascadian <vagrant@reproducible-builds.org> +Simon Josefsson <simon@josefsson.org> diff --git a/README.md b/README.md index 0dd082f6..d5f87fd8 100644 --- a/README.md +++ b/README.md @@ -374,6 +374,37 @@ variables: SALSA_CI_DISABLE_BUILD_PACKAGE_TWICE: 0 ``` +### Enable wrap-and-sort job + +The job `wrap-and-sort` can be used to check if files in the `debian/` +folder are wrapped properly using +[wrap-and-sort(1)](https://manpages.debian.org/testing/devscripts/wrap-and-sort.1.en.html). To +enable this check, either run your pipeline manually with +`SALSA_CI_DISABLE_WRAP_AND_SORT` set to anything different than 1, +'yes' or 'true' or by adding the following to your +`debian/salsa-ci.yml`: + +```yaml +variables: + SALSA_CI_DISABLE_WRAP_AND_SORT: 0 +``` + +You can configure the parameters passed to `wrap-and-sort` using the +`SALSA_CI_WRAP_AND_SORT_ARGS` variable like this: + +```yaml +variables: + SALSA_CI_DISABLE_WRAP_AND_SORT: 0 + SALSA_CI_WRAP_AND_SORT_ARGS: '-asbkt' +``` + +The style to use is a subjective decision. The default behaviour may +change over time +[#895570](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895570). +We suggest to consider `-a --wrap-always`, `-s --short-indent`, `-b +--sort-binary-packages`, `-k --keep-first`, and `-t --trailing-comma` +as they encourage a minimal, consistent and deterministic style. + ### Customizing Lintian The Lintian job can be customized to ignore certain tags. diff --git a/pipeline-jobs.yml b/pipeline-jobs.yml index b320c605..4b5be72a 100644 --- a/pipeline-jobs.yml +++ b/pipeline-jobs.yml @@ -62,6 +62,9 @@ missing-breaks: rc-bugs: extends: .test-rc-bugs +wrap-and-sort: + extends: .test-wrap-and-sort + aptly: extends: .publish-aptly diff --git a/salsa-ci.yml b/salsa-ci.yml index c84306fe..f6b4e405 100644 --- a/salsa-ci.yml +++ b/salsa-ci.yml @@ -100,6 +100,8 @@ variables: SALSA_CI_IGNORED_BRANCHES: '' SALSA_CI_BUILD_TIMEOUT_ARGS: "-v 2.75h" SALSA_CI_DISABLE_BUILD_DBGSYM: 1 + SALSA_CI_DISABLE_WRAP_AND_SORT: 1 + SALSA_CI_WRAP_AND_SORT_ARGS: '' # Use fastzip to fix https://salsa.debian.org/salsa-ci-team/pipeline/-/issues/177 FF_USE_FASTZIP: 'true' SALSA_CI_DISABLE_GBP_SETUP_GITATTRIBUTES: 0 @@ -767,6 +769,27 @@ stages: - job: build artifacts: true +.test-wrap-and-sort: &test-wrap-and-sort + stage: test + image: $SALSA_CI_IMAGES_GENERIC_TESTS + rules: + - if: $SALSA_CI_ENABLE_WRAP_AND_SORT =~ /^(1|yes|true)$/ + - if: $SALSA_CI_DISABLE_ALL_TESTS =~ /^(1|yes|true)$/ + when: never + - if: $SALSA_CI_DISABLE_WRAP_AND_SORT !~ /^(1|yes|true)$/ + script: + - eatmydata apt-get install --no-install-recommends -y devscripts + - cd ${WORKING_DIR} + - mkdir -v wrap-and-sort + - cp -av ${SOURCE_DIR}/debian wrap-and-sort/ + - (cd wrap-and-sort && wrap-and-sort ${SALSA_CI_WRAP_AND_SORT_ARGS}) + - diff -ur ${SOURCE_DIR}/debian/ wrap-and-sort/debian/ + variables: + GIT_STRATEGY: none + needs: + - job: extract-source + artifacts: true + .publish-aptly: &publish-aptly stage: publish image: $SALSA_CI_IMAGES_APTLY -- GitLab