This repo serves two purposes at the moment:
- To demonstrate how to easily benchmark compute units of common Solana instructions
- As a template for .github actions on an Anchor project
Only demonstrating some basic uses here, but in this case we look at the cost of creating a Pubkey from a base58 string, versus using the 'pubkey!' macro.
Test Output:
compute_unit_benchmark
Baseline compute units: 524
Pubkey from macro used 12335 of compute units (+11811)
Pubkey from string used 20999 of compute units (+20475)
✔ It should measure a benchmark for pubkey parsing (1720ms)
I couldn't find a good example project for testing anchor programs with Github Actions.
In my case, I wanted the following:
- User can specify the version of Anchor installed
- Ability to cache the Anchor install (reduce test setup time from 10's of minutes to under 2 minutes)
- Cache node_modules
The process can be summed up as:
- Setup base linux install with necessary build packages
- Setup Solana and Anchor CLI
- Setup Node.js
- Run 'yarn' to install javascript dependecies
- Build and test anchor project
Assumes you have 'anchor' correctly installed and set up.
cd this_project_dir
yarn
anchor test