Skip to content

Commit 357500e

Browse files
ci: TEMPORARY — register workflows on the stub default branch
GitHub creates no runs for push events whose workflows have never been registered (default branch has none). This stub main is force-replaced by the migrated history (engine-main) after CI proves it; this commit vanishes with it.
1 parent 4efeee7 commit 357500e

3 files changed

Lines changed: 288 additions & 0 deletions

File tree

.github/workflows/build-canvas.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: canvas build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- engine-main
9+
pull_request:
10+
paths:
11+
- ".github/workflows/**"
12+
- "crates/**"
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
with:
26+
submodules: recursive
27+
28+
- name: Setup pnpm
29+
uses: pnpm/action-setup@v4
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version-file: .nvmrc
35+
cache: pnpm
36+
37+
- name: Install system dependencies
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y \
41+
build-essential \
42+
cmake \
43+
ninja-build \
44+
just
45+
46+
- name: Setup Rust toolchain
47+
uses: dtolnay/rust-toolchain@stable
48+
with:
49+
toolchain: 1.92.0
50+
51+
- name: Add wasm32-unknown-emscripten target
52+
run: rustup target add wasm32-unknown-emscripten
53+
54+
- name: Cache cargo build outputs
55+
uses: Swatinem/rust-cache@v2
56+
with:
57+
key: wasm32-unknown-emscripten
58+
59+
# Minimal Node island: workspace = the canvas-wasm npm half + reftest
60+
# tooling. (The cross-repo TS suites were retired at the engine split;
61+
# the remaining smoke test is self-contained.)
62+
- name: Install dependencies
63+
run: pnpm install --frozen-lockfile
64+
65+
- name: Install Emscripten SDK
66+
run: python3 bin/activate-emsdk
67+
68+
- name: Fix missing xlocale.h header for Emscripten
69+
run: |
70+
sudo ln -s /usr/include/locale.h /usr/include/xlocale.h
71+
72+
- name: Build canvas wasm artifacts
73+
run: just build
74+
working-directory: crates/grida-canvas-wasm
75+
76+
- name: Run canvas wasm smoke test
77+
run: pnpm --filter @grida/canvas-wasm test
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# -----------------------------------------------------------------
2+
# Freshness check for committed FlatBuffers bindings
3+
# -----------------------------------------------------------------
4+
#
5+
# Why this exists
6+
# ---------------
7+
# The Rust FlatBuffers bindings (`crates/grida/src/io/generated/grida.rs`)
8+
# are committed to git so that `cargo build` works from a clean checkout without
9+
# requiring `flatc`. However, because the file is generated from `format/grida.fbs`,
10+
# it can become stale if someone edits the schema but forgets to regenerate.
11+
#
12+
# This workflow re-runs codegen and asserts that the committed file is identical
13+
# to what `flatc` would produce. If it differs, the check fails with a clear
14+
# error message telling the contributor how to fix it.
15+
#
16+
# (Recreated at the engine migration: the TS-bindings half of this check stayed
17+
# in gridaco/grida as a frozen tombstone with its generator deleted — the Rust
18+
# side here is the schema's only living consumer.)
19+
#
20+
# How to fix a failure
21+
# --------------------
22+
# python3 bin/activate-flatc -- --rust -o crates/grida/src/io/generated format/grida.fbs && mv crates/grida/src/io/generated/grida_generated.rs crates/grida/src/io/generated/grida.rs
23+
# git add crates/grida/src/io/generated/grida.rs
24+
# git commit
25+
# -----------------------------------------------------------------
26+
27+
name: check generated flatbuffers
28+
29+
on:
30+
push:
31+
branches:
32+
- main
33+
- engine-main
34+
pull_request:
35+
paths:
36+
- "format/grida.fbs"
37+
- "crates/grida/src/io/generated/**"
38+
- "bin/activate-flatc"
39+
40+
jobs:
41+
rust-bindings:
42+
name: rust fbs freshness
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v4
47+
48+
- name: Regenerate Rust FlatBuffers bindings
49+
run: |
50+
python3 bin/activate-flatc -- --rust \
51+
-o crates/grida/src/io/generated \
52+
format/grida.fbs
53+
mv crates/grida/src/io/generated/grida_generated.rs \
54+
crates/grida/src/io/generated/grida.rs
55+
56+
- name: Check for uncommitted changes
57+
run: |
58+
if ! git diff --exit-code crates/grida/src/io/generated/grida.rs; then
59+
echo "::error::Generated Rust FlatBuffers bindings are stale. Regenerate with bin/activate-flatc (see the workflow header) and commit the result."
60+
exit 1
61+
fi

