diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b56636e7d8c999be1c58073c7b7f3fbe8a25a572..f81d661cc2f6698def92413c871240ecaf433416 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 8052a68446908f558839aefa7e434281984f1519..d1502c2a21cc588799f4632df50ecb46de9cd947 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 0dd082f6a0db6284160b15043639f3911972e6d5..d5f87fd8686147a93167090af762cd98d08f8316 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 b320c6050981afe0bb39653bf72c33dbc5ffdfe3..4b5be72aa70b8d4cad10a562638293e7873f90a2 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 c84306fe5a1f71133572c180af5296bc1a2d7086..f6b4e405dc1c7387dbc3d57416f72bfbdfc4d2ef 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