Skip to content

Commit 8d88f99

Browse files
authored
Merge pull request #14 from CreativesOnchain/dean
v0.1.10
2 parents 5e6014c + 61cb9e8 commit 8d88f99

File tree

7 files changed

+31
-22
lines changed

7 files changed

+31
-22
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ members = [
66
]
77

88
[workspace.package]
9-
version = "0.1.7"
9+
version = "0.1.10"
1010
edition = "2021"
1111
authors = ["CreativesOnchain"]
1212
license = "MIT"
@@ -17,7 +17,7 @@ keywords = ["arbitrum", "stylus", "profiling", "gas", "flamegraph"]
1717
categories = ["development-tools::profiling", "wasm"]
1818

1919
[workspace.dependencies]
20-
stylus-trace-core = { version = "0.1.7", path = "crates/stylus-trace-core" }
20+
stylus-trace-core = { version = "0.1.10", path = "crates/stylus-trace-core" }
2121
clap = { version = "4.5", features = ["derive", "env"] }
2222
serde = { version = "1.0", features = ["derive"] }
2323
serde_json = "1.0"

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ This feature will be enabled automatically once upstream tracer support is avail
115115
### `capture`
116116
| Flag | Description | Default |
117117
|------|-------------|---------|
118-
| `--tx` | **(Required)** Transaction hash to profile | - |
118+
| `--tx` | Transaction hash to profile | - |
119119
| `--rpc` | RPC endpoint URL | `http://localhost:8547` |
120120
| `--flamegraph` | Generate an SVG flamegraph | `artifacts/capture/flamegraph.svg` |
121121
| `--output` | Save JSON profile to path | `artifacts/capture/profile.json` |
@@ -143,7 +143,7 @@ This feature will be enabled automatically once upstream tracer support is avail
143143
### `ci init`
144144
| Flag | Description | Default |
145145
|------|-------------|---------|
146-
| `--tx` | **(Required)** Transaction hash to profile in CI | - |
146+
| `--tx` | Transaction hash to profile in CI (optional) | - |
147147
| `--rpc` | RPC endpoint URL | `http://localhost:8547` |
148148
| `--threshold` | Percentage threshold for regressions | `1.0` |
149149
| `--force` | Overwrite existing workflow files | `false` |
@@ -157,8 +157,9 @@ Stylus Trace is built for automated performance tracking. You can integrate it i
157157
### Quick Setup (Zero Config)
158158
Run this in your repository to auto-generate a GitHub Actions workflow:
159159
```bash
160-
stylus-trace ci init --tx 0x...
160+
stylus-trace ci init
161161
```
162+
*Note: You can optionally provide `--tx 0x...` now or fill it in the generated YAML later.*
162163

163164
### Manual Integration
164165
You can use the [Stylus Trace Action](https://github.com/CreativesOnchain/Stylus-Trace) directly in your workflows:

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
default: 'http://localhost:8547'
1010
tx_hash:
1111
description: 'Transaction hash to profile'
12-
required: true
12+
required: false
1313
baseline:
1414
description: 'Path to baseline profile JSON'
1515
required: false

bin/stylus-trace-studio/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ fn main() -> Result<()> {
176176
pub enum CiSubcommands {
177177
/// Initialize CI/CD performance regression checks
178178
Init {
179-
/// Transaction hash to profile in CI
179+
/// Transaction hash to profile in CI (optional)
180180
#[arg(short, long)]
181-
tx: String,
181+
tx: Option<String>,
182182

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

187187
/// Percentage threshold for regressions (e.g., 1.0)

crates/stylus-trace-core/src/commands/ci.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ pub fn execute_ci_init(args: CiInitArgs) -> Result<()> {
2626
}
2727

2828
// 2. Generate YAML
29-
let rpc_line = if let Some(rpc) = &args.rpc_url {
30-
format!(" rpc_url: \"{}\"\n", rpc)
31-
} else {
32-
String::new()
33-
};
29+
30+
let tx_hash = args
31+
.transaction_hash
32+
.as_deref()
33+
.unwrap_or("YOUR_TRANSACTION_HASH");
3434

3535
let workflow_yaml = format!(
3636
r#"name: Stylus Performance Check
@@ -49,13 +49,21 @@ jobs:
4949
- name: Checkout Code
5050
uses: actions/checkout@v4
5151
52+
- name: Prepare Profiles
53+
run: |
54+
mkdir -p artifacts/capture
55+
# If paths exist, stage them for the check
56+
[ -f "artifacts/capture/baseline.json" ] || echo "{{}}" > artifacts/capture/baseline.json
57+
[ -f "artifacts/capture/current_profile.json" ] || cp artifacts/capture/baseline.json artifacts/capture/current_profile.json
58+
5259
- name: Run Stylus Performance Check
5360
uses: CreativesOnchain/Stylus-Trace@main
5461
with:
5562
tx_hash: "{}"
56-
{} threshold: "{}"
63+
threshold: "{}"
64+
skip_capture: "true"
5765
"#,
58-
args.transaction_hash, rpc_line, args.threshold
66+
tx_hash, args.threshold
5967
);
6068

6169
// 3. Write file

crates/stylus-trace-core/src/commands/models.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ impl Default for DiffArgs {
146146
/// Arguments for the CI init command
147147
#[derive(Debug, Clone, Serialize, Deserialize)]
148148
pub struct CiInitArgs {
149-
/// Transaction hash to use for performance checks
150-
pub transaction_hash: String,
149+
/// Transaction hash to use for performance checks (optional)
150+
pub transaction_hash: Option<String>,
151151

152152
/// RPC endpoint URL (optional)
153153
pub rpc_url: Option<String>,
@@ -162,7 +162,7 @@ pub struct CiInitArgs {
162162
impl Default for CiInitArgs {
163163
fn default() -> Self {
164164
Self {
165-
transaction_hash: String::new(),
165+
transaction_hash: None,
166166
rpc_url: Some("http://localhost:8547".to_string()),
167167
threshold: 1.0,
168168
force: false,

0 commit comments

Comments
 (0)