.github/workflows/test-crates.yml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: test crates
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- engine-main
8+
pull_request:
9+
paths:
10+
- ".github/workflows/**"
11+
- "Cargo.lock"
12+
- "Cargo.toml"
13+
- "crates/**"
14+
- "third_party/**"
15+
- "rust-toolchain.toml"
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
fmt:
23+
name: cargo fmt --check
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Rust toolchain
30+
uses: dtolnay/rust-toolchain@stable
31+
with:
32+
toolchain: 1.92.0
33+
34+
- name: Check formatting
35+
run: cargo fmt --all -- --check
36+
37+
clippy:
38+
name: cargo clippy
39+
needs: [test]
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v4
44+
45+
- name: Free up disk space
46+
run: |
47+
sudo rm -rf /usr/share/dotnet
48+
sudo rm -rf /usr/local/lib/android
49+
sudo rm -rf /opt/ghc
50+
sudo rm -rf /opt/hostedtoolcache/CodeQL
51+
sudo docker image prune --all --force
52+
53+
- name: Install system dependencies
54+
run: |
55+
sudo apt-get update
56+
sudo apt-get install -y \
57+
libexpat1-dev \
58+
libfontconfig1-dev \
59+
libfreetype6-dev \
60+
libgl1-mesa-dev \
61+
libgles2-mesa-dev \
62+
libwayland-dev \
63+
libx11-dev \
64+
libx11-xcb-dev \
65+
libxcb-render0-dev \
66+
libxcb-shape0-dev \
67+
libxcb-xfixes0-dev \
68+
libxcursor-dev \
69+
libxi-dev \
70+
libxinerama-dev \
71+
libxrandr-dev \
72+
libxxf86vm-dev \
73+
mesa-common-dev
74+
75+
- name: Setup Rust toolchain
76+
uses: dtolnay/rust-toolchain@stable
77+
with:
78+
toolchain: 1.92.0
79+
components: clippy
80+
81+
- name: Cache cargo build outputs
82+
uses: Swatinem/rust-cache@v2
83+
with:
84+
shared-key: test-native
85+
cache-all-crates: true
86+
cache-workspace-crates: true
87+
cache-on-failure: true
88+
89+
- name: Run clippy
90+
env:
91+
FORCE_SKIA_BINARIES_DOWNLOAD: "1"
92+
run: cargo clippy --no-deps --workspace --exclude grida-canvas-wasm -- -D warnings
93+
94+
test:
95+
name: cargo test
96+
runs-on: ubuntu-latest
97+
steps:
98+
- name: Checkout repository
99+
uses: actions/checkout@v4
100+
with:
101+
lfs: true
102+
103+
- name: Free up disk space
104+
run: |
105+
sudo rm -rf /usr/share/dotnet
106+
sudo rm -rf /usr/local/lib/android
107+
sudo rm -rf /opt/ghc
108+
sudo rm -rf /opt/hostedtoolcache/CodeQL
109+
sudo docker image prune --all --force
110+
df -h
111+
112+
- name: Install system dependencies
113+
run: |
114+
sudo apt-get update
115+
sudo apt-get install -y \
116+
libexpat1-dev \
117+
libfontconfig1-dev \
118+
libfreetype6-dev \
119+
libgl1-mesa-dev \
120+
libgles2-mesa-dev \
121+
libwayland-dev \
122+
libx11-dev \
123+
libx11-xcb-dev \
124+
libxcb-render0-dev \
125+
libxcb-shape0-dev \
126+
libxcb-xfixes0-dev \
127+
libxcursor-dev \
128+
libxi-dev \
129+
libxinerama-dev \
130+
libxrandr-dev \
131+
libxxf86vm-dev \
132+
mesa-common-dev
133+
134+
- name: Setup Rust toolchain
135+
uses: dtolnay/rust-toolchain@stable
136+
with:
137+
toolchain: 1.92.0
138+
139+
- name: Cache cargo build outputs
140+
uses: Swatinem/rust-cache@v2
141+
with:
142+
shared-key: test-native
143+
cache-all-crates: true
144+
cache-workspace-crates: true
145+
cache-on-failure: true
146+
147+
- name: Run cargo tests
148+
env:
149+
FORCE_SKIA_BINARIES_DOWNLOAD: "1"
150+
run: cargo test --workspace --exclude grida-canvas-wasm

0 commit comments

Comments
 (0)