Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
559 changes: 360 additions & 199 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions .github/workflows/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,21 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0 # the base commit is built from a worktree
- uses: dtolnay/rust-toolchain@stable
- name: Rust toolchain (stable)
shell: bash
run: |
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
- name: Install build tools and Valgrind
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends ninja-build pkg-config ccache valgrind \
libpipewire-0.3-dev libasound2-dev libx11-dev
- uses: actions/cache@v6
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/ccache
Expand All @@ -86,7 +90,7 @@ jobs:
restore-keys: perf-instructions-
- name: Compare with the base
run: python3 tools/perf/bench_gate.py all --base "$BASE_REF" --mode instructions --work build/perf --deps .perf-deps
- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: ${{ !cancelled() }}
with:
name: perf-instructions
Expand All @@ -111,11 +115,15 @@ jobs:
# Setup (tools, caches) plus the 75-minute comparison, with room left for the warning step.
timeout-minutes: 110
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- name: Rust toolchain (stable)
shell: bash
run: |
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
- name: Install build tools (Linux)
if: runner.os == 'Linux'
run: |
Expand All @@ -134,7 +142,7 @@ jobs:
cmd /c "`"$vs\VC\Auxiliary\Build\vcvars64.bat`" >nul && set" | ForEach-Object {
if ($_ -match '^([^=]+)=(.*)$') { "$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 }
}
- uses: actions/cache@v6
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/ccache
Expand Down Expand Up @@ -180,7 +188,7 @@ jobs:
msg="The timing comparison did not finish on ${{ matrix.name }} (a build or benchmark failed, or the runner timed out). This is a warning only; see the step log."
echo "::warning title=Timing run failed on ${{ matrix.name }}::$msg"
echo "**Timing run failed on ${{ matrix.name }}**: $msg" >> "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: ${{ !cancelled() }}
with:
name: perf-time-${{ matrix.name }}
Expand Down
54 changes: 33 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
outputs:
version: ${{ steps.v.outputs.version }}
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0 # the tag's ancestry is checked against main
Expand Down Expand Up @@ -89,15 +89,16 @@ jobs:
needs: version
runs-on: macos-15
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin, x86_64-apple-darwin
- name: Rust toolchain (stable, both macOS targets)
run: |
rustup toolchain install stable --profile minimal --no-self-update --target aarch64-apple-darwin --target x86_64-apple-darwin
rustup default stable
- name: Install Ninja
run: brew install ninja
- uses: actions/cache@v6
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry/index
Expand All @@ -121,7 +122,7 @@ jobs:
ditto -c -k --keepParent "build/macos/Device Studio.app" build/macos/DeviceStudio-app.zip
# The unsigned app goes to the signing job (tags only); every other run makes an
# ad hoc signed .dmg here, with no secrets in reach.
- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: github.event_name == 'push' && github.ref_type == 'tag'
with:
name: macos-app
Expand All @@ -134,7 +135,7 @@ jobs:
- name: Smoke test (the packaged app starts and renders)
if: env.IS_RELEASE != 'true'
run: bash tools/release/smoke-macos.sh dist/*.dmg
- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: env.IS_RELEASE != 'true'
with:
name: package-macos
Expand All @@ -154,10 +155,10 @@ jobs:
env:
HAS_SIGNING_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE != '' }}
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/download-artifact@v8
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: macos-app
path: build/macos
Expand All @@ -180,6 +181,8 @@ jobs:
security unlock-keychain -p "$password" "$keychain"
security import "$RUNNER_TEMP/cert.p12" -k "$keychain" -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k "$password" "$keychain"
# The search list is the new keychain followed by the existing ones (word splitting intended).
# shellcheck disable=SC2046
security list-keychains -d user -s "$keychain" $(security list-keychains -d user | tr -d '"')
rm "$RUNNER_TEMP/cert.p12"
if [ -n "$APPLE_API_KEY" ]; then
Expand All @@ -202,7 +205,7 @@ jobs:
rm -f "$RUNNER_TEMP/notary-key.p8"
- name: Smoke test (the packaged app starts and renders)
run: bash tools/release/smoke-macos.sh dist/*.dmg
- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: package-macos
path: dist/*.dmg
Expand All @@ -213,10 +216,14 @@ jobs:
needs: version
runs-on: windows-2025
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
- name: Rust toolchain (stable)
shell: bash
run: |
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
- name: MSVC developer environment
shell: pwsh
run: |
Expand All @@ -230,7 +237,7 @@ jobs:
shell: pwsh
run: |
if (-not (Test-Path "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe")) { choco install innosetup --no-progress -y }
- uses: actions/cache@v6
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry/index
Expand Down Expand Up @@ -259,7 +266,7 @@ jobs:
$p = Start-Process -FilePath (Join-Path $dir 'device-studio.exe') -ArgumentList '--state', 'reference-default', '--screenshot', $shot -NoNewWindow -Wait -PassThru
"exit code: 0x{0:X8}" -f $p.ExitCode
if (-not (Test-Path $shot)) { throw "the installed app did not render" }
- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: package-windows
path: |
Expand All @@ -280,18 +287,22 @@ jobs:
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
- name: Rust toolchain (stable)
shell: bash
run: |
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
- name: Install build packages
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends ninja-build pkg-config \
libpipewire-0.3-dev libasound2-dev \
libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev libx11-dev libx11-xcb-dev \
libxcursor-dev libxrandr-dev libxi-dev libfontconfig1-dev libfreetype-dev libudev-dev
- uses: actions/cache@v6
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry/index
Expand All @@ -311,12 +322,13 @@ jobs:
sudo apt-get install -y --no-install-recommends xvfb mesa-vulkan-drivers
mkdir -p "$RUNNER_TEMP/unpack"
tar -C "$RUNNER_TEMP/unpack" -xzf dist/*.tar.gz
"$RUNNER_TEMP"/unpack/*/install.sh "$RUNNER_TEMP/prefix"
install_sh=("$RUNNER_TEMP"/unpack/*/install.sh)
"${install_sh[0]}" "$RUNNER_TEMP/prefix"
test -x "$RUNNER_TEMP/prefix/lib/device-studio/dstudio_plugin_scanner"
xvfb-run -a -s "-screen 0 1600x1000x24" "$RUNNER_TEMP/prefix/bin/device-studio" \
--state reference-default --screenshot "$RUNNER_TEMP/linux.png"
test -s "$RUNNER_TEMP/linux.png"
- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: package-linux-${{ matrix.arch }}
path: dist/*.tar.gz
Expand All @@ -330,7 +342,7 @@ jobs:
permissions:
contents: write # create the release and upload the packages
steps:
- uses: actions/download-artifact@v8
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
path: dist
pattern: package-*
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ cargo run --release -p dstudio-app -- --self-test --no-audio # drive the real
```

