Skip to content

Commit

Permalink
chore: use self hoisted github runner (rolldown#140)
Browse files Browse the repository at this point in the history
* chore: benchmark with codespeed

* Use self hosted runner

* Fix

* Fix

* Fix

* self hoisted

* Disable codespeed
  • Loading branch information
hyf0 committed Oct 31, 2023
1 parent 23596bb commit 1966537
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 8 deletions.
25 changes: 24 additions & 1 deletion .github/actions/rustup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
default: false
required: false
type: boolean
docs:
default: false
required: false
type: boolean
restore-cache:
default: true
required: false
Expand All @@ -37,6 +41,20 @@ runs:
echo 'restore-cache: ${{ inputs.restore-cache }}'
echo 'save-cache: ${{ inputs.save-cache }}'
- name: Remove `profile` line on MacOS
shell: bash
if: runner.os == 'macOS'
run: sed -i '' '/profile/d' rust-toolchain.toml

- name: Remove `profile` line on non-MacOS
shell: bash
if: runner.os != 'macOS'
run: sed -i '/profile/d' rust-toolchain.toml

- name: Set minimal
shell: bash
run: rustup set profile minimal

- name: Add Clippy
shell: bash
if: ${{ inputs.clippy == 'true' }}
Expand All @@ -47,6 +65,11 @@ runs:
if: ${{ inputs.fmt == 'true' }}
run: rustup component add rustfmt

- name: Add docs
shell: bash
if: ${{ inputs.docs == 'true' }}
run: rustup component add rust-docs

- name: Install
shell: bash
run: |
Expand All @@ -58,4 +81,4 @@ runs:
if: ${{ inputs.restore-cache == 'true' }}
with:
shared-key: ${{ inputs.shared-key }}
save-if: ${{ inputs.save-cache == 'true' }}
save-if: ${{ inputs.save-cache == 'true' }}
2 changes: 1 addition & 1 deletion .github/workflows/bench.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
jobs:
bench:
name: Bench
runs-on: ubuntu-latest
runs-on: self-hosted
if: github.event.issue.pull_request && contains(github.event.comment.body, '!bench')
steps:
- name: Checkout Branch
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

lint:
name: Clippy
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- uses: actions/checkout@v4

Expand All @@ -50,7 +50,7 @@ jobs:

test:
name: Test
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- uses: actions/checkout@v4

Expand All @@ -65,7 +65,7 @@ jobs:

node-test:
name: Node test
runs-on: 'ubuntu-latest'
runs-on: self-hosted
timeout-minutes: 30
strategy:
fail-fast: false
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/codspeed.yml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: codspeed-benchmarks

on:
issue_comment:
push:
branches:
- "main" # or "master"
paths:
- '**/*.rs'
- '**/*.toml'
- 'Cargo.lock'
pull_request:
types: [opened, synchronize]
paths:
- '**/*.rs'
- '**/*.toml'
- 'Cargo.lock'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}

jobs:
benchmark:
name: Benchmark
runs-on: ubuntu-latest
steps:
- name: Checkout Branch
uses: actions/checkout@v4
with:
# Whether Pull submodules for additional files
submodules: false

- name: Clone three.js
run: |
git clone https://github.com/mrdoob/three.js.git --depth 1 ./temp/three.js
for i in {1..10}; do cp -r ./temp/three.js/src ./temp/three.js/copy$i/; done

- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
shared-key: benchmark
save-cache: ${{ github.ref_name == 'main' }}

- name: Install codspeed
uses: taiki-e/install-action@v2
with:
tool: cargo-codspeed

- name: Build the benchmark target(s)
run: cargo codspeed build -p bench

- name: Run the benchmarks
uses: CodSpeedHQ/action@v1
with:
run: cargo codspeed run
token: ${{ secrets.CODSPEED_TOKEN }}
97 changes: 94 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions crates/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ harness = false

[lib]
bench = false

[dev-dependencies]
codspeed-criterion-compat = "2.3.1"

0 comments on commit 1966537

Please sign in to comment.