diff options
| -rw-r--r-- | .forgejo/workflows/lint.yml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml new file mode 100644 index 0000000..626305c --- /dev/null +++ b/.forgejo/workflows/lint.yml | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | on: | ||
| 2 | push: | ||
| 3 | paths-ignore: | ||
| 4 | - 'README.rst' | ||
| 5 | - '.guix-authorizations' | ||
| 6 | - '.guix-channel' | ||
| 7 | pull_request: | ||
| 8 | paths: | ||
| 9 | - 'guix-science/packages/**' | ||
| 10 | |||
| 11 | jobs: | ||
| 12 | lint-new-modified: | ||
| 13 | name: Lint new/modified packages | ||
| 14 | runs-on: guix | ||
| 15 | steps: | ||
| 16 | - run: | | ||
| 17 | set -e | ||
| 18 | set -o pipefail | ||
| 19 | GUIX_COMMIT=$(guix shell git -- git ls-remote https://codeberg.org/guix/guix.git HEAD | cut -f 1) | ||
| 20 | echo "(list (channel (name 'guix-science) (url \"${{ forge.event.pull_request.head.repo.clone_url }}\") (commit \"${{ forge.event.pull_request.head.sha }}\")) (channel (name 'guix) (url \"https://codeberg.org/guix/guix.git\") (commit \"$GUIX_COMMIT\") (introduction (make-channel-introduction \"9edb3f66fd807b096b48283debdcddccfea34bad\" (openpgp-fingerprint \"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA\")))))" > channels-head.scm | ||
| 21 | echo "(list (channel (name 'guix-science) (url \"${{ forge.event.pull_request.head.repo.clone_url }}\") (commit \"${{ forge.event.pull_request.merge_base }}\")) (channel (name 'guix) (url \"https://codeberg.org/guix/guix.git\") (commit \"$GUIX_COMMIT\") (introduction (make-channel-introduction \"9edb3f66fd807b096b48283debdcddccfea34bad\" (openpgp-fingerprint \"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA\")))))" > channels-base.scm | ||
| 22 | |||
| 23 | guix shell git -- git clone --depth=1 https://gitlab.inria.fr/guix-hpc/guix-extensions 2> /dev/null | ||
| 24 | export GUIX_EXTENSIONS_PATH=$(pwd)/guix-extensions/guix/extensions | ||
| 25 | # Hide time-machine STDERR | ||
| 26 | export PACKAGES=$(guix time-machine -C channels-head.scm -- diff -r -C channels-base.scm 2> /dev/null) | ||
| 27 | # Lint all packages at once | ||
| 28 | if [[ -z "$PACKAGES" ]] ; then echo "No packages to lint" && exit 0 ; else echo "Linting $PACKAGES" ; export LINT="$(guix time-machine -C channels-head.scm -- lint $PACKAGES)" ; fi | ||
| 29 | # Exit with error when lint writes on STDOUT. | ||
| 30 | if [[ -z "$LINT" ]] ; then echo "No lint warning for packages $PACKAGES" ; else echo "$LINT" && exit 1 ; fi | ||
| 31 | |||
