Repository navigation
129 lines (122 loc) · 4.33 KB
/
Copy pathci.yml
File metadata and controls
129 lines (122 loc) · 4.33 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
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
rust-windows:
name: Rust (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all --check
- run: cargo clippy --workspace --all-targets -- -D warnings
# The runner has nobody at its desktop: the bots' real mouse and
# keyboard may be tested there (spec 24.7), never on a developer's.
- run: cargo test --workspace
env:
BOTLOFT_REAL_INPUT_TESTS: "1"
- name: Generated TypeScript bindings are up to date
run: git diff --exit-code -- app/src/lib/protocol.gen.ts
# The daemon, its crates and the app's Rust side off Windows (spec 18,
# item 8). Plain `cargo` builds the default members; the app crate comes
# after, with the desktop libraries Tauri needs on Linux. The setup
# window is Windows only.
rust-unix:
name: Rust (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu
os: ubuntu-latest
- name: macOS
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets -- -D warnings
- name: Desktop libraries for the app (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev \
libayatana-appindicator3-dev librsvg2-dev libxdo-dev
- name: The app's Rust side
run: |
cargo clippy -p botloft-app --all-targets -- -D warnings
cargo test -p botloft-app
# The runner image ships Edge and Chrome with sandbox helpers that are
# not setuid root, as their packages would leave them, so they refuse
# to start. The browser tests need a working sandbox.
- name: Browser sandbox helpers as their packages set them
if: runner.os == 'Linux'
run: |
for helper in /opt/microsoft/msedge/msedge-sandbox /opt/google/chrome/chrome-sandbox; do
if [ -f "$helper" ]; then
sudo chown root:root "$helper"
sudo chmod 4755 "$helper"
fi
done
- run: cargo test
# `botloftd service` against the real systemd or launchd (spec 14.1).
# The Linux runner has no user manager until the user lingers.
- name: The daemon as a service of the system
timeout-minutes: 10
env:
BOTLOFT_SERVICE_TEST: "1"
run: |
if [ "$RUNNER_OS" = Linux ]; then
sudo loginctl enable-linger "$USER"
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
for i in $(seq 1 30); do
systemctl --user show-environment > /dev/null 2>&1 && break
sleep 1
done
fi
cargo test -p botloftd --test service -- --nocapture && exit 0
# What the service manager saw, when the test fails.
if [ "$RUNNER_OS" = Linux ]; then
journalctl --user --no-pager -n 60 || true
else
launchctl list | grep -i botloft || true
log show --last 5m --predicate 'subsystem == "com.apple.xpc.launchd"' --style compact 2>/dev/null | grep -i botloft | tail -40 || true
fi
exit 1
app:
name: App (Windows)
runs-on: windows-latest
defaults:
run:
working-directory: app
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
package_json_file: app/package.json
- uses: actions/setup-node@v5
with:
node-version: 24
cache: pnpm
cache-dependency-path: app/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
- run: pnpm check
- run: pnpm build
- name: The setup window's page builds too (spec 15.7)
run: pnpm exec vite build --mode setup