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 -x archival $PACKAGES)" ; guix time-machine -C channels-head.scm -- lint -c archival $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