Skip to content

Commit 486e65d

Browse files
committed
enforcement step
1 parent 56e9925 commit 486e65d

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

.github/workflows/check_dafny_runtime_versions.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Checks that DafnyRuntimePython version in StandardLibrary's pyproject.toml
22
# matches the Dafny version in project.properties.
3-
# .toml is static and cannot load this automatically.
4-
# This must be bumped manually.
3+
# Also enforces review of dafnyRuntimePythonVersion when dafnyVersion is changed.
54
name: Check DafnyRuntimePython Version Consistency
65

76
on:
@@ -16,6 +15,33 @@ jobs:
1615

1716
steps:
1817
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
# TODO: Remove this entire step when dafnyRuntimePythonVersion is deleted from project.properties
22+
- name: Enforce dafnyVersion review (PR only)
23+
if: github.event_name == 'pull_request'
24+
run: |
25+
BASE_SHA="${{ github.event.pull_request.base.sha }}"
26+
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
27+
28+
# Check if dafnyVersion was changed
29+
if git diff "$BASE_SHA" "$HEAD_SHA" -- project.properties | grep -q "^[+-]dafnyVersion="; then
30+
# Check if dafnyRuntimePythonVersion was also changed
31+
if ! git diff "$BASE_SHA" "$HEAD_SHA" -- project.properties | grep -q "^[+-]dafnyRuntimePythonVersion="; then
32+
echo "ERROR: dafnyVersion was changed but dafnyRuntimePythonVersion was not reviewed."
33+
echo ""
34+
echo "Required action (choose one):"
35+
echo "1. PREFERRED: Delete the dafnyRuntimePythonVersion line entirely if the new Dafny version is compatible"
36+
echo "2. Update dafnyRuntimePythonVersion to a compatible version"
37+
echo "3. Keep the same value but add a comment explaining why (e.g., '# Keeping 4.11.0 due to compatibility issues')"
38+
echo ""
39+
echo "This ensures conscious review of the temporary Python runtime workaround."
40+
echo "NOTE: When dafnyRuntimePythonVersion is removed, also remove this enforcement step."
41+
exit 1
42+
fi
43+
fi
44+
1945
- name: Validate DafnyRuntimePython Version Consistency
2046
run: |
2147
# Extract the version from pyproject.toml

project.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
# And the Dotnet projects include and parse this file.
88
dafnyVersion=4.9.0
99
dafnyVerifyVersion=4.9.1
10+
# TEMPORARY WORKAROUND: When updating dafnyVersion, try to REMOVE this property first.
11+
# Only keep if the new Dafny version has Python runtime compatibility issues.
12+
# GitHub workflow will enforce this review. Goal: remove this entirely.
1013
dafnyRuntimePythonVersion=4.11.0
1114
dafnyRustVersion=nightly-2025-01-30-7db1e5f
1215
mplVersion=1.11.1-SNAPSHOT

0 commit comments

Comments
 (0)