feat(app): window icon (Config.icon) + soft-wrap TextEditor #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| # The core library has no C dependencies, so the full test suite runs on every | |
| # OS with just the Zig toolchain — no GPU, window server, or SDL required. | |
| test: | |
| name: test (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # setup-zig@v2 resolves tagged releases like 0.16.0 (v1's mirrors 404 for it). | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.16.0 | |
| - name: Run tests | |
| run: zig build test --summary all | |
| # The SDL3-backed examples are built (not run) to verify the backend links, and | |
| # the showcase renders one frame to a BMP via its headless `--screenshot` flag | |
| # (pure software rasterizer — no window) which is uploaded as an artifact. | |
| # macOS only: SDL3 installs cleanly via Homebrew, whereas it isn't yet packaged | |
| # in the Ubuntu runner's apt. (Core Linux coverage is the test + docker jobs.) | |
| examples: | |
| name: build examples + screenshot (macOS) | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.16.0 | |
| - name: Install SDL3 | |
| run: brew install sdl3 | |
| - name: Build examples | |
| run: zig build showcase edit -Doptimize=ReleaseFast | |
| - name: Render UI screenshot (headless, no window) | |
| continue-on-error: true | |
| run: ./zig-out/bin/showcase --screenshot "zigui-showcase.bmp" | |
| # Render the same frame through the real SDL_GPU pipeline (the macOS | |
| # arm64 runners expose a paravirtualized Metal device) and require it to | |
| # match the software rasterizer. Tolerance: GPU rasterizers snap edges to | |
| # a ~1/256px subpixel grid, so a stray glyph row may round differently — | |
| # allow <0.1% of channels off by more than 2/255, fail otherwise. | |
| # continue-on-error because the runner's virtual GPU is outside our control. | |
| - name: Render GPU screenshot + diff vs software | |
| continue-on-error: true | |
| run: | | |
| ./zig-out/bin/showcase --screenshot "zigui-showcase-gpu.bmp" --gpu | |
| python3 - <<'EOF' | |
| import struct, sys | |
| def readbmp(p): | |
| d = open(p, 'rb').read() | |
| off = struct.unpack('<I', d[10:14])[0] | |
| w = struct.unpack('<i', d[18:22])[0] | |
| h = struct.unpack('<i', d[22:26])[0] | |
| return d[off:], w, h | |
| a, w, h = readbmp('zigui-showcase.bmp') | |
| b, _, _ = readbmp('zigui-showcase-gpu.bmp') | |
| stride = (w * 3 + 3) // 4 * 4 | |
| bad = sum(1 for y in range(h) for i in range(w * 3) | |
| if abs(a[y*stride+i] - b[y*stride+i]) > 2) | |
| pct = 100 * bad / (w * h * 3) | |
| print(f"GPU vs software: {bad} channels off by >2 ({pct:.4f}%)") | |
| sys.exit(0 if pct < 0.1 else 1) | |
| EOF | |
| - name: Upload screenshots | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: showcase-screenshot | |
| path: "zigui-showcase*.bmp" | |
| if-no-files-found: warn | |
| # Reproduce the Linux test run inside Docker (mirrors local `docker build`). | |
| docker: | |
| name: docker linux test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build & test in Docker | |
| run: docker build -t zigui-test . |