|
1 | 1 | # Checks that DafnyRuntimePython version in StandardLibrary's pyproject.toml |
2 | 2 | # 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. |
5 | 4 | name: Check DafnyRuntimePython Version Consistency |
6 | 5 |
|
7 | 6 | on: |
|
16 | 15 |
|
17 | 16 | steps: |
18 | 17 | - 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 | +
|
19 | 45 | - name: Validate DafnyRuntimePython Version Consistency |
20 | 46 | run: | |
21 | 47 | # Extract the version from pyproject.toml |
|
0 commit comments