ci: integrated-benchmark #13
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: Integrated-Benchmark | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, synchronize] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
permissions: | |
issues: write | |
pull-requests: write | |
jobs: | |
benchmark: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
name: Run benchmark on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Make main branch visible | |
run: | | |
subsection() { | |
echo | |
echo -e "\033[0;33m$*\033[0m" | |
} | |
subsection 'Checking out main branch...' | |
git checkout main | |
git log --oneline -n 3 | |
subsection 'Switching back...' | |
git checkout - | |
git log --oneline -n 3 | |
subsection 'Inspecting branches...' | |
git branch | |
- name: Install Rust Toolchain | |
uses: ./.github/actions/rustup | |
with: | |
shared-key: integrated-benchmark | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
standalone: true | |
- name: Install verdaccio | |
run: pnpm install --global verdaccio | |
- name: Install hyperfine | |
env: | |
REPO: https://github.com/sharkdp/hyperfine | |
VERSION: '1.18.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: Compile | |
run: cargo build --bin=integrated-benchmark | |
- name: 'Benchmark: Frozen Lockfile' | |
run: | | |
cargo run --bin=integrated-benchmark -- --scenario=frozen-lockfile --verdaccio HEAD main | |
cp bench-work-env/BENCHMARK_REPORT.md bench-work-env/BENCHMARK_REPORT_FROZEN_LOCKFILE.md | |
- name: Generate summary | |
run: | | |
( | |
echo '## Integrated-Benchmark Report' | |
echo | |
echo '### Scenario: Frozen Lockfile' | |
echo | |
cat bench-work-env/BENCHMARK_REPORT_FROZEN_LOCKFILE.md | |
) > bench-work-env/SUMMARY.md | |
- name: Find Comment | |
# Check if the event is not triggered by a fork | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
uses: peter-evans/find-comment@v2 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: Integrated-Benchmark Report | |
- name: Create or update comment | |
# Check if the event is not triggered by a fork | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
edit-mode: replace | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
body-file: bench-work-env/SUMMARY.md |