Skip to content

cli: Add {pre,post}-{build,test,deploy} hooks#3862

Merged
jacobcreech merged 1 commit intosolana-foundation:masterfrom
jamie-osec:hooks
Nov 19, 2025
Merged

cli: Add {pre,post}-{build,test,deploy} hooks#3862
jacobcreech merged 1 commit intosolana-foundation:masterfrom
jamie-osec:hooks

Conversation

@jamie-osec
Copy link
Copy Markdown
Collaborator

Based on #1796
Closes #219

Example usage:

[hooks]
# Accepts kebab-case names...
pre-build = "echo foo"
# ...and snake-case names
post_build = "echo bar"
# Accepts a list of commands, run in series
pre-test = ["echo 1", "echo 2"]
# Non-zero exit codes will abort the CLI
post-test = "exit 1"
# Unused hooks may be omitted
# pre-deploy = []
# post-deploy = []

Invalid keys result in an error:

Error: Unable to deserialize config: TOML parse error at line 22, column 1
   |
22 | foobar = ""
   | ^^^^^^
unknown field `foobar`, expected one of `pre-build`, `pre_build`, `post-build`, `post_build`, `pre-test`, `pre_test`, `post-test`, `post_test`, `pre-deploy`, `pre_deploy`, `post-deploy`, `post_deploy`

@vercel
Copy link
Copy Markdown

vercel bot commented Aug 19, 2025

@jamie-osec is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@jamie-osec jamie-osec force-pushed the hooks branch 2 times, most recently from 7a277cd to 225a2f2 Compare August 19, 2025 13:15
@jamie-osec jamie-osec mentioned this pull request Oct 13, 2025
@nutafrost nutafrost moved this to In Progress in Anchor 1.0 Nov 12, 2025
@nutafrost nutafrost moved this from In Progress to Security Review Required in Anchor 1.0 Nov 12, 2025
Otter-0x4ka5h

This comment was marked as duplicate.

@0x4ka5h 0x4ka5h added the Merge label Nov 13, 2025
Copy link
Copy Markdown
Collaborator

@swaroop-osec swaroop-osec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! It would be better if we can add documentation for these changes in docs/content/docs/references/anchor-toml.mdx

@nutafrost nutafrost moved this from Security Review Required to Done in Anchor 1.0 Nov 14, 2025
@nutafrost nutafrost moved this from Done to Security Review Done in Anchor 1.0 Nov 14, 2025
@vercel
Copy link
Copy Markdown

vercel bot commented Nov 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
anchor-docs Error Error Nov 19, 2025 4:34am

@jacobcreech jacobcreech merged commit 8feb9a1 into solana-foundation:master Nov 19, 2025
55 of 56 checks passed
@github-project-automation github-project-automation bot moved this from Security Review Done to Done in Anchor 1.0 Nov 19, 2025
Otter-0x4ka5h pushed a commit to Otter-0x4ka5h/anchor that referenced this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

cli: Pre-test hook

6 participants