-
Notifications
You must be signed in to change notification settings - Fork 3
CI: cache Foundry build to skip recompiling unchanged contracts #203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,16 @@ jobs: | |
| primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} | ||
| restore-prefixes-first-match: nix-${{ runner.os }}- | ||
| gc-max-store-size-linux: 8G | ||
| # Cache Foundry's incremental compilation cache only (NOT out/): out/ is | ||
| # regenerated fresh each run so the committed-artifact assert stays a true | ||
| # clean-build check, while cache/ still speeds recompilation. | ||
| - name: Cache Foundry build | ||
| uses: actions/cache@v4 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE=".github/workflows/rainix-copy-artifacts.yaml"
echo "== File =="
ls -l "$FILE" || true
echo
echo "== Lines around 20-60 =="
nl -ba "$FILE" | sed -n '1,120p'Repository: rainlanguage/rainix Length of output: 256 🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE=".github/workflows/rainix-copy-artifacts.yaml"
echo "== Snippet around line 36 =="
# Print a small window around the referenced line
cat -n "$FILE" | sed -n '25,50p'Repository: rainlanguage/rainix Length of output: 1731 🌐 Web query:
💡 Result: For actions/cache v4, the recommended pinned commit SHAs are: - v4.2.0: 0c2c1d8… (full SHA) — not found in the sources I retrieved. - v3.4.0: (full SHA) — not found in the sources I retrieved. What I can state with high confidence from authoritative sources: - The actions/cache repository explicitly says that if you are using pinned SHAs, you should use the SHAs of versions v4.2.0 or v3.4.0. [1] - The GitHub UI “actions/cache at v4” page and the releases/changelog in the repo confirm that v4 exists and show subsequent release bumps (e.g., v4.0.5 and up), but the retrieved snippets do not include the actual full commit SHA values for v4.2.0. [1][2] If you want, tell me whether you need (a) the full 40-character commit SHA for v4.2.0, (b) the SHA(s) for a specific v4.x.y tag, or (c) the SHA corresponding to “actions/cache@v4.2.0” specifically, and I’ll do one more targeted lookup to extract the exact pinned SHA(s). Citations:
Pin
🧰 Tools🪛 zizmor (1.25.2)[error] 36-36: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||
| with: | ||
| path: cache | ||
| key: foundry-${{ runner.os }}-${{ hashFiles('src/**/*.sol', 'test/**/*.sol', 'script/**/*.sol', 'foundry.toml', 'soldeer.lock', 'remappings.txt') }} | ||
| restore-keys: | | ||
| foundry-${{ runner.os }}- | ||
| - name: Install soldeer dependencies | ||
| if: hashFiles('soldeer.lock') != '' | ||
| run: nix develop github:rainlanguage/rainix#sol-shell -c forge soldeer install | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,17 @@ jobs: | |
| primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} | ||
| restore-prefixes-first-match: nix-${{ runner.os }}- | ||
| gc-max-store-size-linux: 8G | ||
| # Cache Foundry's incremental compilation cache + artifacts so unchanged | ||
| # contracts aren't recompiled (forge build is the dominant CI cost). | ||
| - name: Cache Foundry build | ||
| uses: actions/cache@v4 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE=".github/workflows/rainix-manual-sol-artifacts.yaml"
echo "== exists? =="
ls -l "$FILE" || true
echo "== relevant lines (35-60) =="
nl -ba "$FILE" | sed -n '35,60p'
echo "== all actions/cache@ occurrences =="
rg -n "actions/cache@"
"$FILE" || trueRepository: rainlanguage/rainix Length of output: 267 🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE=".github/workflows/rainix-manual-sol-artifacts.yaml"
echo "== relevant lines (35-60) =="
cat -n "$FILE" | sed -n '35,60p'
echo "== all actions/cache@ occurrences =="
( command -v rg >/dev/null 2>&1 && rg -n "actions/cache@" "$FILE" ) || grep -n "actions/cache@" "$FILE" || trueRepository: rainlanguage/rainix Length of output: 1811 Pin Suggested change- - name: Cache Foundry build
- uses: actions/cache@v4
+ - name: Cache Foundry build
+ uses: actions/cache@<FULL_LENGTH_COMMIT_SHA_FOR_V4>🧰 Tools🪛 zizmor (1.25.2)[error] 43-43: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||
| with: | ||
| path: | | ||
| cache | ||
| out | ||
| key: foundry-${{ runner.os }}-${{ hashFiles('src/**/*.sol', 'test/**/*.sol', 'script/**/*.sol', 'foundry.toml', 'soldeer.lock', 'remappings.txt') }} | ||
| restore-keys: | | ||
| foundry-${{ runner.os }}- | ||
| - name: Install soldeer dependencies | ||
| if: hashFiles('soldeer.lock') != '' | ||
| run: nix develop github:rainlanguage/rainix#sol-shell -c forge soldeer install | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,17 @@ jobs: | |
| primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} | ||
| restore-prefixes-first-match: nix-${{ runner.os }}- | ||
| gc-max-store-size-linux: 8G | ||
| # Cache Foundry's incremental compilation cache + artifacts so unchanged | ||
| # contracts aren't recompiled (forge build is the dominant CI cost). | ||
| - name: Cache Foundry build | ||
| uses: actions/cache@v4 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
ls -la .github/workflows || true
sed -n '1,140p' .github/workflows/rainix-sol-static.yaml | nl -ba | sed -n '1,120p'
echo "----"
# show just the relevant line range around 36
sed -n '25,60p' .github/workflows/rainix-sol-static.yaml | nl -ba | sed -n '1,80p'Repository: rainlanguage/rainix Length of output: 1448 🏁 Script executed: #!/bin/bash
set -euo pipefail
if [ -f .github/workflows/rainix-sol-static.yaml ]; then
echo "FOUND: .github/workflows/rainix-sol-static.yaml"
else
echo "MISSING: .github/workflows/rainix-sol-static.yaml"
exit 1
fi
nl -ba .github/workflows/rainix-sol-static.yaml | sed -n '1,120p'
echo "---- around lines 30-45 ----"
nl -ba .github/workflows/rainix-sol-static.yaml | sed -n '25,50p'Repository: rainlanguage/rainix Length of output: 173 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "---- File: .github/workflows/rainix-sol-static.yaml (lines 20-60) ----"
awk 'NR>=20 && NR<=60 {print NR ":" $0}' .github/workflows/rainix-sol-static.yaml
echo "---- All occurrences of actions/cache in the file ----"
rg -n "actions/cache@" .github/workflows/rainix-sol-static.yaml || trueRepository: rainlanguage/rainix Length of output: 1780 Pin
Suggested change- - name: Cache Foundry build
- uses: actions/cache@v4
+ - name: Cache Foundry build
+ uses: actions/cache@<FULL_LENGTH_COMMIT_SHA_FOR_V4>🧰 Tools🪛 zizmor (1.25.2)[error] 36-36: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||
| with: | ||
| path: | | ||
| cache | ||
| out | ||
| key: foundry-${{ runner.os }}-${{ hashFiles('src/**/*.sol', 'test/**/*.sol', 'script/**/*.sol', 'foundry.toml', 'soldeer.lock', 'remappings.txt') }} | ||
| restore-keys: | | ||
| foundry-${{ runner.os }}- | ||
| - name: Install soldeer dependencies | ||
| if: hashFiles('soldeer.lock') != '' | ||
| run: nix develop github:rainlanguage/rainix#sol-shell -c forge soldeer install | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,17 @@ jobs: | |
| primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} | ||
| restore-prefixes-first-match: nix-${{ runner.os }}- | ||
| gc-max-store-size-linux: 8G | ||
| # Cache Foundry's incremental compilation cache + artifacts so unchanged | ||
| # contracts aren't recompiled (forge build is the dominant CI cost). | ||
| - name: Cache Foundry build | ||
| uses: actions/cache@v4 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Show the relevant section around line 65
echo "=== rainix-sol-test.yaml (lines 50-90) ==="
nl -ba .github/workflows/rainix-sol-test.yaml | sed -n '50,90p'
# Find all usages of actions/cache in the repo
echo "=== All uses of actions/cache ==="
rg -n --hidden "uses:\s*actions/cache@" .github/workflows || trueRepository: rainlanguage/rainix Length of output: 167 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== rainix-sol-test.yaml (lines 50-90) ==="
cat -n .github/workflows/rainix-sol-test.yaml | sed -n '50,90p'
echo "=== All uses of actions/cache ==="
rg -n --hidden "uses:\s*actions/cache@" .github/workflows . || trueRepository: rainlanguage/rainix Length of output: 2624 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== rainix-sol-test.yaml (lines 50-90) ==="
cat -n .github/workflows/rainix-sol-test.yaml | sed -n '50,90p'
echo "=== All uses of actions/cache ==="
rg -n --hidden "uses:\s*actions/cache@" .github/workflows . || trueRepository: rainlanguage/rainix Length of output: 2624 Pin
Suggested change- - name: Cache Foundry build
- uses: actions/cache@v4
+ - name: Cache Foundry build
+ uses: actions/cache@<FULL_LENGTH_COMMIT_SHA_FOR_V4>🧰 Tools🪛 zizmor (1.25.2)[error] 65-65: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||
| with: | ||
| path: | | ||
| cache | ||
| out | ||
| key: foundry-${{ runner.os }}-${{ hashFiles('src/**/*.sol', 'test/**/*.sol', 'script/**/*.sol', 'foundry.toml', 'soldeer.lock', 'remappings.txt') }} | ||
| restore-keys: | | ||
| foundry-${{ runner.os }}- | ||
| - name: Install soldeer dependencies | ||
| if: hashFiles('soldeer.lock') != '' | ||
| run: nix develop github:rainlanguage/rainix#sol-shell -c forge soldeer install | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -54,6 +54,17 @@ jobs: | |||||||||||||||||||||
| primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} | ||||||||||||||||||||||
| restore-prefixes-first-match: nix-${{ runner.os }}- | ||||||||||||||||||||||
| gc-max-store-size-linux: 8G | ||||||||||||||||||||||
| # Cache Foundry's incremental compilation cache + artifacts so unchanged | ||||||||||||||||||||||
| # contracts aren't recompiled (forge build is the dominant CI cost). | ||||||||||||||||||||||
| - name: Cache Foundry build | ||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Locate cache action usage
rg -n "actions/cache@" .github/workflows || true
# Show workflow around the referenced line(s)
nl -ba .github/workflows/test.yml | sed -n '1,140p' | sed -n '40,95p'Repository: rainlanguage/rainix Length of output: 576 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== test.yml context around uses: actions/cache@v4 =="
sed -n '50,75p' .github/workflows/test.yml | cat -n
echo
echo "== Check for any commit-pinned actions/cache in repo =="
rg -n "actions/cache@([0-9a-f]{40}|\$\\{\\{.*\\}\\})|actions/cache@v" .github/workflowsRepository: rainlanguage/rainix Length of output: 1962 Pin
Suggested change- - name: Cache Foundry build
- uses: actions/cache@v4
+ - name: Cache Foundry build
+ uses: actions/cache@<FULL_LENGTH_COMMIT_SHA_FOR_V4>🧰 Tools🪛 zizmor (1.25.2)[error] 60-60: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| path: | | ||||||||||||||||||||||
| cache | ||||||||||||||||||||||
| out | ||||||||||||||||||||||
| key: foundry-${{ runner.os }}-${{ hashFiles('src/**/*.sol', 'test/**/*.sol', 'script/**/*.sol', 'foundry.toml', 'soldeer.lock', 'remappings.txt') }} | ||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||
|
Comment on lines
+62
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cache path/key scope doesn’t match this job’s Foundry working directory. This job runs Forge from Suggested change - name: Cache Foundry build
uses: actions/cache@v4
with:
path: |
- cache
- out
- key: foundry-${{ runner.os }}-${{ hashFiles('src/**/*.sol', 'test/**/*.sol', 'script/**/*.sol', 'foundry.toml', 'soldeer.lock', 'remappings.txt') }}
+ test/fixture/cache
+ test/fixture/out
+ key: foundry-${{ runner.os }}-${{ hashFiles('test/fixture/src/**/*.sol', 'test/fixture/test/**/*.sol', 'test/fixture/script/**/*.sol', 'test/fixture/foundry.toml', 'test/fixture/soldeer.lock', 'test/fixture/remappings.txt') }}
restore-keys: |
foundry-${{ runner.os }}-📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| foundry-${{ runner.os }}- | ||||||||||||||||||||||
| - run: nix develop ../.. --command forge soldeer install | ||||||||||||||||||||||
| - name: Run ${{ matrix.task }} | ||||||||||||||||||||||
| env: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: rainlanguage/rainix
Length of output: 106
🏁 Script executed:
Repository: rainlanguage/rainix
Length of output: 2503
🏁 Script executed:
Repository: rainlanguage/rainix
Length of output: 2894
Pin
actions/cacheto a full commit SHA.actions/cache@v4is mutable; pin thisusesreference to an immutable full commit SHA in.github/workflows/rainix-build-pointers.yaml(it’s also currently unpinned in multiple other workflows).Suggested change
🧰 Tools
🪛 zizmor (1.25.2)
[error] 38-38: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents