-
Notifications
You must be signed in to change notification settings - Fork 478
Introduce github action to run CI on new snarkVM revs #1097
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
base: mainnet
Are you sure you want to change the base?
Conversation
Introduce github action to run CI on new snarkVM revs
Signed-off-by: Mike Turner <[email protected]>
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.
Pull Request Overview
This PR introduces a GitHub Actions workflow to automatically update snarkVM dependencies when new commits are available on the staging branch. The workflow runs hourly to check for updates and creates pull requests when changes are detected.
- Automated hourly checks for new snarkVM staging commits
- Updates multiple snarkVM dependencies in the wasm directory using cargo commands
- Creates pull requests automatically when updates are found
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
git commit --no-verify -m "Update snarkVM to latest staging commit ${{ steps.snarkvm-commit.outputs.latest_commit }} | ||
|
||
Previous commit: ${{ steps.snarkvm-commit.outputs.current_commit }} | ||
Latest commit: ${{ steps.snarkvm-commit.outputs.latest_commit }} | ||
|
||
This update was performed automatically by the snarkVM update workflow." |
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.
The commit message references current_commit
on line 90, but this output variable is never set in the snarkvm-commit
step. Only latest_commit
is defined on line 42. This will result in an empty value being displayed in the commit message.
Copilot uses AI. Check for mistakes.
title: 'Update snarkVM to latest staging commit', | ||
head: 'update-snarkvm-staging', | ||
base: 'staging', | ||
body: 'This PR updates the snarkVM dependency to track the latest staging commit.\n\nLatest commit: ${{ steps.snarkvm-commit.outputs.latest_commit }}\nPrevious commit: ${{ steps.snarkvm-commit.outputs.current_commit }}\n\nThis PR was created automatically by the snarkVM update workflow.' |
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.
The PR body references current_commit
which is not defined in the snarkvm-commit
step outputs. This will result in an empty value being displayed in the pull request description.
Copilot uses AI. Check for mistakes.
if: always() | ||
run: | | ||
echo "## Workflow Summary (staging)" >> $GITHUB_STEP_SUMMARY | ||
echo "- Current snarkVM commit: ${{ steps.snarkvm-commit.outputs.current_commit }}" >> $GITHUB_STEP_SUMMARY |
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.
The summary step references current_commit
output which doesn't exist. Only latest_commit
and update_needed
are set as outputs in the snarkvm-commit
step.
echo "- Current snarkVM commit: ${{ steps.snarkvm-commit.outputs.current_commit }}" >> $GITHUB_STEP_SUMMARY |
Copilot uses AI. Check for mistakes.
core.setOutput('latest_commit', latestCommit); | ||
core.setOutput('update_needed', 'true'); | ||
|
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.
The update_needed
output is hardcoded to 'true', which means the workflow will always attempt to update regardless of whether there are actual changes. Consider implementing logic to compare the current commit with the latest commit to determine if an update is actually needed.
core.setOutput('latest_commit', latestCommit); | |
core.setOutput('update_needed', 'true'); | |
// Read the currently used snarkVM commit hash from Cargo.lock | |
const fs = require('fs'); | |
let currentCommit = null; | |
try { | |
const lockFile = fs.readFileSync('Cargo.lock', 'utf8'); | |
const match = lockFile.match(/name = "snarkVM"[^\n]*\n(?:[^\n]*\n)*?source = "git\+https:\/\/github\.com\/ProvableHQ\/snarkVM\.git\?rev=([a-f0-9]+)"/); | |
if (match && match[1]) { | |
currentCommit = match[1]; | |
} | |
} catch (e) { | |
console.log('Could not read current snarkVM commit from Cargo.lock:', e); | |
} | |
console.log('Current snarkVM commit in Cargo.lock:', currentCommit); | |
core.setOutput('latest_commit', latestCommit); | |
if (currentCommit && currentCommit === latestCommit) { | |
core.setOutput('update_needed', 'false'); | |
} else { | |
core.setOutput('update_needed', 'true'); | |
} |
Copilot uses AI. Check for mistakes.
@vicsn we'll test this out over the next few days. |
Motivation
Note: originally created by @vicsn but merged into a branch on this repo to enable it to run properly.
Similar to: ProvableHQ/snarkOS#3814
Introduces a github action to allow automated testing on snarkVM updates:
update-snarkvm-staging
branch if a new snarkVMstaging
branch rev was foundTest Plan
You can try it out by pushing this as a branch to
ProvableHQ/SDK:ci/snarkvm-update
I don't have write permissions to the SDK repo so I can't push there or add reviewers, so doing a manual tag: @iamalwaysuncomfortable