CI runs the tests and the self-test (not the interactive `--demo`) on macOS, Windows and Linux for every pull request.
Its runners have no audio device, so the self-test runs with `--no-audio` and anything that needs audio hardware has to
be tested by hand. On Windows the self-test step is informational
for now (`continue-on-error`), so a green Windows job does not mean the self-test passed: open that step's output to
check. The engine is built with warnings as errors on
Its runners have no audio device, so the self-test runs with `--no-audio` (Linux also runs it against a headless
PipeWire server) and anything that needs audio hardware has to be tested by hand. The Windows self-test takes about
30 minutes under the software renderer, so pull requests run it only with the `windows-self-test` label; main and
the nightly run always run it, and a failure fails the job. The engine is built with warnings as errors on
clang, MSVC and GCC, so please build on more than one compiler if you can, or check the CI result.

## Pull requests
Expand Down
58 changes: 46 additions & 12 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,49 @@ issue in wgpu-core's debug-only lock tracing).
## Continuous integration

CI ([`.github/workflows/ci.yml`](../.github/workflows/ci.yml)) runs on every push
to main and every pull request, including pull requests from forks. It has one
job per system, all on GitHub-hosted runners (`macos-latest`, `windows-latest`,
`ubuntu-latest`). Each job:

1. configures and builds the engine with warnings as errors, and runs ctest;
2. builds and tests the Rust workspace (`--locked`);
3. builds the app in release mode and runs `device-studio --self-test
--no-audio`, which must report every check passed (Linux under Xvfb with
Mesa lavapipe; Windows under WARP, informational for now);
4. uploads the screenshots and self-test logs as an artifact.
to main, every pull request (including pull requests from forks), nightly on
main and on demand (Actions › CI › Run workflow). All jobs run on GitHub-hosted
runners (`macos-latest`, `windows-latest`, `ubuntu-latest`). Each system has two
jobs that run side by side:

- **tests (system)** configures and builds the engine with warnings as errors
and runs ctest, then builds and tests the Rust workspace (`cargo test
--workspace --locked`, debug).
- **app (system)** builds the app in release mode and runs its smoke tests: a
reference-state screenshot and `device-studio --self-test`, which must report
Comment thread
chrislaupama marked this conversation as resolved.
Resolved
every check passed (`tools/ci/self-test.sh`). macOS runs `--no-audio`; Linux
runs `--no-audio` and `--self-test-audio` side by side under Xvfb with Mesa
lavapipe; Windows takes the screenshot under WARP on every run, and runs the
full self-test (about 30 minutes under WARP) on pushes to main, the nightly
run, manual runs, and pull requests labelled `windows-self-test`. The
screenshots and self-test logs are uploaded as an artifact.

A **lint** job checks the workflows (actionlint, which also runs shellcheck on
their scripts), the scripts in `tools/`, the change detection below and the
agent skills, in under a minute.

The required checks are **build-test (macOS)**, **build-test (Windows)** and
**build-test (Linux)**. Each passes only when lint and every tests and app job
passed, so a failure on one system turns all three red; the failing job is
named in the check list.

Pull requests run only what their changes can reach
([`tools/ci/changes.sh`](../tools/ci/changes.sh), tested by
`tools/ci/test-changes.sh`): documentation alone builds nothing; Rust or UI
changes skip the standalone engine build; engine tests or benchmarks alone skip
the Rust tests and the app; packaging and benchmark tooling have their own
workflows. Anything the script does not know (`Cargo.toml`, `Cargo.lock`, the
CI workflow, `tools/ci/`, a new folder) runs everything, and so do pushes to
main and the nightly run. A job with nothing to do still runs and passes, so
the required checks always report.

