Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
33 changes: 26 additions & 7 deletions .github/ci-plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
#
# Inputs, all from the environment: EVENT, DRAFT, BASE (the base branch of a
# pull request), REPO. The jobs read `full`
# and `rows` from GITHUB_OUTPUT. `LEXLEAN_CI_ROWS` and `LEXLEAN_CI_WORKFLOW`
# name the legs file and the workflow when a test runs the script elsewhere.
# and `rows` from GITHUB_OUTPUT. `LEXLEAN_CI_ROWS` names the legs file
# when a test runs the script elsewhere.
set -euo pipefail

rows_file=${LEXLEAN_CI_ROWS:-.github/vv-rows.json}
workflow=${LEXLEAN_CI_WORKFLOW:-.github/workflows/ci.yml}
event=${EVENT:?EVENT names the workflow event}
draft=${DRAFT:-}
base=${BASE:-}
Expand All @@ -50,25 +49,45 @@ whole_gate() {
printf '%s\n' "$1" >> "$summary"
}

# These are the four auxiliary §8.3 contexts, not the number of matrix rows.
# Linux x86-64 is the normative gate; Intel macOS is a static aggregate. Every
# required context must occur exactly once, so a duplicate or foreign context
# cannot replace a missing host even when the total count remains four.
hosts_passed() {
awk -F'\t' '
BEGIN {
expected["build and non-Lean tests (aarch64-unknown-linux-gnu)"] = 1
expected["build and non-Lean tests (x86_64-apple-darwin)"] = 1
expected["build and non-Lean tests (aarch64-apple-darwin)"] = 1
expected["build and non-Lean tests (x86_64-pc-windows-msvc)"] = 1
}
/^build and non-Lean tests \(/ {
if (!($1 in expected) || ++seen[$1] != 1 || $2 != "success") bad = 1
}
END {
for (host in expected) if (seen[host] != 1) bad = 1
exit bad
}'
}

# The id of a pull request run of this workflow on the second parent of HEAD
# that ran every job of the gate and passed every one, when HEAD is a merge of
# that parent with the same tree. A draft run has honesty and the `rest` leg, so it is
# never one: the run must hold the join of Atlas, every host of the matrix, and
# never one: the run must hold the join of Atlas, every exact supported-host context, and
# every leg of the rows file, and no job that did not conclude `success`.
verified_parent_run() {
local parent head_tree hosts runs id names part job
local parent head_tree runs id names part job
parent=$(git rev-parse --verify --quiet 'HEAD^2') || return 1
head_tree=$(git rev-parse 'HEAD^{tree}')
[ "$head_tree" = "$(git rev-parse "$parent^{tree}")" ] || return 1
hosts=$(grep -c '^ - { os: ' "$workflow")
runs=$(gh api "repos/$repo/actions/workflows/ci.yml/runs?head_sha=$parent&event=pull_request&status=success&per_page=30" \
--jq ".workflow_runs[] | select(.head_repository.full_name == \"$repo\") | .id") || return 1
for id in $runs; do
names=$(gh api "repos/$repo/actions/runs/$id/jobs?per_page=100" --paginate \
--jq '.jobs[] | "\(.name)\t\(.conclusion)"') || continue
if printf '%s\n' "$names" | awk -F'\t' '$2 != "success" { bad = 1 } END { exit bad }' \
&& printf '%s\n' "$names" | grep -xF $'atlas (join)\tsuccess' >/dev/null \
&& [ "$(printf '%s\n' "$names" | grep -c '^build and non-Lean tests (')" -eq "$hosts" ]; then
&& printf '%s\n' "$names" | hosts_passed; then
for part in $(jq -r '.[].part' "$rows_file"); do
job="just vv ($part)"
[ "$part" != honesty ] || job=honesty
Expand Down
9 changes: 9 additions & 0 deletions .github/intel-host-lanes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"producer": ["honesty"],
"lanes": {
"lower": ["bootstrap-lower"],
"print": ["bootstrap-print", "bootstrap-bodies", "bootstrap-succeed", "bootstrap-loops", "bootstrap-assemble", "bootstrap-package", "bootstrap-check", "bootstrap-gnaf", "bootstrap-runtime", "bootstrap-terms", "bootstrap-tooling-latex"],
"validate": ["bootstrap-validate", "compiler", "preservation", "preservation-lists", "preservation-runtime", "preservation-support", "preservation-prims", "preservation-std", "production"],
"moves": ["bootstrap-moves", "verification", "rest"]
}
}
31 changes: 25 additions & 6 deletions .github/release-gate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,47 @@
# to a push: a run on the commit itself, or, when the commit is a merge whose
# tree is the tree of its second parent, a run on that parent. A run counts
# when every job of it concluded `success` and it holds the join of Atlas,
# every host of the matrix, and every leg of `.github/vv-rows.json`; a
# every exact supported-host context, and every leg of `.github/vv-rows.json`; a
# draft run, which has only honesty and the `rest` leg, never does. A tag on a commit no
# such run verified is refused, naming what was looked for.
#
# Inputs, all from the environment: REPO (owner/name), SHA (the tagged
# commit), OUT (the evidence file to write), and the lines of the header:
# REF and RELEASE_RUN. `LEXLEAN_CI_ROWS` and `LEXLEAN_CI_WORKFLOW` name the
# legs file and the workflow when a test runs the script elsewhere. `gh`
# REF and RELEASE_RUN. `LEXLEAN_CI_ROWS` names the legs file when a test
# runs the script elsewhere. `gh`
# reads the runs, the jobs, and the artifacts (`actions: read`).
set -euo pipefail

rows_file=${LEXLEAN_CI_ROWS:-.github/vv-rows.json}
workflow=${LEXLEAN_CI_WORKFLOW:-.github/workflows/ci.yml}
repo=${REPO:?REPO names owner/name}
sha=${SHA:?SHA names the tagged commit}
out=${OUT:?OUT names the evidence file}
ref=${REF:-}
release_run=${RELEASE_RUN:-}

hosts=$(grep -c '^ - { os: ' "$workflow")
parts=$(jq -r '.[].part' "$rows_file")

# These are the four auxiliary §8.3 contexts, not the number of matrix rows.
# Linux x86-64 is the normative gate; Intel macOS is a static aggregate. Every
# required context must occur exactly once, so a duplicate or foreign context
# cannot replace a missing host even when the total count remains four.
hosts_passed() {
awk -F'\t' '
BEGIN {
expected["build and non-Lean tests (aarch64-unknown-linux-gnu)"] = 1
expected["build and non-Lean tests (x86_64-apple-darwin)"] = 1
expected["build and non-Lean tests (aarch64-apple-darwin)"] = 1
expected["build and non-Lean tests (x86_64-pc-windows-msvc)"] = 1
}
/^build and non-Lean tests \(/ {
if (!($1 in expected) || ++seen[$1] != 1 || $2 != "success") bad = 1
}
END {
for (host in expected) if (seen[host] != 1) bad = 1
exit bad
}'
}

# The jobs of a run as `name<TAB>conclusion<TAB>started<TAB>completed`, or
# nothing when the run cannot be read.
jobs_of() {
Expand All @@ -47,7 +66,7 @@ whole_gate_passed() {
printf '%s\n' "$jobs" | awk -F'\t' '$2 != "success" { bad = 1 } END { exit bad }' || return 1
# Quiet grep can close the pipe early and make printf fail under pipefail.
printf '%s\n' "$jobs" | grep -xP 'atlas \(join\)\tsuccess\t.*' >/dev/null || return 1
[ "$(printf '%s\n' "$jobs" | grep -c '^build and non-Lean tests (')" -eq "$hosts" ] || return 1
printf '%s\n' "$jobs" | hosts_passed || return 1
for part in $parts; do
job="just vv ($part)"
[ "$part" != honesty ] || job=honesty
Expand Down
Loading
Loading