git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

.github/workflows/ci.yml (6K)

  1 name: CI
  2 
  3 on:
  4   push:
  5   pull_request:
  6   workflow_dispatch:
  7 
  8 concurrency:
  9   group: ${{ github.workflow }}-${{ github.ref }}
 10   cancel-in-progress: true
 11 
 12 env:
 13   CARGO_TERM_COLOR: always
 14   # The tree builds without warnings; keep it that way. (Dependencies are
 15   # capped by cargo and unaffected.)
 16   RUSTFLAGS: -D warnings
 17 
 18 jobs:
 19   test:
 20     runs-on: ubuntu-24.04
 21     timeout-minutes: 30
 22     env:
 23       CCE_FONTS_DIR: /usr/share/fonts/truetype/liberation
 24     steps:
 25       - uses: actions/checkout@v5
 26 
 27       # libwayland-dev, libxkbcommon-dev: the two native libraries the build
 28       # links, found through pkg-config (wayland-sys, smithay-client-toolkit).
 29       # mesa-vulkan-drivers: lavapipe, a software Vulkan device, so the GPU
 30       # tests (vk::compute, vk::plate_probe) run instead of skipping.
 31       # fonts-liberation: a known face set (sans, serif, mono, each with its
 32       # italic) for the text tests, handed over as CCE_FONTS_DIR below. With
 33       # none, the font system fell back to whatever the runner image carries,
 34       # and the tests that need a second face or a fallback glyph failed —
 35       # which kept this workflow red from 2026-10-07 on.
 36       - name: Install system packages
 37         run: |
 38           sudo apt-get update
 39           sudo apt-get install -y --no-install-recommends \
 40             pkg-config libwayland-dev libxkbcommon-dev libvulkan1 mesa-vulkan-drivers \
 41             fonts-liberation
 42 
 43       - uses: dtolnay/rust-toolchain@stable
 44 
 45       - uses: Swatinem/rust-cache@v2
 46 
 47       - name: Build (default features)
 48         run: cargo build --all-targets
 49 
 50       - name: Test (default features)
 51         run: cargo test
 52 
 53       # `markdown` pulls cce-vault (a public git dependency); `doc_editor`
 54       # has none.
 55       - name: Test (all features)
 56         run: cargo test --all-features
 57 
 58       # The path tracer's GPU tests are #[ignore]d for machines without a
 59       # device; lavapipe has one, and its compute tier is what every Vulkan
 60       # device without RT cores (and WebGPU) runs.
 61       - name: Path tracer GPU tests (compute tier)
 62         run: CCE_VK_RT=compute cargo test --lib vk::rt -- --ignored
 63 
 64       # The GPU tests skip with a note when no Vulkan device opens, and a
 65       # skipped test passes. Fail instead if they skipped here, so losing
 66       # lavapipe does not quietly drop the only rendered checks.
 67       - name: GPU tests ran on a real device
 68         shell: bash
 69         run: |
 70           cargo test --lib vk:: -- --nocapture 2>&1 | tee vk-tests.log
 71           if grep -i "skipping" vk-tests.log; then
 72             echo "::error::the Vulkan tests skipped: no device opened on the runner"
 73             exit 1
 74           fi
 75 
 76   # Clippy over every target and feature, warnings as errors. The few lints the
 77   # crate allows are house style, listed with their reasons in Cargo.toml's
 78   # [lints.clippy]; anything else is fixed. Linux only: src/web and src/mac are
 79   # cfg'd out here, as in the test job.
 80   clippy:
 81     runs-on: ubuntu-24.04
 82     timeout-minutes: 20
 83     steps:
 84       - uses: actions/checkout@v5
 85       - name: Install system packages
 86         run: |
 87           sudo apt-get update
 88           sudo apt-get install -y --no-install-recommends pkg-config libwayland-dev libxkbcommon-dev
 89       - uses: dtolnay/rust-toolchain@stable
 90         with:
 91           components: clippy
 92       - uses: Swatinem/rust-cache@v2
 93       - run: cargo clippy --all-targets --all-features -- -D warnings
 94 
 95   # The registry's own widgets, under Miri: the aliasing rules a compiler does not check.
 96   # The context owns every widget as a raw root and lends it out; these tests take turns
 97   # between an app's access by handle, the context's dispatch, a lent widget reaching back,
 98   # and embedded children moving in and out, under both of Miri's aliasing models. Narrow
 99   # on purpose (Miri interprets, slowly).
100   miri:
101     runs-on: ubuntu-24.04
102     timeout-minutes: 45
103     env:
104       # A nightly may warn where stable does not; this job is about aliasing, not lints.
105       RUSTFLAGS: ""
106       MIRIFLAGS: -Zmiri-disable-isolation
107     steps:
108       - uses: actions/checkout@v5
109       - name: Install system packages
110         run: |
111           sudo apt-get update
112           sudo apt-get install -y --no-install-recommends pkg-config libwayland-dev libxkbcommon-dev
113       - uses: dtolnay/rust-toolchain@nightly
114         with:
115           components: miri, rust-src
116       - uses: Swatinem/rust-cache@v2
117       - run: cargo miri setup
118       - name: Stacked Borrows
119         run: cargo miri test --lib -- widget::handle widget::embedded scene::tree
120       - name: Tree Borrows
121         run: cargo miri test --lib -- widget::handle widget::embedded scene::tree
122         env:
123           MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-tree-borrows
124 
125   # The browser half (src/web, the wasm examples) is cfg'd out of the Linux
126   # build above, so nothing else compiles it. scripts/check-wasm type-checks
127   # the library, its features and the four wasm examples.
128   wasm:
129     runs-on: ubuntu-24.04
130     timeout-minutes: 20
131     env:
132       # An env RUSTFLAGS replaces .cargo/config.toml's rustflags, which is
133       # where the wasm target gets web-sys's unstable WebGPU bindings.
134       RUSTFLAGS: -D warnings --cfg=web_sys_unstable_apis
135     steps:
136       - uses: actions/checkout@v5
137       - uses: dtolnay/rust-toolchain@stable
138         with:
139           targets: wasm32-unknown-unknown
140       - uses: Swatinem/rust-cache@v2
141       - run: scripts/check-wasm
142 
143   # The AppKit shell (src/mac) and the MoltenVK path, built — and linked — on
144   # a real Mac, where on Linux scripts/check-mac can only type-check them. ash
145   # loads Vulkan at run time, so the build needs no MoltenVK; the GPU tests
146   # skip with a note on a runner without one.
147   macos:
148     runs-on: macos-latest
149     timeout-minutes: 30
150     steps:
151       - uses: actions/checkout@v5
152       - uses: dtolnay/rust-toolchain@stable
153       - uses: Swatinem/rust-cache@v2
154       - name: Build (all targets)
155         run: cargo build --all-targets
156       - name: Build (all features)
157         run: cargo build --lib --all-features
158       - name: Test
159         run: cargo test