Skip to content

Commit 85707c8

Browse files
committed
Update GitHub Actions workflows to use Bun instead of Yarn/Node.js
1 parent 7fda378 commit 85707c8

File tree

5 files changed

+103
-40
lines changed

5 files changed

+103
-40
lines changed

.github/workflows/README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Tornado-SVM GitHub Actions Workflows
22

3+
## Build Workflow
4+
5+
### Workflow: `build.yml`
6+
7+
**Purpose:** Build, test, and validate the Tornado-SVM codebase using the Bun JavaScript runtime and Solana build tools.
8+
9+
### Trigger Methods:
10+
11+
1. **On Push:** Runs on all branch pushes and version tags
12+
2. **On Pull Request:** Runs on all pull requests
13+
14+
### What the Workflow Does:
15+
16+
1. Sets up Bun and Rust toolchains
17+
2. Installs Solana build tools
18+
3. Builds the Solana program using Cargo build-sbf
19+
4. Runs program tests
20+
5. Lints the code with Clippy
21+
6. Builds and tests the client
22+
23+
### Technologies Used:
24+
25+
- **Bun:** Fast JavaScript runtime and package manager
26+
- **Rust:** Primary language for the Solana program
27+
- **Solana CLI:** For building and testing Solana programs
28+
329
## Testnet Transaction Metrics Workflow
430

531
This workflow automates the process of running Tornado-SVM privacy solution transactions on Solana testnet and generating comprehensive metrics reports.
@@ -22,7 +48,7 @@ This workflow automates the process of running Tornado-SVM privacy solution tran
2248

2349
### What the Workflow Does:
2450

25-
1. Sets up the Solana toolchain and required dependencies
51+
1. Sets up Bun runtime and the Solana toolchain
2652
2. Creates a new Solana wallet and requests an airdrop
2753
3. Deploys the Tornado-SVM program to the Solana testnet
2854
4. Initializes a new Tornado instance
@@ -65,4 +91,4 @@ To manually trigger the workflow with custom parameters:
6591
3. Click "Run workflow"
6692
4. Enter your desired parameters (denomination, Merkle tree height, RPC URL)
6793
5. Click "Run workflow"
68-
6. Once completed, download the artifacts from the workflow run
94+
6. Once completed, download the artifacts from the workflow run

.github/workflows/build.yml

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,47 @@ name: build
33
on:
44
push:
55
branches: ['*']
6-
tags: ['v[0-9]+.[0-9]+.[0-9]+']
6+
tags: ['v[0-9]+.[0-9]+.[0-9]+']
77
pull_request:
88

99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v2
15-
- name: Setup Node.js
16-
uses: actions/setup-node@v3
14+
uses: actions/checkout@v3
15+
16+
- name: Setup Bun
17+
uses: oven-sh/setup-bun@v1
1718
with:
18-
node-version: '16'
19-
- run: yarn install
20-
- run: yarn download
21-
- run: cp .env.example .env
22-
- run: npx ganache-cli > /dev/null &
23-
- run: npm run migrate:dev
24-
- run: yarn test
25-
- run: node src/cli.js test
26-
- run: yarn lint
27-
- run: yarn coverage
28-
- name: Coveralls
29-
uses: coverallsapp/github-action@master
19+
bun-version: latest
20+
21+
- name: Install dependencies
22+
run: bun install
23+
24+
# Rust setup and build
25+
- name: Install Rust
26+
uses: dtolnay/rust-toolchain@stable
3027
with:
31-
github-token: ${{ secrets.GITHUB_TOKEN }}
28+
components: rustfmt, clippy
29+
30+
- name: Install Solana tools
31+
run: |
32+
sh -c "$(curl -sSfL https://release.solana.com/v1.16.0/install)"
33+
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
34+
solana --version
35+
36+
- name: Build Solana program
37+
run: cargo build-bpf
38+
39+
- name: Run Solana tests
40+
run: cargo test-bpf
41+
42+
- name: Run Cargo Clippy
43+
run: cargo clippy -- -D warnings
44+
45+
- name: Build client
46+
run: cd client && bun install
47+
48+
- name: Run client tests
49+
run: cd client && bun test

