-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): Configure
codspeed
(#9189)
- Loading branch information
Showing
46 changed files
with
293 additions
and
263 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ on: | |
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: ["opened", "reopened", "synchronize"] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.sha }} | ||
|
@@ -22,33 +24,63 @@ env: | |
SKIP_YARN_COREPACK_CHECK: 1 | ||
|
||
jobs: | ||
list-crates: | ||
if: >- | ||
${{ !contains(github.event.head_commit.message, 'chore: ') }} | ||
name: List crates | ||
# list-crates: | ||
# if: >- | ||
# ${{ !contains(github.event.head_commit.message, 'chore: ') }} | ||
# name: List crates | ||
# runs-on: ubuntu-latest | ||
# outputs: | ||
# crates: ${{ steps.list-crates.outputs.crates }} | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
|
||
# - name: Install Rust | ||
# uses: actions-rs/toolchain@v1 | ||
# with: | ||
# profile: minimal | ||
|
||
# - name: List crates | ||
# id: list-crates | ||
# run: echo "crates=$(./scripts/cargo/get-crates.sh)" >> $GITHUB_OUTPUT | ||
|
||
# bench-crate: | ||
# name: Bench ${{ matrix.crate }} | ||
# runs-on: ubuntu-latest | ||
# needs: | ||
# - list-crates | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# crate: ${{fromJson(needs.list-crates.outputs.crates)}} | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
|
||
# - name: Install Rust | ||
# uses: actions-rs/toolchain@v1 | ||
# with: | ||
# profile: minimal | ||
|
||
# - uses: ./.github/actions/setup-node | ||
|
||
# - name: Setup rust toolchain, cache and cargo-codspeed binary | ||
# uses: moonrepo/setup-rust@v0 | ||
# with: | ||
# channel: stable | ||
# cache-target: release | ||
# bins: cargo-codspeed | ||
|
||
# - name: Build the benchmark target(s) | ||
# run: cargo codspeed build -p ${{ matrix.crate }} | ||
|
||
# - name: Run the benchmarks | ||
# uses: CodSpeedHQ/action@v2 | ||
# with: | ||
# run: cargo codspeed run -p ${{ matrix.crate }} | ||
# token: ${{ secrets.CODSPEED_TOKEN }} | ||
|
||
bench-all: | ||
name: Bench everything | ||
runs-on: ubuntu-latest | ||
outputs: | ||
crates: ${{ steps.list-crates.outputs.crates }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
|
||
- name: List crates | ||
id: list-crates | ||
run: echo "crates=$(./scripts/cargo/get-crates.sh)" >> $GITHUB_OUTPUT | ||
|
||
bench-crate: | ||
name: Bench ${{ matrix.crate }} | ||
runs-on: ubuntu-latest | ||
needs: | ||
- list-crates | ||
strategy: | ||
matrix: | ||
crate: ${{fromJson(needs.list-crates.outputs.crates)}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
|
@@ -59,87 +91,18 @@ jobs: | |
|
||
- uses: ./.github/actions/setup-node | ||
|
||
- name: Run benchmark | ||
run: cargo bench -p ${{ matrix.crate }} -- --output-format bencher --sample-size 10 | tee output-${{ matrix.crate }}.txt | ||
|
||
- name: List outputs | ||
run: ls -l output-*.txt | ||
|
||
- name: Upload benchmark result | ||
uses: actions/upload-artifact@v2 | ||
# We need to merge output.txt for each crates | ||
- name: Setup rust toolchain, cache and cargo-codspeed binary | ||
uses: moonrepo/setup-rust@v0 | ||
with: | ||
name: output | ||
path: output-* | ||
|
||
process-result: | ||
name: Process result | ||
runs-on: ubuntu-latest | ||
needs: | ||
- bench-crate | ||
steps: | ||
- uses: actions/checkout@v4 | ||
channel: stable | ||
cache-target: release | ||
bins: cargo-codspeed | ||
|
||
- name: Download benchmark results | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: output | ||
- name: Build the benchmark target(s) | ||
run: cargo codspeed build | ||
|
||
- name: List outputs | ||
run: ls -l output-*.txt | ||
|
||
- name: Merge outputs | ||
run: cat output-*.txt > output.txt | ||
|
||
- name: Download previous benchmark results | ||
run: mkdir raw-data && curl -o raw-data/benchmark-data.json https://raw.githubusercontent.com/swc-project/raw-data/gh-pages/benchmark-data.json | ||
|
||
- name: Analyze benchmark result | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
# What benchmark tool the output.txt came from | ||
tool: "cargo" | ||
# Where the output from the benchmark tool is stored | ||
output-file-path: output.txt | ||
external-data-json-path: ./raw-data/${{ github.sha }}/benchmark-data.json | ||
# Workflow will fail when an alert happens | ||
fail-on-alert: true | ||
# GitHub API token to make a commit comment | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
# Enable alert commit comment | ||
comment-on-alert: true | ||
comment-always: true | ||
skip-fetch-gh-pages: true | ||
|
||
- name: Analyze benchmark result (root) | ||
if: ${{ github.event_name == 'push' }} | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
# What benchmark tool the output.txt came from | ||
tool: "cargo" | ||
# Where the output from the benchmark tool is stored | ||
output-file-path: output.txt | ||
external-data-json-path: ./raw-data/benchmark-data.json | ||
# Workflow will fail when an alert happens | ||
# fail-on-alert: true | ||
# GitHub API token to make a commit comment | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
# Enable alert commit comment | ||
comment-on-alert: true | ||
comment-always: true | ||
alert-comment-cc-users: "@kdy1" | ||
skip-fetch-gh-pages: true | ||
max-items-in-chart: 250 | ||
|
||
- name: Deploy | ||
if: github.ref == 'refs/heads/main' | ||
uses: JamesIves/[email protected] | ||
- name: Run the benchmarks | ||
uses: CodSpeedHQ/action@v2 | ||
with: | ||
token: ${{ secrets.GH_TOKEN }} | ||
branch: gh-pages | ||
folder: raw-data | ||
clean: false | ||
single-commit: false | ||
git-config-email: [email protected] | ||
repository-name: swc-project/raw-data | ||
commit-message: "Update" | ||
run: cargo codspeed run | ||
token: ${{ secrets.CODSPEED_TOKEN }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.