Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias] # command aliases
ci = ["run", "--quiet", "--package=hyperlight-ci", "--"]
84 changes: 83 additions & 1 deletion .github/workflows/ValidatePullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:

permissions:
contents: write
pull-requests: read
pull-requests: write

jobs:
docs-pr:
Expand Down Expand Up @@ -140,6 +140,86 @@ jobs:
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
secrets: inherit

# Run benchmarks and post results as PR comment
benchmarks:
needs:
- docs-pr
- build-guests
# Required because update-guest-locks is skipped on non-dependabot PRs,
# and a skipped dependency transitively skips all downstream jobs.
# See: https://github.com/actions/runner/issues/2205
if: ${{ !cancelled() && !failure() }}
strategy:
fail-fast: false
matrix:
hypervisor: ['hyperv-ws2025', mshv3, kvm]
cpu: [amd, intel]
uses: ./.github/workflows/dep_benchmarks.yml
secrets: inherit
with:
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
hypervisor: ${{ matrix.hypervisor }}
cpu: ${{ matrix.cpu }}

# Collect all benchmark reports and post a single combined PR comment
benchmark-comment:
needs: benchmarks
if: ${{ !cancelled() && !failure() }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Download all benchmark reports
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: benchmark-report_*
path: reports/

- name: Post combined benchmark results to PR
uses: actions/github-script@v9
with:
script: |
const fs = require('fs');
const path = require('path');

const reportsDir = 'reports';
if (!fs.existsSync(reportsDir)) {
console.log('No benchmark reports found, skipping comment.');
return;
}

// Collect all report files from subdirectories
const sections = [];
const dirs = fs.readdirSync(reportsDir).sort();
for (const dir of dirs) {
const mdPath = path.join(reportsDir, dir, 'benchmark.md');
if (!fs.existsSync(mdPath)) continue;

// Extract hypervisor/cpu from artifact name: benchmark-report_OS_hypervisor_cpu
const parts = dir.replace('benchmark-report_', '').split('_');
const os = parts[0];
const hypervisor = parts.slice(1, -1).join('_');
const cpu = parts[parts.length - 1];
const label = `${hypervisor} / ${cpu} (${os})`;

const content = fs.readFileSync(mdPath, 'utf8').trim();
sections.push(`<details>\n<summary><b>${label}</b></summary>\n\n${content}\n\n</details>`);
}

if (sections.length === 0) {
console.log('No benchmark report content found, skipping comment.');
return;
}

const body = `## Benchmark Results\n\n${sections.join('\n\n')}`;

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body,
});

spelling:
name: spell check with typos
runs-on: ubuntu-latest
Expand Down Expand Up @@ -167,6 +247,8 @@ jobs:
- build-test
- run-examples
- fuzzing
- benchmarks
- benchmark-comment
- spelling
- license-headers
if: always()
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/dep_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ on:
required: false
type: number
default: 5

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
Expand Down Expand Up @@ -133,7 +132,17 @@ jobs:
continue-on-error: true

- name: Run benchmarks
run: just bench-ci main
run: just bench-ci

- name: Create benchmarks report
run: cargo ci bench-report > target/criterion/benchmark.md

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: benchmark-report_${{ runner.os }}_${{ inputs.hypervisor }}_${{ inputs.cpu }}
path: target/criterion/benchmark.md
if-no-files-found: error
retention-days: 1

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
Expand Down
Loading
Loading