ci: run 'nix flake check' for each input as we update them

This commit is contained in:
Aaron Bieber 2023-05-09 19:02:59 -06:00
parent cac1a7c42b
commit cd78e91ba9
No known key found for this signature in database
2 changed files with 32 additions and 7 deletions

33
bin/ci
View File

@ -28,24 +28,49 @@ git pull || handle_pull_fail
if [ "${1}" = "update" ]; then
if ! git checkout -b "${ci_branch}"; then
handle_co_fail
handle_co_fail "${ci_branch}"
exit 1
fi
for inp in $(nix flake metadata --json | jq -r '.locks.nodes.root.inputs | keys[] as $k | $k'); do
if ! git checkout -b "${ci_branch}_${inp}"; then
handle_co_fail "${ci_branch}_${inp}"
continue
fi
if ! nix flake lock --commit-lock-file --update-input "$inp"; then
handle_update_fail $inp
handle_update_fail "$inp"
continue
fi
if ! nix flake check --print-build-logs; then
handle_update_check_fail "$inp"
continue
fi
if ! git checkout "${ci_branch}"; then
handle_co_fail "${ci_branch}"
continue
fi
if ! git merge "${ci_branch}_${inp}"; then
handle_merge_fail "${ci_branch}_${inp}" "${ci_branch}"
continue
fi
done
if ! nix flake check --print-build-logs; then
handle_update_check_fail
handle_update_check_fail "$ci_branch"
exit 1
fi
if ! git checkout main; then
handle_co_fail
exit 1
fi
if ! git merge "${ci_branch}"; then
handle_merge_fail
handle_merge_fail "${ci_branch}" "main"
exit 1
fi

View File

@ -122,7 +122,7 @@ handle_pull_fail() {
}
handle_co_fail() {
po_error "CI: git checkout failed!" "Please help!"
_po "CI: git checkout ($1) failed!" "Please help!"
}
handle_update_fail() {
@ -134,11 +134,11 @@ handle_check_fail() {
}
handle_update_check_fail() {
po_error "CI: flake checks failed while updating!" "$(get_journal xin-ci-update)"
_po "CI: flake checks failed while updating $1!" "$(get_journal xin-ci-update)"
}
handle_merge_fail() {
po_error "CI: git merge failed!" "$(get_journal xin-ci-update)"
_po "CI: git merge ('$1' into '$2') failed!" "$(get_journal xin-ci-update)"
}
handle_push_fail() {