80 lines
2.3 KiB
YAML
80 lines
2.3 KiB
YAML
name: 📊 Benchmark the Runtime
|
|
|
|
on:
|
|
push:
|
|
branches: ["*"]
|
|
pull_request:
|
|
branches: ["*"]
|
|
|
|
env:
|
|
PNPM_CACHE_FOLDER: .pnpm-store
|
|
CARGO_HOME: .cargo
|
|
CARGO_TARGET_DIR: target
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
container: git.max-richter.dev/max/nodarium-ci:a56e8f445edb6064ae7a7b3b783fb7445f1b4e69
|
|
|
|
steps:
|
|
- name: 📑 Checkout Code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: 💾 Setup pnpm Cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.PNPM_CACHE_FOLDER }}
|
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-
|
|
|
|
- name: 🦀 Cache Cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: 📦 Install Dependencies
|
|
run: pnpm install --frozen-lockfile --store-dir ${{ env.PNPM_CACHE_FOLDER }}
|
|
|
|
- name: 🛠️Build Nodes
|
|
run: pnpm build:nodes
|
|
|
|
- name: 🏃 Execute Runtime
|
|
run: pnpm run --filter @nodarium/app bench
|
|
|
|
|
|
- name: 📤 Push Results
|
|
env:
|
|
BENCH_REPO: "git@git.max-richter.dev:max/nodarium-benchmarks.git"
|
|
run: |
|
|
git config user.name "nodarium-bot"
|
|
git config user.email "nodarium-bot@max-richter.dev"
|
|
|
|
# 2. Clone the benchmarks repo into a temp folder
|
|
git clone $BENCH_REPO target_bench_repo
|
|
|
|
# 3. Create a directory structure based on the branch
|
|
# This allows the UI to "switch between branches"
|
|
BRANCH_NAME="${{ github.ref_name }}"
|
|
DEST_DIR="target_bench_repo/data/$BRANCH_NAME/$(date +%s)"
|
|
mkdir -p "$DEST_DIR"
|
|
|
|
# 4. Copy the new results
|
|
# Assuming your bench tool outputs a file named 'results.json'
|
|
cp app/benchmark/out/*.json "$DEST_DIR/"
|
|
|
|
# 5. Commit and Push
|
|
cd target_bench_repo
|
|
git add .
|
|
git commit -m "Update benchmarks for $BRANCH_NAME: ${{ github.sha }}"
|
|
git push origin main
|