.github/workflows/tornado_testnet_transaction.yml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,15 @@ jobs:
3838
- name: Checkout code
3939
uses: actions/checkout@v3
4040

41-
- name: Setup Node.js
42-
uses: actions/setup-node@v3
41+
- name: Setup Bun
42+
uses: oven-sh/setup-bun@v1
4343
with:
44-
node-version: '16'
45-
cache: 'npm'
46-
cache-dependency-path: 'client/package.json'
44+
bun-version: latest
4745

4846
- name: Install dependencies
4947
run: |
50-
npm install -g @solana/web3.js commander fs crypto bn.js bs58 borsh
51-
npm install -g chartjs-node-canvas chart.js
48+
bun install
49+
bun install -g chartjs-node-canvas chart.js
5250
sudo apt-get update
5351
sudo apt-get install -y libudev-dev libusb-1.0-0-dev pkg-config
5452
@@ -58,11 +56,9 @@ jobs:
5856
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
5957
solana --version
6058
61-
- name: Install Rust and Cargo
62-
uses: actions-rs/toolchain@v1
59+
- name: Install Rust
60+
uses: dtolnay/rust-toolchain@stable
6361
with:
64-
profile: minimal
65-
toolchain: stable
6662
components: rustfmt, clippy
6763

6864
- name: Setup metrics directory
@@ -84,7 +80,7 @@ jobs:
8480
echo "- Merkle Tree Height: ${{ github.event.inputs.merkle_tree_height || '20' }}" >> reports/transaction_report.md
8581
echo "- Solana RPC URL: ${{ github.event.inputs.rpc_url || 'https://api.testnet.solana.com' }}" >> reports/transaction_report.md
8682
echo "- Solana Version: $(solana --version)" >> reports/transaction_report.md
87-
echo "- Node.js Version: $(node --version)" >> reports/transaction_report.md
83+
echo "- Bun Version: $(bun --version)" >> reports/transaction_report.md
8884
echo "- Rust Version: $(rustc --version)" >> reports/transaction_report.md
8985
echo "- Wallet Address: $(solana address)" >> reports/transaction_report.md
9086
echo "" >> reports/transaction_report.md
@@ -164,12 +160,12 @@ jobs:
164160
# Generate detailed transaction metrics using our custom script
165161
if [ -f reports/metrics/deposit_signature.txt ]; then
166162
DEPOSIT_SIG=$(cat reports/metrics/deposit_signature.txt)
167-
node scripts/generate_metrics.js "$DEPOSIT_SIG" "${{ github.event.inputs.rpc_url || 'https://api.testnet.solana.com' }}" > reports/metrics/deposit_metrics.json
163+
bun scripts/generate_metrics.js "$DEPOSIT_SIG" "${{ github.event.inputs.rpc_url || 'https://api.testnet.solana.com' }}" > reports/metrics/deposit_metrics.json
168164
fi
169165
170166
if [ -f reports/metrics/withdraw_signature.txt ]; then
171167
WITHDRAW_SIG=$(cat reports/metrics/withdraw_signature.txt)
172-
node scripts/generate_metrics.js "$WITHDRAW_SIG" "${{ github.event.inputs.rpc_url || 'https://api.testnet.solana.com' }}" > reports/metrics/withdraw_metrics.json
168+
bun scripts/generate_metrics.js "$WITHDRAW_SIG" "${{ github.event.inputs.rpc_url || 'https://api.testnet.solana.com' }}" > reports/metrics/withdraw_metrics.json
173169
fi
174170
175171
- name: Generate detailed performance report
@@ -189,7 +185,7 @@ jobs:
189185
DEPOSIT_SIG=$(cat reports/metrics/deposit_signature.txt)
190186
chmod +x scripts/analyze_transaction_complexity.js
191187
echo "### Deposit Transaction Complexity Analysis" >> reports/transaction_report.md
192-
node scripts/analyze_transaction_complexity.js "$DEPOSIT_SIG" "${{ github.event.inputs.rpc_url || 'https://api.testnet.solana.com' }}" > reports/metrics/deposit_complexity.json
188+
bun scripts/analyze_transaction_complexity.js "$DEPOSIT_SIG" "${{ github.event.inputs.rpc_url || 'https://api.testnet.solana.com' }}" > reports/metrics/deposit_complexity.json
193189
echo "\`\`\`json" >> reports/transaction_report.md
194190
cat reports/metrics/deposit_complexity.json >> reports/transaction_report.md
195191
echo "\`\`\`" >> reports/transaction_report.md
@@ -219,7 +215,7 @@ jobs:
219215
# Run complexity analysis on withdraw transaction
220216
WITHDRAW_SIG=$(cat reports/metrics/withdraw_signature.txt)
221217
echo "### Withdraw Transaction Complexity Analysis" >> reports/transaction_report.md
222-
node scripts/analyze_transaction_complexity.js "$WITHDRAW_SIG" "${{ github.event.inputs.rpc_url || 'https://api.testnet.solana.com' }}" > reports/metrics/withdraw_complexity.json
218+
bun scripts/analyze_transaction_complexity.js "$WITHDRAW_SIG" "${{ github.event.inputs.rpc_url || 'https://api.testnet.solana.com' }}" > reports/metrics/withdraw_complexity.json
223219
echo "\`\`\`json" >> reports/transaction_report.md
224220
cat reports/metrics/withdraw_complexity.json >> reports/transaction_report.md
225221
echo "\`\`\`" >> reports/transaction_report.md

