A CI run on your default branch can send Repowise what it measured: a CPU profile, benchmark results or test timings. Repowise joins it to the indexed code, and the Performance tab (Code Health → Performance) shows the measured workload, where its time went and its costliest functions with their share of the run. Causes a real run confirms lead the queue, and a function the run measured hot is listed even when no static cause names it.
The upload is signed with the workflow's GitHub OIDC token, the same way as the coverage upload, so there is no secret to store.
Let your agent set it up
Send runtime evidence from CI to Repowise for this repository. Follow https://docs.repowise.dev/hosted/runtime-evidence.md. Pick the measurement for this repo from its What to measure table, add a GitHub Actions workflow on the default branch that runs it and uploads the file with the upload step on that page, and open a pull request with it. Tell me the link to click if the Repowise PR bot is not installed on this repository.
Before you start
- The PR bot is installed on the repository. Uploads name the repository the token was issued for, and Repowise accepts them only for repositories with the PR bot installed and turned on.
- The repository has a finished index on repowise.dev. Evidence is joined to the indexed code.
- The job can request an OIDC token:
permissions: id-token: write.
Add the workflow
Run the measurement, then upload what it wrote. This example times the test suite with JUnit XML; swap the measure step for a profile or a benchmark from the table below.
name: Repowise evidence
on:
push:
branches: [main] # your default branch
workflow_dispatch:
jobs:
evidence:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # lets the upload prove it comes from this repository
steps:
- uses: actions/checkout@v4
# ... install your project ...
- name: Measure
run: pytest --junitxml=junit.xml
- name: Upload runtime evidence to Repowise
if: always()
continue-on-error: true
env:
EVIDENCE: "junit.xml" # space-separated paths or globs, up to 10 files of one run
WORKLOAD: "pytest" # what ran
CLASS: "unit_test" # unit_test, benchmark, entry_point or load_test
run: |
shopt -s globstar nullglob
files=()
for pattern in $EVIDENCE; do for f in $pattern; do [ -f "$f" ] && files+=(-F "evidence=@$f"); done; done
if [ ${#files[@]} -eq 0 ]; then echo "::warning::Repowise: no evidence file found at: $EVIDENCE"; exit 0; fi
token=$(curl -sS -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=repowise" | jq -r '.value // empty')
curl -sS --fail-with-body --max-time 120 -H "Authorization: Bearer $token" "${files[@]}" \
-F "repository=$GITHUB_REPOSITORY" -F "commit=$GITHUB_SHA" \
-F "workload=$WORKLOAD" -F "class=$CLASS" -F "environment=linux-ci" \
-F "checkout_root=$GITHUB_WORKSPACE" \
https://api.repowise.dev/ci/evidence \
|| echo "::warning::Repowise: evidence upload failed; see the message above."The step never fails the job: a missing file or a refused upload is a warning
in the log, with the reason and a hint. A schedule trigger works too, for a
nightly profile or benchmark.
What to measure
Pick the Measure step for what the repository runs, and send its file, workload and class in the upload. Common ones:
| Measure step | EVIDENCE | CLASS |
|---|---|---|
py-spy record --subprocesses --rate 25 --format speedscope -o prof.speedscope.json -- python -m yourapp | prof.speedscope.json | entry_point |
pyinstrument -r speedscope -o prof.speedscope.json -m yourapp | prof.speedscope.json | entry_point |
pytest --benchmark-only --benchmark-json=bench.json | bench.json | benchmark |
go test -cpuprofile cpu.pprof ./pkg | cpu.pprof | unit_test |
pytest --junitxml=junit.xml | junit.xml | unit_test |
For a Python program, profile with py-spy: --subprocesses samples its
worker processes too, and every frame keeps its sample count, so the
Performance tab can rank functions with confidence. Install it in the job
(pip install py-spy); it needs no sudo when it launches the program itself.
pyinstrument works for a single-process program, but its speedscope export
drops frames under 1% of the run and records no sample counts, so its ranking
is a rough order.
In a checkout with a local Repowise index, repowise evidence setup --format json
prints the exact command for each build unit: a profiler command for an entry
point, a benchmark run, or the test suite with JUnit XML.
Every format repowise evidence add
reads is accepted: Speedscope, Go pprof, V8 .cpuprofile, collapsed stacks,
pytest-benchmark, go test -bench output, hyperfine, JUnit XML and
repowise-evidence-v1. How evidence reorders the queue is on
runtime evidence.
Upload fields
The upload is multipart/form-data to POST https://api.repowise.dev/ci/evidence
with Authorization: Bearer <OIDC token> (audience repowise).
| Field | Required | Meaning |
|---|---|---|
evidence | yes | 1 to 10 files. Several files are profiles of one run (a parent and its workers). |
repository | yes | owner/name, the repository the token was issued for. |
workload | yes | What ran, as in evidence add --workload. |
class | yes | unit_test, benchmark, entry_point or load_test. |
commit | no | The SHA measured. Must equal the token's commit; leave it out to use the token's. |
environment | no | One word, e.g. linux-ci. Default unknown. |
checkout_root | for profiles | $GITHUB_WORKSPACE: where the profiled checkout was, so frames join to your files. |
input_format | no | Read the files as a named format, as evidence add --input-format. Detected from content otherwise. |
value_kind | no | cpu or wall, for a profile that does not say which clock it sampled (collapsed stacks, py-spy). |
allow_partial | no | true stores a run even when more than half its entries did not map. |
A stored run answers 202 with status: "accepted", the evidence add
result and a details_url to the repository on repowise.dev.
Rules and limits
- Default branch only. Repowise accepts a run only when the token's ref is
the repository's default branch and the event is
push,scheduleorworkflow_dispatch. A pull request's run would replace the workload's newest run with code that never merged, so pull request andpull_request_targetruns are refused. - Signed uploads only. There is no tokenless path: a run without an OIDC token is refused.
- 20 MiB per upload. The body cap is the engine's per-file limit plus the form fields. Send a shorter run or a smaller profile.
- 120 uploads per repository per hour, counted apart from coverage uploads. Upload once per workflow run.
- Retention is the engine's: the newest runs of each workload are kept, and older ones are pruned.
Current and stale runs
Each run keeps the commit it measured. A run measured at the commit the dashboard shows is current. A run measured at any other commit reads stale: it still shows, with its commit, and is never re-mapped onto code that has moved. Once Repowise indexes a newer commit, the next upload measured at that commit makes the workload current again, so uploading on every push to the default branch keeps it current.
Troubleshooting
Every refusal answers {"detail", "hint"}, and the upload step prints both.
| Status | Cause | Fix |
|---|---|---|
400 | repository is missing or not owner/name, or the multipart body could not be read (more than 10 files). | Send repository=$GITHUB_REPOSITORY and at most 10 evidence files. |
401 | No OIDC token, or it could not be verified. | Add permissions: id-token: write to the job and request the token with audience repowise. |
403 | The token was issued for another repository or commit, or the repository was deleted and re-created. | Send the repository and commit the workflow runs on. Reinstall the PR bot on a re-created repository. |
404 | The PR bot is not installed on the repository, or is turned off for it. | Install it from repowise.dev/bot or turn it back on in Settings → PR bot. |
409 | The repository has no finished index on repowise.dev yet. | Upload again once the first index is ready. |
413 | The upload is over 20 MiB. | Send a shorter run or a smaller profile. |
415 | The body is not multipart/form-data. | Attach each file with -F evidence=@file. |
422 | The run is not from the default branch, an option is refused (unknown class, bad environment, a checkout_root that is not the runner's), or the run was read but not stored because its entries name nothing in the index. | Upload from a default-branch workflow. Check the option the hint names. For an unmapped run, check that checkout_root is $GITHUB_WORKSPACE and the run measured this repository, or send allow_partial=true. |
429 | More than 120 evidence uploads this hour, or too many requests from one runner. | Upload once per workflow run; the limit resets at the top of the hour. |
503 | Repowise could not store the evidence. | Re-run the job in a few minutes. |