From dbe680ba438ee779cc7696a1dc4ac10e13487697 Mon Sep 17 00:00:00 2001 From: Romain GARBAGE Date: Thu, 28 Aug 2025 13:36:34 +0200 Subject: Add new/modified package linting through Forgejo actions. * .forgejo/workflows/lint.yml: New file. --- .forgejo/workflows/lint.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .forgejo/workflows/lint.yml (limited to '.forgejo') 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 @@ +on: + push: + paths-ignore: + - 'README.rst' + - '.guix-authorizations' + - '.guix-channel' + pull_request: + paths: + - 'guix-science/packages/**' + +jobs: + lint-new-modified: + name: Lint new/modified packages + runs-on: guix + steps: + - run: | + set -e + set -o pipefail + GUIX_COMMIT=$(guix shell git -- git ls-remote https://codeberg.org/guix/guix.git HEAD | cut -f 1) + 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 + 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 + + guix shell git -- git clone --depth=1 https://gitlab.inria.fr/guix-hpc/guix-extensions 2> /dev/null + export GUIX_EXTENSIONS_PATH=$(pwd)/guix-extensions/guix/extensions + # Hide time-machine STDERR + export PACKAGES=$(guix time-machine -C channels-head.scm -- diff -r -C channels-base.scm 2> /dev/null) + # Lint all packages at once + 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 + # Exit with error when lint writes on STDOUT. + if [[ -z "$LINT" ]] ; then echo "No lint warning for packages $PACKAGES" ; else echo "$LINT" && exit 1 ; fi + -- cgit v1.2.3