Caches: the cargo registry and target dir (one per system and job, so debug and
release are restored separately) and the ccache store are restored on every run
and saved only by main and the nightly run, so a pull request never writes a
cache another run uses. Every C/C++ compile goes through ccache. Before
building, [`tools/ci/prepare-target.sh`](../tools/ci/prepare-target.sh) makes
every source newer than the restored build (so nothing restored is reused for
changed code) and reconfigures the engine's CMake tree from scratch.

The hosted runners have no audio device and no GPU. On macOS and Windows the
engine's device tests skip there. The Linux job starts a headless PipeWire
Expand All @@ -175,8 +208,9 @@ ignored by default and gated on an environment variable:
DSTUDIO_TEST_REAL_INPUT=1 cargo test -p dstudio-engine --test real_loopback -- --ignored --nocapture --test-threads=1
```

The workflow never uses a self-hosted runner, has no secrets and gives its
token read-only access, so running it on a stranger's pull request is safe.
The workflow never uses a self-hosted runner, has no secrets, gives its token
read-only access and pins every action to a commit, so running it on a
stranger's pull request is safe.

### Performance checks

Expand Down
8 changes: 5 additions & 3 deletions engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,11 @@ without a GPU or audio device: on Linux under Xvfb with Mesa lavapipe (software
`SLINT_WGPU_CPU=1`), a `--state reference-default` screenshot and the full `--self-test
--no-audio` (125 checks pass; the 21 checks of the Audio Unit devices section
are reported as skipped off macOS), as a required step; on Windows with WARP
(DX12 software adapter) the same, as an informational step: the screenshot
renders and the self-test passes (125, 21 skipped), but the process exits
with code 0x87A after the run (not yet explained; macOS/Linux exit 0).
(DX12 software adapter) the same, also failing the job when a check fails (the
full self-test runs on main, nightly and labelled pull requests; see
Comment thread
chrislaupama marked this conversation as resolved.
Resolved
docs/building.md): the screenshot renders and the self-test passes, but the
process exits with code 0x87A after the run (not yet explained; macOS/Linux
exit 0), so CI prints that exit code and checks the summary line instead.
Debug builds of the app abort at exit on every OS (pre-existing: wgpu-core's
debug-only lock tracing runs in a TLS destructor when Slint's thread-local
backend drops the wgpu queue), so CI uses a release build. Screenshots and logs are uploaded as artifacts.
Expand Down
57 changes: 57 additions & 0 deletions tools/ci/changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# Decides which parts of CI a pull request needs, from the paths it changes.
#
# git diff --name-only HEAD^1 HEAD | tools/ci/changes.sh
#
# Prints three lines, each `true` or `false`:
#
# engine= the standalone engine build (CMake, warnings as errors) and ctest
# rust= `cargo test` over the workspace (which also builds the engine through build.rs)
# app= the app's release build and its smoke tests (screenshot, self-test)
#
# A part is skipped only when every changed path is known not to reach it. Anything not
# listed below (Cargo.toml, Cargo.lock, the CI workflow, tools/ci/, a new top-level folder)
# runs everything. Pushes to main and scheduled runs do not call this: they run everything.
#
# documentation (*.md, docs/, specs/, .agents/, LICENSE,
# issue templates, dependabot.yml) nothing
# engine/tests/, engine/bench/, engine/tools/ engine (build.rs builds none of them)
# engine/ (anything else) engine, rust, app
# crates/*/tests/, crates/*/benches/ rust (not part of the app binary)
# crates/ (anything else) rust, app
# tools/perf/, tools/release/, tools/art/,
# tools/agents/, tools/macos-bundle.sh,
# .github/workflows/{perf,release}.yml,
# ui-spike/ nothing (their own workflows, or no CI)
#
# Test it with tools/ci/test-changes.sh.
set -euo pipefail

engine=false
rust=false
app=false
any=false
while IFS= read -r path || [ -n "$path" ]; do
path="${path%$'\r'}"
[ -n "$path" ] || continue
any=true
case "$path" in
*.md | docs/* | specs/* | .agents/* | LICENSE* | .github/ISSUE_TEMPLATE/* | .github/dependabot.yml) ;;
engine/tests/* | engine/bench/* | engine/tools/*) engine=true ;;
engine/*) engine=true rust=true app=true ;;
crates/*/tests/* | crates/*/benches/*) rust=true ;;
crates/*) rust=true app=true ;;
tools/perf/* | tools/release/* | tools/art/* | tools/agents/* | tools/macos-bundle.sh) ;;
.github/workflows/perf.yml | .github/workflows/release.yml | ui-spike/*) ;;
*) engine=true rust=true app=true ;;
esac
done

# No list at all (the diff failed or was empty): run everything rather than nothing.
if [ "$any" = false ]; then
engine=true rust=true app=true
fi

echo "engine=$engine"
echo "rust=$rust"
echo "app=$app"
Loading
Loading