Skip to content

Commit 3ce25e8

Browse files
fix: track contracts/Cargo.lock, harden benchmark CI, fork-friendly secret
- .gitignore: track contracts/Cargo.lock for reproducible builds while keeping target/ and other Cargo.lock files ignored - contract-smoke.yml: propagate benchmark failures to CI (remove || true), add --locked --features testutils for reproducible benchmarks, guard against missing BENCHMARK_RESULT output, make secret check fork-friendly (warning + HAS_TESTNET_SECRET gate)
1 parent ac122d6 commit 3ce25e8

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

.github/workflows/contract-smoke.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ jobs:
3030
- uses: actions/checkout@v4
3131

3232
- name: Ensure testnet secret exists
33+
# Fork PRs and PRs from contributors without `secrets.STELLAR_TESTNET_SECRET_KEY`
34+
# cannot deploy to testnet (GitHub strips secrets for non-trusted contexts).
35+
# The build, audit, and benchmark steps still run so the contract code is
36+
# verified on every PR; the testnet deploy step below is gated on the secret.
3337
run: |
34-
if [ -z "${STELLAR_SECRET_KEY}" ]; then
35-
echo "::error::Missing STELLAR_TESTNET_SECRET_KEY repository secret"
36-
exit 1
38+
if [ -z "${STELLAR_SECRET_KEY:-}" ]; then
39+
echo "::warning::STELLAR_TESTNET_SECRET_KEY not available in this run context (fork PR or maintenance run); skipping on-chain deploy step."
40+
echo "HAS_TESTNET_SECRET=false" >> "$GITHUB_ENV"
41+
else
42+
echo "HAS_TESTNET_SECRET=true" >> "$GITHUB_ENV"
3743
fi
3844
3945
- name: Setup Rust
@@ -72,8 +78,15 @@ jobs:
7278
- name: Run benchmarks
7379
working-directory: ./contracts
7480
if: github.event_name == 'pull_request'
81+
# Benchmarks need the testutils feature for ledger/env manipulation.
82+
# cargo test failures (compilation or test assertion) propagate;
83+
# only skip summary generation when no BENCHMARK_RESULT lines exist.
7584
run: |
76-
cargo test benchmark_ -- --nocapture > bench_output.txt || true
85+
cargo test --locked --features testutils benchmark_ -- --nocapture > bench_output.txt
86+
if ! grep -q 'BENCHMARK_RESULT|' bench_output.txt; then
87+
echo "No BENCHMARK_RESULT lines found; skipping summary generation."
88+
exit 0
89+
fi
7790
python3 -c '
7891
import json
7992
lines = [line.strip() for line in open("bench_output.txt") if "BENCHMARK_RESULT|" in line]
@@ -110,6 +123,7 @@ jobs:
110123

111124
- name: Deploy and initialize on testnet
112125
working-directory: ./contracts
126+
if: env.HAS_TESTNET_SECRET == 'true'
113127
run: |
114128
soroban network add testnet --global \
115129
--rpc-url "${SOROBAN_RPC_URL}" \

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ logs
127127

128128
# Rust/Cargo
129129
target/
130+
# Cargo.lock is committed for the contracts crate to ensure reproducible
131+
# builds, especially with pinned ed25519-dalek to avoid version conflicts.
130132
Cargo.lock
133+
!contracts/Cargo.lock
131134
**/*.rs.bk
132135

133136
# Soroban
@@ -236,5 +239,5 @@ monitoring/logs/
236239
# Generated output files
237240
backend/test_results.txt
238241
frontend/tsc-output.txt
239-
240-
*storybook.log
242+
243+
*storybook.log

0 commit comments

Comments
 (0)