forked from clan/clan-core
replace ci script with nix-ci-build
This commit is contained in:
parent
41a29b5464
commit
a11a62cd4e
@ -8,4 +8,4 @@ jobs:
|
||||
runs-on: nix
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: bash ./scripts/ci
|
||||
- run: nix run --refresh github:Mic92/nix-ci-build
|
||||
|
61
scripts/ci
61
scripts/ci
@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
args=(
|
||||
"$@"
|
||||
--accept-flake-config
|
||||
--gc-roots-dir gc-root
|
||||
--option allow-import-from-derivation false
|
||||
--show-trace
|
||||
--force-recurse
|
||||
--workers "$(nproc)"
|
||||
--flake ".#checks.x86_64-linux"
|
||||
)
|
||||
|
||||
summary=summary.log
|
||||
|
||||
if [[ -n "${GITHUB_STEP_SUMMARY-}" ]]; then
|
||||
log() {
|
||||
echo "$*" >> "$GITHUB_STEP_SUMMARY"
|
||||
}
|
||||
else
|
||||
log() {
|
||||
echo "$*" > "$summary"
|
||||
}
|
||||
fi
|
||||
|
||||
rc=0
|
||||
|
||||
nix shell --inputs-from '.#' "nixpkgs#nix-eval-jobs" -c nix-eval-jobs "${args[@]}" > "jobs.json"
|
||||
|
||||
for job in $(jq -r '. | @base64' < "jobs.json"); do
|
||||
job=$(echo "$job" | base64 -d)
|
||||
attr=$(echo "$job" | jq -r .attr)
|
||||
echo "### $attr"
|
||||
error=$(echo "$job" | jq -r .error)
|
||||
if [[ $error != null ]]; then
|
||||
log "### ❌ $attr"
|
||||
log
|
||||
log "<details><summary>Eval error:</summary><pre>"
|
||||
log "$error"
|
||||
log "</pre></details>"
|
||||
rc=1
|
||||
else
|
||||
drvPath=$(echo "$job" | jq -r .drvPath)
|
||||
if ! nix-store --option keep-going true --realize "$drvPath" 2>&1 | tee build-log.txt; then
|
||||
log "### ❌ $attr"
|
||||
log
|
||||
log "<details><summary>Build error:</summary>last 50 lines:<pre>"
|
||||
log "$(tail -n 50 build-log.txt)"
|
||||
log "</pre></details>"
|
||||
rc=1
|
||||
else
|
||||
log "### ✅ $attr"
|
||||
fi
|
||||
log
|
||||
rm build-log.txt
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -f "$summary" ]]; then cat "$summary"; fi
|
||||
exit "$rc"
|
Loading…
Reference in New Issue
Block a user