-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (113 loc) · 4.61 KB
/
Copy pathsuite-watch.yml
File metadata and controls
132 lines (113 loc) · 4.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Suite watch
# The suite is pinned by commit so a build is reproducible and a red run always
# has a commit of its own to explain it. That pin is also how a repository stops
# noticing that the oracle it is judged against has moved.
#
# So this runs weekly against whatever upstream holds now. It never changes the
# pin on its own. If the newer suite passes it opens a pull request proposing the
# bump, with the run behind it. If the newer suite fails it opens an issue naming
# the opcodes that disagree, because either the suite found a real defect here or
# upstream changed its mind about the hardware. Both are worth a person reading.
on:
schedule:
- cron: "17 6 * * 1"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
issues: write
concurrency:
group: suite-watch
cancel-in-progress: false
jobs:
revalidate:
name: Re-validate against the newest suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Ask upstream where it is now
id: upstream
run: |
python - <<'PY' >> "${GITHUB_OUTPUT}"
import json, os, pathlib, sys
sys.path.insert(0, "conformance")
import fetch
suite = fetch.definitions()[0]
latest = fetch.latest_commit(suite)
print(f"pinned={suite['commit']}")
print(f"latest={latest or ''}")
print(f"moved={str(bool(latest) and latest != suite['commit']).lower()}")
PY
- name: Nothing to do
if: steps.upstream.outputs.latest == ''
run: |
echo "::warning::upstream could not be reached; leaving the pin alone"
exit 0
- name: Fetch the newer suite
if: steps.upstream.outputs.moved == 'true'
run: |
python - "${{ steps.upstream.outputs.latest }}" <<'PY'
import pathlib, sys
sys.path.insert(0, "conformance")
import fetch
suite = fetch.definitions()[0]
where = fetch.fetch(suite, pathlib.Path.home() / ".cache" / "suite", sys.argv[1])
print(where)
PY
- name: Run the whole suite
if: steps.upstream.outputs.moved == 'true'
id: run
continue-on-error: true
run: |
set -o pipefail
python -m conformance.singlestep ~/.cache/suite/spc700/v1 \
| tee /tmp/report.txt
- name: Propose the bump
if: steps.upstream.outputs.moved == 'true' && steps.run.outcome == 'success'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LATEST: ${{ steps.upstream.outputs.latest }}
PINNED: ${{ steps.upstream.outputs.pinned }}
run: |
branch="suite/${LATEST:0:12}"
if git ls-remote --exit-code --heads origin "${branch}" >/dev/null 2>&1; then
echo "already proposed"
exit 0
fi
python - <<'PY'
import json, os, pathlib
path = pathlib.Path("conformance/suites.json")
text = path.read_text()
path.write_text(text.replace(os.environ["PINNED"], os.environ["LATEST"]))
PY
git switch -c "${branch}"
git add conformance/suites.json
git commit -m "test: move the spc700 suite pin to ${LATEST:0:12}"
git push -u origin "${branch}"
gh pr create \
--title "test: move the spc700 suite pin to ${LATEST:0:12}" \
--body-file - <<BODY
Upstream has moved and the whole suite still passes against the newer commit, so the pin can follow it. No source change is needed.
Was \`${PINNED}\`, now \`${LATEST}\`.
$(cat /tmp/report.txt)
BODY
- name: Report the disagreement
if: steps.upstream.outputs.moved == 'true' && steps.run.outcome == 'failure'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LATEST: ${{ steps.upstream.outputs.latest }}
PINNED: ${{ steps.upstream.outputs.pinned }}
run: |
title="Conformance fails against suite ${LATEST:0:12}"
if [ -n "$(gh issue list --search "${title} in:title" --state open --json number --jq '.[].number')" ]; then
echo "already reported"
exit 0
fi
gh issue create --title "${title}" --body-file - <<BODY
The pinned suite still passes. A newer upstream commit does not, so either it found a real defect here or upstream changed what it believes the hardware does. The pin has not moved.
Pinned \`${PINNED}\`, tried \`${LATEST}\`.
$(cat /tmp/report.txt)
BODY