Repository navigation
228 lines (223 loc) · 9.88 KB
/
Copy pathrust.yml
File metadata and controls
228 lines (223 loc) · 9.88 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
224
225
226
227
228
name: Rust
# Pushes to main run these checks through testing-build.yml, which calls this
# workflow before it publishes packages.
on:
pull_request:
branches: [main]
workflow_dispatch:
workflow_call:
inputs:
linux-runner:
description: Runner label for the Linux leg
type: string
default: ubuntu-24.04
permissions:
contents: read
# In a called workflow github.workflow names the caller, so a direct run and a
# Testing build run on the same ref never cancel each other.
concurrency:
group: ${{ github.workflow }}-rust-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check:
name: Rust (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: ["${{ inputs.linux-runner || 'ubuntu-24.04' }}", windows-2025]
runs-on: ${{ matrix.os }}
timeout-minutes: 40
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install the pinned toolchain
run: rustup toolchain install 1.99.1 --profile minimal --component rustfmt --component clippy
- name: Check formatting
run: cargo fmt --all -- --check
- name: Install the desktop shell's Linux build packages
if: runner.os == 'Linux'
run: |
# The Tauri prerequisites for Debian and Ubuntu. They are needed to
# compile the desktop crate; no test here starts a webview.
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev \
libssl-dev libayatana-appindicator3-dev librsvg2-dev
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
- name: Build the desktop frontend
# The desktop crate embeds ui/dist at compile time, so the frontend
# must be built before any workspace-wide Cargo step.
working-directory: crates/omgcode-desktop/ui
run: |
npm ci --ignore-scripts
npm run build
- name: Check lints and compilation
run: cargo clippy --workspace --all-targets --locked -- -D warnings
- name: Start a user service manager for delegated cgroups
if: runner.os == 'Linux'
run: |
sudo loginctl enable-linger "$USER"
runtime_dir="/run/user/$(id -u)"
for _ in $(seq 1 50); do
[ -S "$runtime_dir/bus" ] && break
sleep 0.2
done
echo "XDG_RUNTIME_DIR=$runtime_dir" >> "$GITHUB_ENV"
echo "DBUS_SESSION_BUS_ADDRESS=unix:path=$runtime_dir/bus" >> "$GITHUB_ENV"
XDG_RUNTIME_DIR="$runtime_dir" systemd-run --user --scope --quiet -p Delegate=yes -- cat /proc/self/cgroup
- name: Start an unlocked Secret Service for credential tests
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends gnome-keyring
# One empty line is an empty password. It creates and unlocks the
# login collection, which becomes the default alias; empty input
# (no newline) creates no collection.
printf '\n' | gnome-keyring-daemon --unlock --components=secrets
for _ in $(seq 1 50); do
busctl --user call org.freedesktop.secrets /org/freedesktop/secrets \
org.freedesktop.Secret.Service ReadAlias s default 2>/dev/null \
| grep -q '/collection/' && break
sleep 0.2
done
busctl --user call org.freedesktop.secrets /org/freedesktop/secrets \
org.freedesktop.Secret.Service ReadAlias s default | grep '/collection/'
- name: Run tests
run: cargo test --workspace --all-targets --locked
- name: Run documentation tests
run: cargo test --workspace --doc --locked
# ADR-0069: rerun the file-access suites with the temporary directory, and so
# every fixture's data root and workspace, on each accepted filesystem. The
# runner's own disk covers NTFS and ext4 in the check job above.
filesystems:
name: Filesystem (${{ matrix.filesystem }})
strategy:
fail-fast: false
matrix:
include:
- { filesystem: ReFS, os: windows-2025 }
- { filesystem: btrfs, os: ubuntu-24.04 }
- { filesystem: xfs, os: ubuntu-24.04 }
- { filesystem: tmpfs, os: ubuntu-24.04 }
- { filesystem: zfs, os: ubuntu-24.04 }
runs-on: ${{ matrix.os }}
timeout-minutes: 40
env:
OMGCODE_TEST_EXPECT_FS: ${{ matrix.filesystem }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install the pinned toolchain
run: rustup toolchain install 1.99.1 --profile minimal
- name: Mount a ReFS volume
if: runner.os == 'Windows'
shell: pwsh
run: |
$vhd = Join-Path $env:RUNNER_TEMP 'refs.vhdx'
$script = Join-Path $env:RUNNER_TEMP 'refs.txt'
@(
"create vdisk file=`"$vhd`" maximum=8192 type=expandable"
"select vdisk file=`"$vhd`""
'attach vdisk'
'convert gpt'
'create partition primary'
'assign letter=R'
) | Set-Content -Encoding ascii $script
diskpart /s $script
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Format-Volume -DriveLetter R -FileSystem ReFS -Confirm:$false -Force | Out-Null
# A new volume root grants Authenticated Users Modify only. Give the
# test directory the per-user shape of %TEMP%, as the tests require.
New-Item -ItemType Directory R:\tmp | Out-Null
icacls R:\tmp /inheritance:r /grant:r "${env:USERDOMAIN}\${env:USERNAME}:(OI)(CI)F" `
'NT AUTHORITY\SYSTEM:(OI)(CI)F' 'BUILTIN\Administrators:(OI)(CI)F'
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
"TEMP=R:\tmp" >> $env:GITHUB_ENV
"TMP=R:\tmp" >> $env:GITHUB_ENV
- name: Mount a ${{ matrix.filesystem }} filesystem
if: runner.os == 'Linux'
env:
FILESYSTEM: ${{ matrix.filesystem }}
run: |
sudo mkdir -p /mnt/fs
image="$RUNNER_TEMP/fs.img"
case "$FILESYSTEM" in
btrfs|xfs)
sudo apt-get update
sudo apt-get install -y --no-install-recommends btrfs-progs xfsprogs
truncate -s 4G "$image"
"mkfs.$FILESYSTEM" -q "$image"
sudo mount -o loop "$image" /mnt/fs
;;
zfs)
sudo apt-get update
sudo apt-get install -y --no-install-recommends zfsutils-linux
truncate -s 4G "$image"
sudo zpool create -m /mnt/fs omgcode "$image"
;;
tmpfs)
sudo mount -t tmpfs -o size=4G,mode=0755 tmpfs /mnt/fs
;;
esac
sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" /mnt/fs/tmp
findmnt -T /mnt/fs/tmp
uname -r
echo "TMPDIR=/mnt/fs/tmp" >> "$GITHUB_ENV"
- name: Start a user service manager for delegated cgroups
if: runner.os == 'Linux'
run: |
sudo loginctl enable-linger "$USER"
runtime_dir="/run/user/$(id -u)"
for _ in $(seq 1 50); do
[ -S "$runtime_dir/bus" ] && break
sleep 0.2
done
echo "XDG_RUNTIME_DIR=$runtime_dir" >> "$GITHUB_ENV"
echo "DBUS_SESSION_BUS_ADDRESS=unix:path=$runtime_dir/bus" >> "$GITHUB_ENV"
# The core unit tests include credential tests that need it.
- name: Start an unlocked Secret Service for credential tests
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends gnome-keyring
# One empty line is an empty password. It creates and unlocks the
# login collection, which becomes the default alias; empty input
# (no newline) creates no collection.
printf '\n' | gnome-keyring-daemon --unlock --components=secrets
for _ in $(seq 1 50); do
busctl --user call org.freedesktop.secrets /org/freedesktop/secrets \
org.freedesktop.Secret.Service ReadAlias s default 2>/dev/null \
| grep -q '/collection/' && break
sleep 0.2
done
busctl --user call org.freedesktop.secrets /org/freedesktop/secrets \
org.freedesktop.Secret.Service ReadAlias s default | grep '/collection/'
- name: Check that the temporary directory is on ${{ matrix.filesystem }}
shell: bash
run: |
cargo test -p omgcode-platform --lib --locked -- --ignored --exact \
"$(if [ "$RUNNER_OS" = Windows ]; then
echo private_store::windows::volume::tests::the_temporary_directory_is_on_the_expected_filesystem
else
echo broker::linux::replacement::tests::the_temporary_directory_is_on_the_expected_filesystem
fi)" | tee guard.log
grep -q '^test result: ok. 1 passed' guard.log
- name: Run the platform file-access and container grant tests
# A block scalar: in a plain scalar, `:: ` would start a mapping.
run: >-
cargo test -p omgcode-platform --lib --locked --
broker:: private_store:: container::
- name: Run the core file-access tests
run: >-
cargo test -p omgcode-core --locked --lib
--test checkpoint_storage --test file_broker --test replacement_records
--test turn_runtime --test approval_review --test workspace_listing
- name: Run the CLI file-access tests
run: >-
cargo test -p omgcode-cli --locked
--test replacement_apply --test checkpoint_lifecycle --test checkpoint_recovery
--test file_workflow --test model_tools