Repository navigation
245 lines (237 loc) · 9.57 KB
/
Copy pathci.yml
File metadata and controls
245 lines (237 loc) · 9.57 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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: CI
on:
workflow_call:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
defaults:
run:
shell: bash
jobs:
test:
name: Tests and build
runs-on: ubuntu-24.04
timeout-minutes: 45
env:
GOTOOLCHAIN: local
GOWORK: "off"
GOFLAGS: ""
GOEXPERIMENT: ""
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
check-latest: false
cache: true
# just is installed from its pinned release asset rather than through
# extractions/setup-just, which resolves the version through the GitHub
# releases API on every run and fails when that lookup is rate limited.
# The checksum makes CI run exactly this artifact or stop.
- name: Install just and tools
run: |
version=1.58.0
archive=just-${version}-x86_64-unknown-linux-musl.tar.gz
curl -fsSL --retry 3 -o "$archive" "https://github.com/casey/just/releases/download/${version}/${archive}"
echo "4a5cc2f53e6f0f8c59092a6cc38291eb729d46a7dd95d3ae582008881b84931d ${archive}" | sha256sum --check --strict -
tar -xzf "$archive" just
sudo install -m 0755 just /usr/local/bin/just
rm -f "$archive" just
bun=1.4.3
curl -fsSL --retry 3 -o bun.zip "https://github.com/oven-sh/bun/releases/download/bun-v${bun}/bun-linux-x64.zip"
echo "3e730528d89775f03f87f05c06787c4df4099d0a37f3f252e7b829cb23816e18 bun.zip" | sha256sum --check --strict -
unzip -q bun.zip
sudo install -m 0755 bun-linux-x64/bun /usr/local/bin/bun
rm -rf bun.zip bun-linux-x64
go install golang.org/x/vuln/cmd/govulncheck@v1.7.0
go install github.com/rhysd/actionlint/cmd/actionlint@v1.7.12
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
# The catalog check runs stories in Chromium; the pinned Playwright
# installs the browser it was built against.
- name: Install Chromium for the catalog check
timeout-minutes: 10
run: cd ui && bun install --frozen-lockfile && bun x playwright install --with-deps chromium
- uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
with:
distribution: goreleaser
version: v2.18.0
install-only: true
# Tests run with a disposable home and Driga data (scripts/isolated.sh).
- name: Verify repository
run: just ci
chat-sandbox:
name: Chat sandbox (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [macos-15, ubuntu-24.04]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
env:
GOTOOLCHAIN: local
GOWORK: "off"
GOFLAGS: ""
GOEXPERIMENT: ""
DRIGATEST_REQUIRE_SANDBOX: "1"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
check-latest: false
cache: true
- name: Install Linux sandbox and enable its namespaces
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y bubblewrap
# Ubuntu's AppArmor restriction can block unprivileged bwrap even
# with user namespaces enabled. Relax it only on this disposable
# CI VM; product code never changes the host's sysctls.
if [ -e /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
bwrap --unshare-all --ro-bind / / /bin/true
- name: Record native sandbox versions
run: |
uname -a
if [ "$RUNNER_OS" = macOS ]; then
sw_vers
ls -l /usr/bin/sandbox-exec
else
cat /etc/os-release
bwrap --version
sysctl kernel.unprivileged_userns_clone kernel.apparmor_restrict_unprivileged_userns || true
fi
go version
- name: Explain native sandbox probe
run: scripts/isolated.sh go test ./internal/command -run '^TestProbeDiagnostics$' -v -count=1
- name: Require real sandbox denials and doctor diagnostics
run: scripts/isolated.sh go test ./internal/cli ./internal/command -run 'Test(DoctorSandbox|CommandSandboxIntegration)' -v -count=1
- name: Chat commands through the built binary
run: scripts/isolated.sh go test -tags e2e ./cmd/driga -run '^TestChatCommandsBuiltBinary$' -v -count=1 -timeout 25m
windows:
name: Windows tests
runs-on: windows-2025
timeout-minutes: 30
env:
GOTOOLCHAIN: local
GOWORK: "off"
GOFLAGS: ""
GOEXPERIMENT: ""
CGO_ENABLED: "0"
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
check-latest: false
cache: true
- name: Isolate test and build state
run: |
$goCache, $goModCache = (go env GOCACHE), (go env GOMODCACHE)
$taskRoot = Join-Path $env:RUNNER_TEMP ("dw-" + [guid]::NewGuid().ToString('N').Substring(0,8))
$testHome = Join-Path $taskRoot 'home'
New-Item -ItemType Directory -Force $testHome, "$taskRoot/data", "$taskRoot/spool", "$taskRoot/temp" | Out-Null
$settings = @{
HOME = $testHome
USERPROFILE = $testHome
APPDATA = "$testHome/AppData/Roaming"
LOCALAPPDATA = "$testHome/AppData/Local"
CLAUDE_CONFIG_DIR = ''
CODEX_HOME = "$testHome/.codex"
COPILOT_HOME = "$testHome/.copilot"
GEMINI_CLI_HOME = "$testHome/.gemini"
XDG_CONFIG_HOME = "$testHome/.config"
XDG_DATA_HOME = "$testHome/.local/share"
XDG_STATE_HOME = "$testHome/.local/state"
DRIGA_DATA_DIR = "$taskRoot/data"
DRIGA_SPOOL_DIR = "$taskRoot/spool"
DRIGA_CONFIG = "$taskRoot/config.toml"
TEMP = "$taskRoot/temp"
TMP = "$taskRoot/temp"
GOCACHE = $goCache
GOMODCACHE = $goModCache
}
foreach ($entry in $settings.GetEnumerator()) { "$($entry.Key)=$($entry.Value)" >> $env:GITHUB_ENV }
- name: Vet
run: go vet ./...
- name: Test on Windows
run: go test ./...
- name: Native Chat process identities and sandbox refusal
run: |
go test ./internal/platform ./internal/kill ./internal/command ./internal/cli -run 'Test(ProcessOwnerCollection|ProcessSnapshotIdentity|SnapshotOwnedChild|SnapshotSignalResults|ProcessCommandSnapshot|ProcessProtectedTargets|CommandRunnerUnavailable|DoctorSandbox)' -v -count=1
go test -tags e2e ./cmd/driga -run '^TestChatCommandsBuiltBinary$' -v -count=1 -timeout 25m
- name: Build the cgo-free Windows targets
run: |
go build ./...
$env:GOARCH = 'arm64'
go build ./...
windows-e2e:
name: Windows end-to-end
runs-on: windows-2025
timeout-minutes: 30
env:
GOTOOLCHAIN: local
GOWORK: "off"
GOFLAGS: ""
GOEXPERIMENT: ""
CGO_ENABLED: "0"
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
check-latest: false
cache: true
- name: Isolate test and build state
run: |
$goCache, $goModCache = (go env GOCACHE), (go env GOMODCACHE)
$taskRoot = Join-Path $env:RUNNER_TEMP ("dw-" + [guid]::NewGuid().ToString('N').Substring(0,8))
$testHome = Join-Path $taskRoot 'home'
New-Item -ItemType Directory -Force $testHome, "$taskRoot/data", "$taskRoot/spool", "$taskRoot/temp" | Out-Null
$settings = @{
HOME = $testHome
USERPROFILE = $testHome
APPDATA = "$testHome/AppData/Roaming"
LOCALAPPDATA = "$testHome/AppData/Local"
CLAUDE_CONFIG_DIR = ''
CODEX_HOME = "$testHome/.codex"
COPILOT_HOME = "$testHome/.copilot"
GEMINI_CLI_HOME = "$testHome/.gemini"
XDG_CONFIG_HOME = "$testHome/.config"
XDG_DATA_HOME = "$testHome/.local/share"
XDG_STATE_HOME = "$testHome/.local/state"
DRIGA_DATA_DIR = "$taskRoot/data"
DRIGA_SPOOL_DIR = "$taskRoot/spool"
DRIGA_CONFIG = "$taskRoot/config.toml"
TEMP = "$taskRoot/temp"
TMP = "$taskRoot/temp"
GOCACHE = $goCache
GOMODCACHE = $goModCache
}
foreach ($entry in $settings.GetEnumerator()) { "$($entry.Key)=$($entry.Value)" >> $env:GITHUB_ENV }
- name: Windows end-to-end
run: go test -tags e2e ./internal/e2e -v -timeout 25m