Files
2026-07-27 01:43:44 +02:00

135 lines
6.0 KiB
YAML

name: Load Nightly
# Nightly regression gate. Runs every k6 scenario, diffs against
# baseline/load.json, opens an issue if any metric regresses.
#
# IMPORTANT: shared GitHub-hosted runners produce noisy timings —
# regression signal is unreliable until this workflow is moved to a
# pinned self-hosted runner with consistent hardware. The cron run is
# informational until then; treat opened issues as "investigate" not
# "broken main."
on:
schedule:
# 03:00 UTC daily — outside US/EU working hours, low contention.
- cron: '0 3 * * *'
workflow_dispatch:
inputs:
ref:
description: 'Branch / tag / SHA to load-test (leave blank to use the workflow ref). Lets you dispatch from main and run the scenarios against a feature branch — useful when the target branch does not have the workflow file yet.'
required: false
default: ''
env:
CARGO_TERM_COLOR: always
jobs:
load:
name: k6 load suite + baseline diff
# Skip the scheduled run on forks — nightly is only meaningful against the
# canonical baseline.json on the upstream repo. Forks can still hit it
# manually via `workflow_dispatch` if they want, and the guard is bypassed
# for that path (event != schedule). Additional fork repositories are
# opted-in explicitly below.
if: github.event_name != 'schedule' || github.repository == 'AtalayaLabs/OxiCloud' || github.repository == 'EdouardVanbelle/OxiCloud'
# tunning on Ed's nuc to ensure stable environment
# treating regressions here as merge-blocking. ubuntu-latest is too noisy
# for trustworthy p95/p99 deltas.
runs-on: [self-hosted, nuc-loadtest]
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
with:
# `inputs.ref` is set only for workflow_dispatch with a non-empty
# value; for cron and bare dispatch it's empty, in which case the
# action falls back to the workflow's own ref (`github.ref`). The
# `||` short-circuits on empty strings, so the cron path keeps the
# exact behaviour it had before.
ref: ${{ inputs.ref || github.ref }}
# The self-hosted runner bind-mounts target/ as a persistent volume
# for fast incremental rebuilds. actions/checkout's default cleanup
# tries to rmdir it and hits EBUSY on the mount point. Git still
# syncs the working tree to the target SHA — only non-git files
# (target/, tests/load/results/) persist, which is what we want.
clean: false
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
# Distinct from load-smoke's `load-v2`. Nightly runs on the
# self-hosted `nuc-loadtest` runner (homogeneous), where
# `-C target-cpu=native` from `.cargo/config.toml` gives the
# accurate perf baseline we want. Smoke runs on the GHA
# heterogeneous pool with `RUSTFLAGS=-C target-cpu=x86-64-v3`.
# Sharing the same cache key would let native-baked proc-macro
# dylibs from nightly leak into smoke's restore set → SIGILL
# on a leaner GHA runner. Separate namespaces prevent that.
shared-key: load-nightly-v2
- name: Install Node 20
# The self-hosted runner image ships Node 12, which can't parse the
# ES-module `.mjs` helpers (compare.mjs / merge-summaries.mjs /
# bake-baseline.mjs). Pin to a current LTS for both runners.
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install k6
uses: grafana/setup-k6-action@v1
- name: Build OxiCloud + load-seed (release)
# Single cargo invocation: load_seed_bin is an empty marker feature
# that gates the load-seed bin without changing oxicloud's dep
# graph, so cargo compiles oxicloud exactly once.
run: cargo build --release --features load_seed_bin --bin oxicloud --bin load-seed
- name: Run full load suite
id: load
run: bash tests/load/run.sh
env:
BUILD_TARGET: release
continue-on-error: true
- name: Upload raw k6 summaries
if: always()
uses: actions/upload-artifact@v4
with:
name: load-results-${{ github.run_id }}
path: tests/load/results/*.json
retention-days: 30
- name: Prepare regression report
if: steps.load.outcome == 'failure'
run: |
{
echo "## Load nightly regression"
echo ""
echo "Run: \`${{ github.run_id }}\` · Commit: \`${{ github.sha }}\`"
echo "Ref tested: \`${{ inputs.ref || github.ref }}\`"
echo "Runner: \`${{ runner.name }}\` (\`${{ runner.os }}/${{ runner.arch }}\`)"
echo ""
echo "Compare exited non-zero — see uploaded artifact \`load-results-${{ github.run_id }}\` for raw summaries."
echo ""
echo "Baseline is anchored to the runner that produced it; cross-runner"
echo "comparisons (e.g. an artifact baked on different hardware) will"
echo "show large \"regressions\" that are really hardware deltas."
} > regression-issue.md
- name: Open issue on regression
# Skip on forks where Issues are disabled — the regression report is
# already in the artifact, and the workflow's exit code marks the run
# as failed regardless. Forks that want issue notifications can enable
# issues on their repo and remove this condition.
if: steps.load.outcome == 'failure' && github.repository == 'AtalayaLabs/OxiCloud'
uses: peter-evans/create-issue-from-file@v5
with:
# `github.sha` resolves to the workflow's ref, not the tested ref,
# so when dispatched against a non-default branch we surface the
# input explicitly — otherwise the title misleads with main's SHA.
title: "Load nightly: regression on ${{ inputs.ref || github.sha }}"
content-filepath: regression-issue.md
labels: |
load-test
regression