Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = [
]

[workspace.package]
version = "0.1.7"
version = "0.1.10"
edition = "2021"
authors = ["CreativesOnchain"]
license = "MIT"
Expand All @@ -17,7 +17,7 @@ keywords = ["arbitrum", "stylus", "profiling", "gas", "flamegraph"]
categories = ["development-tools::profiling", "wasm"]

[workspace.dependencies]
stylus-trace-core = { version = "0.1.7", path = "crates/stylus-trace-core" }
stylus-trace-core = { version = "0.1.10", path = "crates/stylus-trace-core" }
clap = { version = "4.5", features = ["derive", "env"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ This feature will be enabled automatically once upstream tracer support is avail
### `capture`
| Flag | Description | Default |
|------|-------------|---------|
| `--tx` | **(Required)** Transaction hash to profile | - |
| `--tx` | Transaction hash to profile | - |
| `--rpc` | RPC endpoint URL | `http://localhost:8547` |
| `--flamegraph` | Generate an SVG flamegraph | `artifacts/capture/flamegraph.svg` |
| `--output` | Save JSON profile to path | `artifacts/capture/profile.json` |
Expand Down Expand Up @@ -143,7 +143,7 @@ This feature will be enabled automatically once upstream tracer support is avail
### `ci init`
| Flag | Description | Default |
|------|-------------|---------|
| `--tx` | **(Required)** Transaction hash to profile in CI | - |
| `--tx` | Transaction hash to profile in CI (optional) | - |
| `--rpc` | RPC endpoint URL | `http://localhost:8547` |
| `--threshold` | Percentage threshold for regressions | `1.0` |
| `--force` | Overwrite existing workflow files | `false` |
Expand All @@ -157,8 +157,9 @@ Stylus Trace is built for automated performance tracking. You can integrate it i
### Quick Setup (Zero Config)
Run this in your repository to auto-generate a GitHub Actions workflow:
```bash
stylus-trace ci init --tx 0x...
stylus-trace ci init
```
*Note: You can optionally provide `--tx 0x...` now or fill it in the generated YAML later.*

### Manual Integration
You can use the [Stylus Trace Action](https://github.com/CreativesOnchain/Stylus-Trace) directly in your workflows:
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inputs:
default: 'http://localhost:8547'
tx_hash:
description: 'Transaction hash to profile'
required: true
required: false
baseline:
description: 'Path to baseline profile JSON'
required: false
Expand Down
8 changes: 4 additions & 4 deletions bin/stylus-trace-studio/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ fn main() -> Result<()> {
pub enum CiSubcommands {
/// Initialize CI/CD performance regression checks
Init {
/// Transaction hash to profile in CI
/// Transaction hash to profile in CI (optional)
#[arg(short, long)]
tx: String,
tx: Option<String>,

/// RPC endpoint URL
#[arg(short, long, default_value = "http://localhost:8547")]
/// RPC endpoint URL (optional)
#[arg(short, long)]
rpc: Option<String>,

/// Percentage threshold for regressions (e.g., 1.0)
Expand Down
22 changes: 15 additions & 7 deletions crates/stylus-trace-core/src/commands/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ pub fn execute_ci_init(args: CiInitArgs) -> Result<()> {
}

// 2. Generate YAML
let rpc_line = if let Some(rpc) = &args.rpc_url {
format!(" rpc_url: \"{}\"\n", rpc)
} else {
String::new()
};

let tx_hash = args
.transaction_hash
.as_deref()
.unwrap_or("YOUR_TRANSACTION_HASH");

let workflow_yaml = format!(
r#"name: Stylus Performance Check
Expand All @@ -49,13 +49,21 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Prepare Profiles
run: |
mkdir -p artifacts/capture
# If paths exist, stage them for the check
[ -f "artifacts/capture/baseline.json" ] || echo "{{}}" > artifacts/capture/baseline.json
[ -f "artifacts/capture/current_profile.json" ] || cp artifacts/capture/baseline.json artifacts/capture/current_profile.json

- name: Run Stylus Performance Check
uses: CreativesOnchain/Stylus-Trace@main
with:
tx_hash: "{}"
{} threshold: "{}"
threshold: "{}"
skip_capture: "true"
"#,
args.transaction_hash, rpc_line, args.threshold
tx_hash, args.threshold
);

// 3. Write file
Expand Down
6 changes: 3 additions & 3 deletions crates/stylus-trace-core/src/commands/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ impl Default for DiffArgs {
/// Arguments for the CI init command
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CiInitArgs {
/// Transaction hash to use for performance checks
pub transaction_hash: String,
/// Transaction hash to use for performance checks (optional)
pub transaction_hash: Option<String>,

/// RPC endpoint URL (optional)
pub rpc_url: Option<String>,
Expand All @@ -162,7 +162,7 @@ pub struct CiInitArgs {
impl Default for CiInitArgs {
fn default() -> Self {
Self {
transaction_hash: String::new(),
transaction_hash: None,
rpc_url: Some("http://localhost:8547".to_string()),
threshold: 1.0,
force: false,
Expand Down