Running in CI
Run your Specter tests against a real packaged build on every push and pull request, with GitHub Actions. When a test fails, the pull request shows the game frame it failed on, the error and the line, and the trace is one click away.
What you get
- Tests against the shipped game, not the editor. Each run packages a Development build, launches it, and points your tests at it. PIE-only bugs and packaging-only bugs both surface.
- A pull request comment that shows what broke. One comment, updated on every run: each failed test with the game frame it failed on, its expected and received values, a link to the failing line, and a link to download the trace.
- Annotations on the run.Each failure links straight to its line, and in pull requests it shows inline in "Files changed".
- Traces you can open in the editor.Download the run's results and open the
.specter-trace.zipin the Specter Test Runner to scrub the timeline around the failure.
Why a self-hosted runner
GitHub's hosted runners have no Unreal Engine and no GPU, so the game can't be built or rendered there. Instead, a machine you own (with Unreal installed) runs the jobs as a self-hosted runner. The game renders on it, so the runner must run inside a logged-in desktop session, not as a background service over SSH.
-platform=Win64, launch the .exe from the archive folder with -specterport=8080); a Windows version of the scripts is coming.1. Commit Specter with your project
Commit Specter in your project's Plugins/ folder (see Setup & Installation), so the runner builds exactly what you test locally. If you installed Specter from source, the runner compiles it with your game and there's nothing extra to do. If you installed the compiled-only release, its Binaries/ and Intermediate/ folders are the plugin: the editor loads the first, and packaging a game links the object files in the second. Most Unreal .gitignore files exclude both, so add exceptions for Specter:
# Unreal's generated folders, at the project root only
/Binaries/
/Intermediate/
/Saved/
/DerivedDataCache/
Plugins/*/Binaries/
Plugins/*/Intermediate/
# ...except Specter: installed compiled, its Binaries/ and Intermediate/ ARE the plugin
!Plugins/Specter/Binaries/
!Plugins/Specter/Intermediate/
# CI output
ci-build/
ci-logs/
specter/node_modules/
specter/playwright-report/
specter/test-results/Store the binaries with Git LFS, like your assets (brew install git-lfs, then git lfs install once):
# Unreal assets and compiled binaries go through Git LFS
*.uasset filter=lfs diff=lfs merge=lfs -text
*.umap filter=lfs diff=lfs merge=lfs -text
*.dylib filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text
*.o filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
*.a filter=lfs diff=lfs merge=lfs -text
*.lib filter=lfs diff=lfs merge=lfs -textThe rest of this guide assumes this layout:
MyGame/
├─ MyGame.uproject
├─ Plugins/Specter/ ← the compiled-only zip, committed
├─ specter/ ← your Playwright project
│ ├─ playwright.config.ts
│ ├─ package.json + package-lock.json
│ └─ tests/
├─ scripts/ci/run-specter-tests.sh
├─ scripts/ci/report-failures.mjs
└─ .github/workflows/specter-tests.yml2. Register the runner
On GitHub, open the repository's Settings → Actions → Runners → New self-hosted runner, choose your OS, and run the commands it shows on the machine that will run the tests. Add the label unreal; the workflow asks for [self-hosted, macOS, unreal].
# One folder per repository (a personal account's runners belong to one repo each)
mkdir ~/actions-runner-mygame && cd ~/actions-runner-mygame
# Paste the download and extract commands from GitHub's "New self-hosted runner" page, then:
./config.sh --url https://github.com/you/MyGame --token <token from that page> --labels unreal
# Start it as a login item, so it runs inside your desktop session and the game can render
./svc.sh install && ./svc.sh start- Stop the Mac sleeping (System Settings → Energy: "Prevent automatic sleeping when the display is off"). The screen can lock; the machine can't sleep.
- Unreal must be at
/Users/Shared/Epic Games/UE_5.8, or changeUE_ROOTin the workflow.
3. Configure Playwright for CI
On CI, retry each failed test once, record a trace on the retry, and turn on the reporters GitHub reads:
import { defineConfig } from "@playwright/test";
import type { SpecterTestOptions } from "@specter-automation/test";
export default defineConfig<SpecterTestOptions>({
testDir: "./tests",
// One game, one Specter port: tests run one after another
fullyParallel: false,
workers: 1,
forbidOnly: !!process.env.CI,
// Retry once on CI, so a flaky test shows up as flaky instead of failed
retries: process.env.CI ? 1 : 0,
reporter: process.env.CI
? [
["list"],
["github"], // failures as annotations on the run, inline on the line in pull requests
["junit", { outputFile: "test-results/junit.xml" }],
["json", { outputFile: "test-results/results.json" }], // read by report-failures.mjs
["html", { open: "never", outputFolder: "playwright-report" }],
["@specter-automation/test/dist/core/specter-reporter.js", {}],
]
: [["list"], ["@specter-automation/test/dist/core/specter-reporter.js", {}]],
use: {
trace: "on-first-retry",
},
});Retries run in the same game, so state can leak from a failed attempt into its retry. Specter clears what it owns between tests (spawned actors, time dilation, and any key a test left held). If a test leaves its own game state behind, reset it in a beforeEach.
4. Add the workflow and scripts
Download these three files into your repository at the paths shown, set UPROJECT in the workflow to your .uproject, and push.
The workflow:
# Specter: run your Specter tests against a packaged build on every push and pull request.
# Setup guide: https://spectertest.dev/docs/ci
name: Specter tests
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
# One run at a time per branch: there's one game (and one port 8080) on the runner
concurrency:
group: specter-${{ github.ref }}
cancel-in-progress: true
# contents: write commits failure frames to the specter-ci-images branch; pull-requests: write posts the PR comment
permissions:
contents: write
pull-requests: write
jobs:
test:
# A Mac registered as a self-hosted runner with the "unreal" label
runs-on: [self-hosted, macOS, unreal]
timeout-minutes: 120
env:
UE_ROOT: /Users/Shared/Epic Games/UE_5.8
# Your project file, relative to the repo root
UPROJECT: MyGame.uproject
steps:
- name: Check out
uses: actions/checkout@v7
with:
lfs: true
# Keep Intermediate/ and DerivedDataCache/ between runs, so builds and cooks are incremental
clean: false
- name: Set up Node
uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
cache-dependency-path: specter/package-lock.json
- name: Install Specter test dependencies
working-directory: specter
run: npm ci
- name: Build, cook and package (Mac, Development)
run: |
"$UE_ROOT/Engine/Build/BatchFiles/RunUAT.sh" BuildCookRun \
-project="$GITHUB_WORKSPACE/$UPROJECT" \
-platform=Mac -clientconfig=Development \
-build -cook -stage -package -pak -archive -archivedirectory="$GITHUB_WORKSPACE/ci-build" \
-unattended -utf8output -nop4
- name: Run Specter tests against the packaged game
run: bash scripts/ci/run-specter-tests.sh "$GITHUB_WORKSPACE/ci-build"
- name: Upload report, traces and logs
id: results
if: always()
uses: actions/upload-artifact@v7
with:
name: specter-results-${{ github.run_number }}
path: |
specter/playwright-report/
specter/test-results/
specter/specter-traces/
ci-logs/
if-no-files-found: warn
retention-days: 14
# The run summary, and on pull requests one comment kept up to date: each failed test with the game frame
# it failed on, its error, and links to the line and the trace
- name: Report results
if: always()
continue-on-error: true
env:
GITHUB_TOKEN: ${{ github.token }}
ARTIFACT_URL: ${{ steps.results.outputs.artifact-url }}
run: node scripts/ci/report-failures.mjs specter/test-results/results.json
clean: falsekeepsIntermediate/andDerivedDataCache/between runs. The first run builds and cooks everything; later runs only redo what changed.- The test script launches the game with
-specterport=8080and runs Playwright withSPECTER_EDITOR_PORT=1, so a run never connects to (or starts PIE in) an editor someone has open on the runner. If port 8080 is already taken, the run fails with a clear message instead of testing the wrong game. report-failures.mjsneedscontents: writeto store failure frames andpull-requests: writeto post the comment. It never fails the run itself; problems show as warnings.
Reading the results
On a pull request, a comment from github-actions[bot]lists each failed test with the frame the game was showing when it failed, the assertion's expected and received values with the code around the failing line, and links to the line and to the run's results. Push a fix and the same comment updates; when everything passes it turns green. Tests that failed and then passed on retry are listed as flaky.
On a push to your main branch, the same report is on the run's summary page.
To dig in, download the results from the comment or the run page. It contains the HTML report, the JUnit XML, the game log and the Specter traces; open a trace in the editor's Specter Test Runner to see the timeline, the actions and the viewport around the failure.
specter-ci-images branch, one folder per run. It only holds those images: delete it whenever you like, and the next failing run recreates it.Troubleshooting
The game exits at launch: “Failed to open descriptor file” or an ICU assertion
The packaged app has no game data in it. On Mac, BuildCookRun only copies the staged data into the .app with -package; keep it in the command.
“Port 8080 is already in use on the runner”
Something on the runner is already listening on Specter's port, usually an editor playing in PIE. Stop it and re-run.
“Plugin 'Specter' failed to load because module 'Specter' could not be loaded” (Mac)
macOS quarantines zips downloaded in a browser, and won't load the plugin's libraries. Clear it once: xattr -dr com.apple.quarantine Plugins/Specter
“Missing object file … listed in Specter.precompiled”
The plugin's Intermediate/ folder wasn't committed. Check the .gitignore exceptions above and that git lfs install ran before you added the files.
A test passes on its own but fails on the retry
Something the first attempt changed is still there on the retry, which runs in the same game. Reset that state in a beforeEach.
Running the CI steps by hand
To reproduce a CI run on your own machine, package the game and run the same script:
"/Users/Shared/Epic Games/UE_5.8/Engine/Build/BatchFiles/RunUAT.sh" BuildCookRun \
-project="$PWD/MyGame.uproject" -platform=Mac -clientconfig=Development \
-build -cook -stage -package -pak -archive -archivedirectory="$PWD/ci-build" \
-unattended -utf8output -nop4
bash scripts/ci/run-specter-tests.sh