feat!: update #420
Workflow file for this run
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
name: Benchmark | |
on: | |
workflow_dispatch: {} | |
pull_request: {} | |
jobs: | |
benchmark: | |
name: Benchmark | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache (rust) | |
uses: actions/cache@v4 | |
timeout-minutes: 1 | |
continue-on-error: true | |
if: matrix.os != 'macos-latest' # Cache causes errors on macOS | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('**/Cargo.lock') }} | |
${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}- | |
- uses: actions-rs/[email protected] | |
with: | |
profile: minimal | |
components: clippy | |
override: 'true' | |
default: 'true' | |
- name: Build pdu | |
run: | | |
cargo build --release | |
echo "$(pwd)/target/release" >> "$GITHUB_PATH" | |
- name: Install hyperfine | |
env: | |
REPO: https://github.com/sharkdp/hyperfine | |
VERSION: '1.11.0' | |
run: | | |
mkdir -p HYPERFINE.tmp | |
archive_name="hyperfine-v${VERSION}-x86_64-unknown-linux-gnu" | |
curl -L "${REPO}/releases/download/v${VERSION}/${archive_name}.tar.gz" > tmp.hyperfine.tar.gz | |
tar xf tmp.hyperfine.tar.gz --directory=HYPERFINE.tmp | |
chmod +x "HYPERFINE.tmp/${archive_name}/hyperfine" | |
echo "$(pwd)/HYPERFINE.tmp/${archive_name}" >> "$GITHUB_PATH" | |
- name: Inspect commands | |
run: | | |
which pdu | |
which hyperfine | |
hyperfine --version | |
- name: Prepare directory to be measured | |
run: | | |
mkdir -p tmp.sample | |
curl -L https://github.com/torvalds/linux/archive/refs/tags/v5.12.zip > tmp.sample.zip | |
unzip tmp.sample.zip -d tmp.sample | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16.1.0' | |
- name: Cache (pnpm) | |
uses: actions/cache@v4 | |
timeout-minutes: 1 | |
continue-on-error: true | |
with: | |
path: ~/.pnpm-store/v3 | |
key: pnpm-${{ matrix.vars.id }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
pnpm-${{ matrix.vars.id }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
pnpm-${{ matrix.vars.id }}- | |
pnpm- | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: '7.9.0' | |
run_install: 'true' | |
- name: Compile TypeScript | |
run: | | |
cd ci/github-actions | |
pnpm exec tsc | |
- name: Download released versions of pdu | |
run: node ci/github-actions/download-released-binaries.js | |
- name: Compare benchmark of pdu against other versions of itself | |
run: node ci/github-actions/benchmark.js tmp.sample | |
- name: Create chart for benchmark reports | |
run: node ci/github-actions/illustrate-benchmark-reports.js | |
- name: Upload benchmark reports | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: benchmark-reports | |
path: tmp.benchmark-report.* | |
- name: Post generated benchmark reports to pull request as a comment | |
if: github.event_name == 'pull_request' | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: node ci/github-actions/report-benchmark-result-pr.js | |
- name: Check for performance regressions | |
run: node ci/github-actions/check-for-performance-regressions.js |