-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (114 loc) · 4.21 KB
/
Copy pathci.yml
File metadata and controls
136 lines (114 loc) · 4.21 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
134
135
136
# CI for a project that ships two binaries and asks you to install nothing
# beside them - plus the cloud half: the portal and the ingest function.
#
# The Rust jobs are the same shape: format, lint, test against the real
# machine, then build and run the thing. `cargo tree --depth 1` is printed in
# each so a new dependency has to be noticed in review rather than discovered
# later - the closest equivalent to the "no third-party imports" check this
# repo had while it was Python, and the same intent: the dependency list is a
# test.
#
# The `cloud` job exists for one reason above the others: the pairing code is
# derived in three languages, and the same vectors are asserted in
# server/tests/pairing.rs, amplify/functions/ingest/protocol.test.mjs and
# site/tests/portal.spec.js. Any two of those can drift silently unless all
# three run on every push.
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
agent:
name: agent · ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: agent
- name: Direct dependencies, for the record
run: cargo tree --depth 1 --manifest-path agent/Cargo.toml
- name: Formatting and lints
run: |
cargo fmt --manifest-path agent/Cargo.toml --check
cargo clippy --manifest-path agent/Cargo.toml --all-targets -- -D warnings
- name: Tests
# A runner has no ~/.claude, so the checks that need one skip and say
# so. --nocapture is what makes those skips visible in the log rather
# than a green tick over eleven tests that mostly did nothing.
run: cargo test --manifest-path agent/Cargo.toml -- --nocapture
- name: It builds, and it is small
run: |
cargo build --release --manifest-path agent/Cargo.toml
ls -l agent/target/release/tokenhud-agent
./agent/target/release/tokenhud-agent --dry-run > /dev/null
server:
name: server · ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: server
- name: Direct dependencies, for the record
run: cargo tree --depth 1 --manifest-path server/Cargo.toml
- name: Formatting and lints
run: |
cargo fmt --manifest-path server/Cargo.toml --check
cargo clippy --manifest-path server/Cargo.toml --all-targets -- -D warnings
- name: Tests
run: cargo test --manifest-path server/Cargo.toml
- name: It builds, and it is small
run: |
cargo build --release --manifest-path server/Cargo.toml
ls -l server/target/release/tokenhud-server
cloud:
name: portal · ingest function
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: |
package-lock.json
site/package-lock.json
- name: Install
run: |
npm ci
npm ci --prefix site
- name: The ingest function typechecks
run: npm run typecheck
- name: The wire protocol still agrees with the server
# protocol.test.mjs asserts the pairing vectors the Rust server
# generated; server/tests/pairing.rs asserts the same table.
run: npm test
- name: Portal lints and builds
run: |
npm run lint --prefix site
npm run build --prefix site
- name: Portal behaves
# The signed-out portal, and the browser's half of the pairing
# contract. Tests needing a deployed backend skip and say so.
working-directory: site
run: |
npx playwright install --with-deps chromium
npm test