docs/github_actions.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,29 @@ This document outlines the GitHub Actions workflows available for automating tes
66

77
## Available Workflows
88

9+
### Build Workflow
10+
11+
**File:** `.github/workflows/build.yml`
12+
13+
**Purpose:**
14+
This workflow handles the building, testing, and validation of the Tornado-SVM codebase using the Bun JavaScript runtime and Solana build tools. It provides quick feedback on code quality and functionality.
15+
16+
**Key Features:**
17+
- Builds the Solana program using Cargo build-sbf
18+
- Runs integration tests for the program
19+
- Builds and tests the client code
20+
- Performs code linting with Clippy
21+
22+
**Triggers:**
23+
- Executes on all Git pushes to any branch
24+
- Runs on version tags matching `v[0-9]+.[0-9]+.[0-9]+`
25+
- Executes on all pull requests
26+
27+
**Technologies:**
28+
- Uses Bun for JavaScript runtime and package management
29+
- Uses the latest Rust toolchain for Solana program development
30+
- Uses Solana CLI tools for program building and testing
31+
932
### Tornado Testnet Transaction Test
1033

1134
**File:** `.github/workflows/tornado_testnet_transaction.yml`
@@ -83,11 +106,11 @@ By running this workflow regularly or after significant changes, the team can mo
83106

84107
## Development Notes
85108

86-
The workflow uses several custom scripts for capturing and analyzing metrics:
109+
The workflow uses several custom scripts for capturing and analyzing metrics, executed with Bun:
87110

88111
- `run_tornado_transaction_metrics.sh`: Modified version of the transaction script that captures timing data
89112
- `generate_metrics.js`: Extracts detailed transaction data from the Solana network
90113
- `analyze_transaction_complexity.js`: Analyzes computational complexity of operations
91114
- `format_report.js`: Formats metrics into a readable report
92115

93-
Developers can modify these scripts to capture additional metrics or change how they're presented in the report.
116+
Developers can modify these scripts to capture additional metrics or change how they're presented in the report.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"deploy": "solana program deploy target/deploy/tornado_svm.so",
1010
"lint": "cargo clippy -- -D warnings",
1111
"format": "cargo fmt --all",
12-
"client:build": "cd client && npm install",
13-
"client:test": "cd client && npm test"
12+
"client:build": "cd client && bun install",
13+
"client:test": "cd client && bun test"
1414
},
1515
"keywords": [
1616
"solana",
@@ -28,4 +28,4 @@
2828
"devDependencies": {
2929
"prettier": "^2.2.1"
3030
}
31-
}
31+
}

0 commit comments

Comments
 (0)