Repository navigation
223 lines (215 loc) · 9.45 KB
/
Copy pathci.yml
File metadata and controls
223 lines (215 loc) · 9.45 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# The gate every change passes before it merges: formatting, lints, and the
# library and binary tests, on the three platforms incode runs on.
#
# `/pr merge` refuses a pull request whose checks failed or are still
# running, so this workflow is what stands between a branch and `main`.
name: ci
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check
# The SDKs and the VS Code extension, against their fake incode/agent. The
# SDKs on the oldest runtimes they promise (Node 18, Python 3.9) as well as
# current ones; the extension on the Node VS Code ships. Python 3.9 is past
# its end of life and setup-python has no build of it for the Ubuntu
# `ubuntu-latest` now is (26.04: "The version '3.9' ... was not found"), so
# that leg runs on 22.04.
sdk-and-editor:
name: sdk-and-editor (node ${{ matrix.node }}, python ${{ matrix.python }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { node: 18, python: "3.9", os: ubuntu-22.04 }
- { node: 20, python: "3.12", os: ubuntu-latest }
- { node: 22, python: "3.12", os: ubuntu-latest }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: python3 -m unittest discover sdk/python/tests
- run: npm ci && npm test
working-directory: sdk/typescript
- run: npm ci && npm run compile && npm test
if: matrix.node == 22
working-directory: editors/vscode
# The Linux legs of release.yml, built exactly as it builds them: the same
# runners, packages and command. `test` above runs on ubuntu-latest, whose
# newer system headers once hid a dependency (libspa, through xcap) that
# cannot compile on the Ubuntu 22.04 a release is built on — so the release
# broke at tag time with every check green. Keep this in step with
# release.yml's Linux matrix entries and its build dependencies step.
release-build-linux:
name: release build (${{ matrix.target }})
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04-arm
runs-on: ${{ matrix.os }}
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build
run: cargo build --release --locked --target ${{ matrix.target }} -p incord-code -p incord-sandbox -p incord-desktop
# The released binaries must run on a machine with no desktop libraries:
# screen capture talks to the X server over its socket, so nothing of
# Wayland, GBM, EGL, PipeWire or libxcb may be linked. `incu` is the
# desktop crate's own binary; incode links the same crate.
- name: incode and incu link no desktop library
shell: bash
run: |
set -euo pipefail
for program in incode incu; do
bin="target/${{ matrix.target }}/release/$program"
ldd "$bin"
if ldd "$bin" | grep -E 'libxcb|libwayland|libgbm|libEGL|libpipewire|libdbus'; then
echo "$program links a desktop library it must not need" >&2
exit 1
fi
done
# Linux screen capture (crates/desktop/src/capture/x11.rs) against a real X
# server: the display list from RandR, GetImage of the root, the pixel
# conversion, at depth 24 (32 bits per pixel) and depth 16 (5-6-5). The
# live test is #[ignore]d everywhere else because it needs a display;
# this job is what keeps that path proven.
live-x11-capture:
name: live X11 capture (Xvfb)
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Linux build dependencies, and Xvfb
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config xvfb xauth
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Each run must have RUN the test: a filter that matches nothing
# passes with "0 passed", so the count is checked, not just the exit.
- name: capture at depth 24, then depth 16
shell: bash
run: |
set -euo pipefail
live=capture::x11::tests::a_real_x_screen_is_captured_at_its_size_and_in_its_colours
for screen in 1280x800x24 1024x768x16; do
echo "::group::Xvfb -screen 0 $screen"
xvfb-run -a -s "-screen 0 $screen" \
cargo test -p incord-desktop --lib "$live" -- --ignored --exact --nocapture --test-threads=1 \
| tee "$RUNNER_TEMP/live.txt"
grep -q "test result: ok. 1 passed" "$RUNNER_TEMP/live.txt"
echo "::endgroup::"
done
test:
name: test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
# A whole run takes under 15 minutes; a test that hangs fails the job
# here instead of holding it for GitHub's 6-hour default.
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
# The same set release.yml installs. The desktop backends (x11rb for
# capture and input, AT-SPI over zbus) are pure Rust and link no system
# library; pkg-config is how openssl-sys finds the runner's OpenSSL.
- name: Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config
# fish and zsh, for the completion scripts' tests (main.rs
# `fish_completes_from_the_table`, `zsh_completes_from_the_table`),
# which run them in the real shell and skip where it is missing. Test
# tools only: nothing links against them.
- name: shells the completion tests drive
if: runner.os == 'Linux'
run: sudo apt-get install -y --no-install-recommends fish zsh
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
# The tests create git repositories and commit in them.
- run: |
git config --global user.email "ci@example.invalid"
git config --global user.name "ci"
- run: cargo clippy --all-targets
- run: cargo test --lib
# RenderPdf with the runner's own browser, its output shown (#22): on
# Ubuntu 23.10+ a browser may be unable to build its own sandbox, and
# then incode must say so and what to do instead of printing nothing.
# The test passes either way; this log line is what shows which.
- name: RenderPdf on this runner, output shown
if: runner.os == 'Linux'
run: cargo test --lib render_pdf -- --nocapture --test-threads=1
# The completion tests skip a shell that is missing; here every shell
# the runner has is required, so a skip cannot pass for a run.
- run: cargo test --bins
env:
INCODE_TEST_SHELLS: ${{ runner.os == 'Linux' && 'bash,fish,zsh,powershell' || runner.os == 'macOS' && 'bash,zsh,powershell' || 'bash,powershell' }}
# incode's commands under `sandbox_engine = "insbx"`, for real (Linux;
# it says it skipped elsewhere).
- run: cargo test --test insbx_engine
# The standalone computer-use crate (`incu`): Windows UI Automation,
# macOS accessibility and Linux X11 each build here, and its tests (the
# desktop server's protocol, gates, journal and kill switch) run on all
# three. `cargo test --lib` above is incode's alone.
- run: cargo clippy -p incord-desktop --all-targets -- -D warnings
- run: cargo test -p incord-desktop
# The standalone sandbox (`insbx`). Its escape tests run on Linux and
# macOS, and skip, saying so, where the OS cannot enforce what they check.
- run: cargo clippy -p incord-sandbox --all-targets -- -D warnings
# Network deny natively on Windows (layer 2): the offline account and
# its firewall filters. The runner is an administrator. Without this
# the Windows network tests skip, saying so.
- name: insbx setup-windows
if: runner.os == 'Windows'
run: cargo run -p incord-sandbox --bin insbx -- setup-windows
- name: insbx doctor (after setup-windows)
if: runner.os == 'Windows'
env:
INSBX_BACKEND: native
run: cargo run -p incord-sandbox --bin insbx -- doctor
- run: cargo test -p incord-sandbox
# A test that writes outside its temp dir lands in the checkout — a
# Windows drive path is RELATIVE on Linux and macOS — and passes anyway.
# Only a clean tree after the run catches it.
- name: the tests left the checkout clean
shell: bash
run: |
git status --porcelain
test -z "$(git status --porcelain)"