|
| 1 | +name: EDR Benchmark |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - ".github/workflows/edr-benchmark.yml" |
| 9 | + - "rust-toolchain" |
| 10 | + - "Cargo.lock" |
| 11 | + - "Cargo.toml" |
| 12 | + - "crates/**" |
| 13 | + pull_request: |
| 14 | + branches: |
| 15 | + - "**" |
| 16 | + paths: |
| 17 | + - ".github/workflows/edr-benchmark.yml" |
| 18 | + - "rust-toolchain" |
| 19 | + - "Cargo.lock" |
| 20 | + - "Cargo.toml" |
| 21 | + - "crates/**" |
| 22 | + workflow_dispatch: |
| 23 | + |
| 24 | +defaults: |
| 25 | + run: |
| 26 | + working-directory: crates/tools/js/benchmark |
| 27 | + |
| 28 | +concurrency: |
| 29 | + group: ${{github.workflow}}-${{github.ref}} |
| 30 | + cancel-in-progress: true |
| 31 | + |
| 32 | +jobs: |
| 33 | + js-benchmark: |
| 34 | + name: Run JS scenario runner benchmark |
| 35 | + environment: github-action-benchmark |
| 36 | + runs-on: self-hosted |
| 37 | + # Only run for trusted collaborators since third-parties could run malicious code on the self-hosted benchmark runner. |
| 38 | + if: github.ref == 'refs/heads/main' || (github.event.pull_request.author_association == 'OWNER' || github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'COLLABORATOR') |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v3 |
| 41 | + |
| 42 | + - uses: pnpm/action-setup@v2 |
| 43 | + with: |
| 44 | + version: 8 |
| 45 | + - name: Install Node |
| 46 | + uses: actions/setup-node@v2 |
| 47 | + with: |
| 48 | + node-version: 20 |
| 49 | + cache: pnpm |
| 50 | + |
| 51 | + - name: Install Rust (stable) |
| 52 | + uses: actions-rs/toolchain@v1 |
| 53 | + with: |
| 54 | + profile: minimal |
| 55 | + override: true |
| 56 | + |
| 57 | + - name: Install package |
| 58 | + run: pnpm install --frozen-lockfile --prefer-offline |
| 59 | + |
| 60 | + - name: Run benchmark |
| 61 | + run: pnpm run -s benchmark |
| 62 | + |
| 63 | + - name: Validate regressions |
| 64 | + run: pnpm run -s verify |
| 65 | + |
| 66 | + - name: Generate report for github-action-benchmark |
| 67 | + run: pnpm run -s report | tee report.json |
| 68 | + |
| 69 | + - name: Store benchmark result |
| 70 | + uses: benchmark-action/github-action-benchmark@v1 |
| 71 | + with: |
| 72 | + tool: customSmallerIsBetter |
| 73 | + output-file-path: crates/tools/js/benchmark/report.json |
| 74 | + gh-repository: github.com/nomic-foundation-automation/edr-benchmark-results |
| 75 | + gh-pages-branch: main |
| 76 | + benchmark-data-dir-path: bench |
| 77 | + github-token: ${{ secrets.BENCHMARK_GITHUB_TOKEN }} |
| 78 | + # Only save the data for main branch pushes. For PRs we only compare |
| 79 | + auto-push: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} |
| 80 | + alert-threshold: "110%" |
| 81 | + # Only fail on pull requests, don't break CI in main |
| 82 | + fail-on-alert: ${{ github.event_name == 'pull_request' }} |
| 83 | + # Enable Job Summary for PRs |
| 84 | + summary-always: true |
| 85 | + max-items-in-chart: 1000 |
0 commit comments