release(prepare): torii-server v0.1.6 (#58) #178
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Synthetic Benchmark | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - '.github/**' | |
| - '*.md' | |
| - 'LICENSE' | |
| pull_request: | |
| paths-ignore: | |
| - '.github/**' | |
| - '*.md' | |
| - 'LICENSE' | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| benchmark: | |
| name: Run ${{ matrix.token-type }} Benchmark | |
| runs-on: ubuntu-latest-8-cores | |
| strategy: | |
| matrix: | |
| token-type: [erc20, erc721, erc1155] | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: torii | |
| POSTGRES_PASSWORD: torii | |
| POSTGRES_DB: torii | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U torii" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| cache-on-failure: true | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v2 | |
| with: | |
| version: "25.x" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build synthetic profiler | |
| run: cargo build --release -p torii-tokens-synth | |
| - name: Create output directory | |
| run: mkdir -p perf/synthetic-runs | |
| - name: Run ${{ matrix.token-type }} synthetic benchmark | |
| run: | | |
| ./target/release/torii-tokens-synth ${{ matrix.token-type }} \ | |
| --db-url postgres://torii:torii@localhost:5432/torii \ | |
| --block-count 100 \ | |
| --tx-per-block 500 \ | |
| --output-root perf/synthetic-runs \ | |
| --reset-schema | |
| - name: Upload ${{ matrix.token-type }} results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: synthetic-results-${{ matrix.token-type }} | |
| path: perf/synthetic-runs/ | |
| retention-days: 1 | |
| introspect: | |
| name: Run Introspect Synthetic Check | |
| runs-on: ubuntu-latest-8-cores | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: torii | |
| POSTGRES_PASSWORD: torii | |
| POSTGRES_DB: torii | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U torii" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| cache-on-failure: true | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v2 | |
| with: | |
| version: "25.x" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build introspect synthetic runner | |
| run: cargo build --release -p torii-introspect-synth | |
| - name: Create output directory | |
| run: mkdir -p perf/synthetic-runs | |
| - name: Run introspect synthetic check | |
| run: | | |
| ./target/release/torii-introspect-synth \ | |
| --db-url postgres://torii:torii@localhost:5432/torii \ | |
| --block-count 50 \ | |
| --records-per-block 250 \ | |
| --output-root perf/synthetic-runs | |
| - name: Upload introspect results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: synthetic-results-introspect | |
| path: perf/synthetic-runs/ | |
| retention-days: 1 | |
| aggregate: | |
| name: Aggregate Results | |
| runs-on: ubuntu-latest | |
| needs: [benchmark, introspect] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download ERC20 results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: synthetic-results-erc20 | |
| path: perf/synthetic-runs | |
| - name: Download ERC721 results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: synthetic-results-erc721 | |
| path: perf/synthetic-runs | |
| - name: Download ERC1155 results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: synthetic-results-erc1155 | |
| path: perf/synthetic-runs | |
| - name: Download introspect results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: synthetic-results-introspect | |
| path: perf/synthetic-runs | |
| - name: Restore previous baseline | |
| id: cache-baseline | |
| uses: actions/cache@v4 | |
| with: | |
| path: perf/synthetic-baselines | |
| key: synthetic-baseline-main-latest | |
| - name: Extract metrics | |
| run: scripts/synthetic/extract_metrics.sh perf/synthetic-runs > perf/synthetic-runs/metrics.tsv | |
| - name: Compare against previous baseline | |
| if: steps.cache-baseline.outputs.cache-hit == 'true' | |
| continue-on-error: true | |
| run: | | |
| echo "📊 Comparing against previous baseline..." | |
| scripts/synthetic/compare_to_baseline.sh || true | |
| - name: Save current results as new baseline | |
| run: | | |
| stamp="$(date -u +%Y%m%dT%H%M%SZ)" | |
| out_dir="perf/synthetic-baselines/${stamp}" | |
| mkdir -p "$out_dir" | |
| cp perf/synthetic-runs/metrics.tsv "$out_dir/" | |
| cat > "$out_dir/context.txt" <<CTX | |
| commit=$(git rev-parse HEAD) | |
| branch=$(git branch --show-current) | |
| block_count=100 | |
| tx_per_block=500 | |
| created_at_utc=${stamp} | |
| CTX | |
| echo "Baseline saved to $out_dir" | |
| - name: Generate benchmark report | |
| id: report | |
| run: | | |
| scripts/synthetic/generate_report.sh > benchmark_report.md | |
| echo "report_file=benchmark_report.md" >> $GITHUB_OUTPUT | |
| - name: Post benchmark results to PR | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const report = fs.readFileSync('benchmark_report.md', 'utf8'); | |
| // Find existing comment | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const botComment = comments.find(comment => | |
| comment.user.type === 'Bot' && | |
| comment.body.includes('📊 Synthetic Benchmark Results') | |
| ); | |
| if (botComment) { | |
| // Update existing comment | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body: report | |
| }); | |
| } else { | |
| // Create new comment | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: report | |
| }); | |
| } | |
| - name: Save new baseline | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: perf/synthetic-baselines | |
| key: synthetic-baseline-main-latest | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: synthetic-benchmark-results-${{ github.sha }} | |
| path: perf/synthetic-runs/ | |
| retention-days: 90 | |
| - name: Upload baseline | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: synthetic-baseline-${{ github.sha }} | |
| path: perf/synthetic-baselines/ | |
| retention-days: 90 |