Added caching to windows, linux and mac CI#100
Conversation
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughSwift test scripts now target a specific test product. Linux, macOS, and Windows workflows add Swift package caching, while Linux and Windows also cancel superseded runs and sequence example builds after tests. ChangesSwift CI updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
.github/workflows/swift-test-mac.yml (2)
21-21: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winPin
actions/cacheto a commit SHA.The new cache steps use mutable
actions/cache@v4, whereasactions/checkoutis already pinned. Pin the cache action to a verified full commit SHA to keep CI behavior reproducible and reduce supply-chain risk.Also applies to: 45-45
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/swift-test-mac.yml at line 21, Replace both uses of actions/cache@v4 in the workflow with the verified full commit SHA for the intended cache action version, matching the existing actions/checkout pinning style and preserving the current cache-step behavior.
20-28: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winUse separate cache keys for the test and example-build jobs.
Both jobs cache
.buildunder the identical key, whilebuild-examplecan run independently oftest. Concurrent runs may therefore save different TSAN/example artifacts under the same immutable key, making future cache contents nondeterministic and reducing cache effectiveness. Add job-specific key suffixes, or cache only the shared SwiftPM download directory.Also applies to: 44-52
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/swift-test-mac.yml around lines 20 - 28, Update the Swift Package Manager cache configuration so the test and build-example jobs do not share an identical key for .build artifacts. Add distinct job-specific suffixes to each job’s key and corresponding restore-keys, or restrict caching to the shared SwiftPM download directory; preserve caching behavior otherwise..github/workflows/swift-test-linux.yml (1)
30-32: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winMake cache identity include the Swift toolchain. The current keys can reuse
.buildartifacts across future compiler or architecture changes.
.github/workflows/swift-test-linux.yml#L30-L32: add the Swift image/toolchain and architecture to the Linux test cache key..github/workflows/swift-test-linux.yml#L62-L64: use the same toolchain-aware key for the Linux example build..github/workflows/swift-test-windows.yml#L38-L40: add the configured Swift version and architecture to the Windows test cache key..github/workflows/swift-test-windows.yml#L67-L69: use the same toolchain-aware key for the Windows example build.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/swift-test-linux.yml around lines 30 - 32, Update the cache keys and restore keys for both Swift test and example-build caches to include the configured Swift image/toolchain or version and architecture, in addition to the runner OS and Package.resolved hash. Apply the same toolchain-aware key consistently at .github/workflows/swift-test-linux.yml lines 30-32 and 62-64, and .github/workflows/swift-test-windows.yml lines 38-40 and 67-69.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/swift-test-linux.yml:
- Line 27: Pin the cache action references to reviewed immutable commit SHAs
instead of mutable tags: update actions/cache@v4 at
.github/workflows/swift-test-linux.yml lines 27-27 and 59-59 and
.github/workflows/swift-test-windows.yml lines 33-33, and update
actions/cache/restore@v4 at .github/workflows/swift-test-windows.yml lines
62-62. Preserve each workflow’s existing cache behavior.
---
Nitpick comments:
In @.github/workflows/swift-test-linux.yml:
- Around line 30-32: Update the cache keys and restore keys for both Swift test
and example-build caches to include the configured Swift image/toolchain or
version and architecture, in addition to the runner OS and Package.resolved
hash. Apply the same toolchain-aware key consistently at
.github/workflows/swift-test-linux.yml lines 30-32 and 62-64, and
.github/workflows/swift-test-windows.yml lines 38-40 and 67-69.
In @.github/workflows/swift-test-mac.yml:
- Line 21: Replace both uses of actions/cache@v4 in the workflow with the
verified full commit SHA for the intended cache action version, matching the
existing actions/checkout pinning style and preserving the current cache-step
behavior.
- Around line 20-28: Update the Swift Package Manager cache configuration so the
test and build-example jobs do not share an identical key for .build artifacts.
Add distinct job-specific suffixes to each job’s key and corresponding
restore-keys, or restrict caching to the shared SwiftPM download directory;
preserve caching behavior otherwise.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 01d5df18-f97c-43fc-aa1f-36f22f7ccf38
📒 Files selected for processing (5)
.github/workflows/swift-test-linux.yml.github/workflows/swift-test-mac.yml.github/workflows/swift-test-windows.ymlScripts/test.shScripts/tsan-test.sh
| with: | ||
| persist-credentials: false | ||
| - name: Cache Swift build | ||
| uses: actions/cache@v4 |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== workflow files =="
git ls-files .github/workflows || true
echo
echo "== cache action references in workflows =="
rg -n "uses:\s*actions/cache|actions/cache/(restore|save)?" .github/workflows || true
echo
echo "== surrounding pinned action context =="
for f in .github/workflows/swift-test-linux.yml .github/workflows/swift-test-windows.yml; do
if [ -f "$f" ]; then
echo "--- $f"
nl -ba "$f" | sed -n '1,90p'
fi
done
echo
echo "== all uses in workflows under .github/workflows =="
python3 - <<'PY'
from pathlib import Path
import re
for p in sorted(Path('.github/workflows').glob('*.yml')):
for i,line in enumerate(p.read_text().splitlines(),1):
m=re.search(r'uses:\s*(v4[\d.\-A-Za-z0-9_./#:`@-`]*)', line)
if m:
print(f"{p}:{i}: {line.strip()}")
PYRepository: amethystsoft/vein
Length of output: 1033
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== swift-test-linux relevant lines =="
awk '{printf "%5d %s\n", NR, $0}' .github/workflows/swift-test-linux.yml | sed -n '1,85p'
echo
echo "== swift-test-windows relevant lines =="
awk '{printf "%5d %s\n", NR, $0}' .github/workflows/swift-test-windows.yml | sed -n '1,85p'
echo
echo "== all uses in workflow yaml files =="
python3 - <<'PY'
from pathlib import Path
import re
for p in sorted(Path('.github/workflows').glob('*.yml')):
for i,line in enumerate(p.read_text().splitlines(),1):
m=re.search(r'uses:\s*([^\s#]+)', line)
if m:
print(f"{p}:{i}: {line.strip()}")
PY
echo
echo "== cache pins context =="
python3 - <<'PY'
from pathlib import Path
import re
for p in sorted(Path('.github/workflows').glob('*.yml')):
text=p.read_text().splitlines()
for i,line in enumerate(text,1):
if 'actions/cache' in line:
print(f"{p}:{i}: {line.strip()}")
for j in range(max(1,i-2), min(len(text), i+4)+1):
print(f" {j}: {text[j-1]}")
print()
PYRepository: amethystsoft/vein
Length of output: 8649
Pin the newly added cache actions to reviewed commit SHAs. These refs use mutable actions/cache tags, unlike the SHA-pinned checkout/Swift actions in the same workflows.
.github/workflows/swift-test-linux.yml#L27and#L59: pinactions/cache@v4..github/workflows/swift-test-windows.yml#L33: pinactions/cache@v4..github/workflows/swift-test-windows.yml#L62: pinactions/cache/restore@v4.
📍 Affects 2 files
.github/workflows/swift-test-linux.yml#L27-L27(this comment).github/workflows/swift-test-linux.yml#L59-L59.github/workflows/swift-test-windows.yml#L33-L33.github/workflows/swift-test-windows.yml#L62-L62
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/swift-test-linux.yml at line 27, Pin the cache action
references to reviewed immutable commit SHAs instead of mutable tags: update
actions/cache@v4 at .github/workflows/swift-test-linux.yml lines 27-27 and 59-59
and .github/workflows/swift-test-windows.yml lines 33-33, and update
actions/cache/restore@v4 at .github/workflows/swift-test-windows.yml lines
62-62. Preserve each workflow’s existing cache behavior.
Summary
amethyst-veinPackageTestsin standard and Thread Sanitizer test scripts.The shared caching and concurrency improvements should reduce CI time and resource usage while preventing redundant runs.