-
Notifications
You must be signed in to change notification settings - Fork 3
133 lines (128 loc) · 4.63 KB
/
Copy pathci.yml
File metadata and controls
133 lines (128 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: CI
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
rust:
name: Rust ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-15, ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Format
run: cargo fmt --all --check
# The desktop crate needs system webkit libraries, so it is built in the
# `desktop` job below rather than dragging those into every Rust check.
- name: Clippy
run: cargo clippy --workspace --exclude sajilo-desktop --all-targets -- -D warnings
- name: Test
run: cargo test --workspace --exclude sajilo-desktop
- name: TypeScript bindings are current
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
# Regenerating must be a no-op; a stale api.ts would let a renamed
# Rust field reach the frontend without breaking the build.
cargo test -p sajilo-api --features typescript
if ! git diff --quiet -- apps/desktop/src/types; then
echo "Generated bindings are stale. Run:" >&2
echo " cargo test -p sajilo-api --features typescript" >&2
git diff --stat -- apps/desktop/src/types >&2
exit 1
fi
- name: sajilo-core stays I/O-free
shell: bash
run: |
# The crate must compile into the server, the desktop binary and a
# plain cargo test, so it may not pull in a runtime or an HTTP client.
for crate in tokio reqwest tauri hyper; do
if cargo tree -p sajilo-core --prefix none | grep -qw "$crate"; then
echo "sajilo-core must not depend on $crate" >&2
exit 1
fi
done
showcase:
name: Showcase
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up bun
uses: oven-sh/setup-bun@v2
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: ". -> target"
# The showcase compiles the desktop source directly. TypeScript resolves
# imports relative to that source, so its dependencies must exist too.
- name: Install desktop frontend dependencies
working-directory: apps/desktop
run: bun install --frozen-lockfile
- name: Install dependencies
working-directory: apps/showcase
run: bun install --frozen-lockfile
# The recording is a pure function of the fixtures and the parsers, so a
# fresh run must reproduce the committed file byte for byte. A diff here
# means a parser changed and the landing page is still showing what the
# old one produced. The bundle itself is not compared — its filenames
# carry content hashes that a different toolchain version would churn.
- name: Check the recording is current
working-directory: apps/showcase
run: bun run data
- name: Check for drift
run: |
if ! git diff --quiet -- src/data/scenes.json; then
echo "apps/showcase/src/data/scenes.json is stale. Run:"
echo " cd apps/showcase && bun run data && bun run build"
git diff --stat -- src/data/scenes.json
exit 1
fi
working-directory: apps/showcase
- name: Typecheck and build
working-directory: apps/showcase
run: |
bun run typecheck
bun run build
desktop:
name: Desktop ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-15, ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Linux webkit dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf
- name: Set up bun
uses: oven-sh/setup-bun@v2
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: ". -> target"
- name: Install frontend dependencies
working-directory: apps/desktop
run: bun install --frozen-lockfile
- name: Lint and typecheck the frontend
working-directory: apps/desktop
run: |
bun run lint
bun run typecheck
- name: Build the frontend
working-directory: apps/desktop
run: bun run build
- name: Build the shell
run: cargo build -p sajilo-desktop