Skip to content

Commit 9807105

Browse files
fix: require script/Build.sol, no legacy name, no skip
Accepting the legacy name kept the hardcoded-name hazard alive and let repos defer indefinitely. script/Build.sol is the name; a repo that commits src/generated/ without it goes red. Repos that don't want to upgrade pin rainix. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7adf92f commit 9807105

1 file changed

Lines changed: 11 additions & 24 deletions

File tree

‎.github/workflows/rainix-copy-artifacts.yaml‎

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,19 @@ jobs:
2929
- name: Regenerate meta artifacts
3030
if: hashFiles('script/build-meta.sh') != ''
3131
run: nix develop github:rainlanguage/rainix/${{ env.RAINIX_SHA }}#sol-shell -c ./script/build-meta.sh
32-
# A repo that commits generated sources but exposes no regen step passes
33-
# every check below without anything being regenerated, which is
34-
# indistinguishable from a real pass. Fail loudly instead.
35-
- name: Assert committed generated sources have a regen step
32+
# Committed generated sources must be regenerable here, or the currency
33+
# check below passes without checking anything. The codegen script is
34+
# `script/Build.sol`, matched exactly: a repo that renames or drops it
35+
# goes red rather than skipping regeneration and reporting green.
36+
- name: Regenerate generated sources
3637
run: |
37-
if [ -d src/generated ] \
38-
&& [ ! -f script/Build.sol ] \
39-
&& [ ! -f script/BuildPointers.sol ] \
40-
&& [ ! -f script/build.sh ]; then
41-
echo "::error::src/generated/ is committed but no regen step was found (script/Build.sol, script/BuildPointers.sol or script/build.sh), so the currency check below would pass without regenerating anything."
38+
if [ -d src/generated ] && [ ! -f script/Build.sol ]; then
39+
echo "::error::src/generated/ is committed but script/Build.sol was not found, so the committed sources cannot be currency checked here. The codegen script must be script/Build.sol."
4240
exit 1
4341
fi
44-
# The codegen script is consumer named: `script/Build.sol` is the
45-
# convention, `script/BuildPointers.sol` the legacy name. Both are matched
46-
# because a repo that renames its script must not silently stop being
47-
# regenerated, and so must not be forced to rename in lockstep with this
48-
# workflow, which consumers track at @main.
49-
- name: Regenerate generated sources
50-
if: hashFiles('script/Build.sol', 'script/BuildPointers.sol') != ''
51-
run: |
52-
for candidate in script/Build.sol script/BuildPointers.sol; do
53-
if [ -f "$candidate" ]; then
54-
nix develop github:rainlanguage/rainix/${{ env.RAINIX_SHA }}#sol-shell -c forge script "./$candidate"
55-
break
56-
fi
57-
done
42+
if [ -f script/Build.sol ]; then
43+
nix develop github:rainlanguage/rainix/${{ env.RAINIX_SHA }}#sol-shell -c forge script ./script/Build.sol
44+
fi
5845
- name: Build Solidity
5946
run: nix develop github:rainlanguage/rainix/${{ env.RAINIX_SHA }}#sol-shell -c forge build
6047
- name: Copy forge artifacts into committed location
@@ -71,6 +58,6 @@ jobs:
7158
- name: Assert committed artifacts match freshly built
7259
run: |
7360
if ! git diff --exit-code; then
74-
echo "::error::Committed artifacts are stale. Regenerate (script/build-meta.sh, your codegen script, script/CopyArtifacts.sol, script/build.sh, forge fmt) and commit."
61+
echo "::error::Committed artifacts are stale. Regenerate (script/build-meta.sh, script/Build.sol, script/CopyArtifacts.sol, script/build.sh, forge fmt) and commit."
7562
exit 1
7663
fi

0 commit comments

Comments
 (0)