Skip to content

Performance Test

Performance Test #34

Workflow file for this run

name: "Performance Test"
on:
schedule:
- cron: "0 18 * * *" # Daily at 03:00 JST (18:00 UTC)
workflow_dispatch:
permissions: read-all
jobs:
perf-test:
strategy:
fail-fast: false
matrix:
platform:
- windows-latest
# - ubuntu-22.04
# - macos-latest
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup Linux dependencies
if: runner.os == 'Linux'
uses: ./.github/actions/setup-linux-deps
with:
extra-packages: xvfb
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
components: ""
- name: Cache perf-monitor target
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: perf-monitor/target
key: perf-monitor-${{ runner.os }}-${{ hashFiles('perf-monitor/Cargo.toml') }}
restore-keys: |
perf-monitor-${{ runner.os }}-
- name: Build perf-monitor
run: cargo build --release --manifest-path perf-monitor/Cargo.toml
- name: Build Tauri app (macOS)
if: runner.os == 'macOS'
uses: tauri-apps/tauri-action@84b9d35b5fc46c1e45415bdb6144030364f7ebc5 # v0.6.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: --bundles app -- --profile ci
- name: Build Tauri app
if: runner.os != 'macOS'
uses: tauri-apps/tauri-action@84b9d35b5fc46c1e45415bdb6144030364f7ebc5 # v0.6.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: --no-bundle -- --profile ci
- name: Run performance test (Linux)
if: runner.os == 'Linux'
run: |
xvfb-run --auto-servernum \
./perf-monitor/target/release/perf-monitor \
--binary src-tauri/target/ci/hardware-visualizer \
--config perf-thresholds.toml \
--output json \
> perf-results.json
- name: Run performance test (macOS)
if: runner.os == 'macOS'
run: |
./perf-monitor/target/release/perf-monitor \
--binary "src-tauri/target/ci/bundle/macos/HardwareVisualizer.app/Contents/MacOS/hardware-visualizer" \
--config perf-thresholds.toml \
--output json \
> perf-results.json
- name: Run performance test (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
./perf-monitor/target/release/perf-monitor.exe \
--binary src-tauri/target/ci/hardware-visualizer.exe \
--config perf-thresholds.toml \
--output json \
> perf-results.json
- name: Show results
if: always()
shell: bash
run: cat perf-results.json 2>/dev/null || echo "No results file"
- name: Upload results
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: perf-results-${{ matrix.platform }}
path: perf-results.json
notify:
needs: perf-test
if: failure()
runs-on: ubuntu-slim
permissions:
issues: write
steps:
- name: Create or update issue
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
script: |
const label = 'performance-regression';
const title = 'Performance test threshold exceeded';
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
// Ensure label exists
try {
await github.rest.issues.getLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label,
});
} catch {
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label,
color: 'e11d48',
description: 'Automated performance test detected a threshold violation',
});
}
// Check for existing open issue
const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: label,
state: 'open',
per_page: 1,
});
const body = `Performance test failed on ${new Date().toISOString().split('T')[0]}.\n\n` +
`**Workflow run:** ${runUrl}\n\n` +
`Download the \`perf-results-*\` artifacts from the workflow run for details.`;
if (issues.length > 0) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issues[0].number,
body,
});
} else {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
body,
labels: [label],
});
}