#!/bin/sh # disfluid, implementation of the Solid specification # Copyright (C) 2020, 2021 Vivien Kraus # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . refname="$1" oldrev="$2" newrev="$3" zero=$(guix environment --ad-hoc git -- git hash-object --stdin &2 echo "No CI for $refname, it’s not master" exit 0 fi if test "x$oldrev" = "x$zero" then >&2 echo "Creating a new branch, $refname..." span="$newrev" fi if test "x$newrev" = "x$zero" then >&2 echo "Deleting a branch, that's OK." exit 0 fi >&2 echo "Checking all refs in range $span." CHANNEL=$(mktemp -d 2>/dev/null || mktemp -d -t "channel") >&2 echo "The channel is in $CHANNEL." cat > "$CHANNEL/guix-channels-for-build.scm" <&2 echo "Checking new commit $ref." if test "x$ref" = "x0e29ddc3c41870e14da87770a429a94f80dd4110" then >&2 echo "This is the root, skipping." else >&2 echo "Running CI for $ref..." guix time-machine -C "$CHANNEL/guix-channels-for-build.scm" \ -- environment --ad-hoc git \ -- git archive "-o" "$CHANNEL/source.tar.gz" "$ref" guix ci.scm || exit 1 (cd "$CHANNEL" ; \ rm -rf "source" ; \ mkdir "source" ; \ cd "source" ; \ guix time-machine -C "$CHANNEL/guix-channels-for-build.scm" \ -- environment --ad-hoc tar \ -- tar xf ../source.tar.gz) export CI_REF="$ref" if OUTCOME=$(guix time-machine -C "$CHANNEL/guix-channels-for-build.scm" \ -- build -L "$CHANNEL/source/guix" -f "$CHANNEL/source/ci.scm") then >&2 echo "CI ran: $OUTCOME." else rm -rf $CHANNEL exit 1 fi fi done rm -rf $CHANNEL