Repository navigation
182 lines (177 loc) · 7.83 KB
/
Copy pathtest.yml
File metadata and controls
182 lines (177 loc) · 7.83 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
name: ci
on:
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: '1.3.2'
- uses: extractions/setup-just@v2
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: just install
- run: just check
- run: just compat-unit
test-int:
name: Harness integration tests
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: oven-sh/setup-bun@v2
with:
bun-version: '1.3.2'
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with:
node-version: '22'
- run: just install
- name: Install process inspection tools
run: sudo apt-get update && sudo apt-get install -y procps
- name: Harness unit and integration checks
shell: bash
run: just test-int 2>&1 | tee "$RUNNER_TEMP/test-int.log"
- name: Upload harness failure log
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-int-failure
path: ${{ runner.temp }}/test-int.log
if-no-files-found: warn
retention-days: 7
test-e2e:
name: E2E tests (${{ matrix.host }})
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- host: v1
version: '1.18.34'
- host: v2
version: '2.0.15'
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: oven-sh/setup-bun@v2
with:
bun-version: '1.3.2'
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with:
node-version: '22'
- run: just install
- name: Install process and archive tools
run: sudo apt-get update && sudo apt-get install -y procps tar curl
- name: Install and verify pinned native host
shell: bash
env:
HOST: ${{ matrix.host }}
VERSION: ${{ matrix.version }}
run: |
prefix="$RUNNER_TEMP/opencode-$HOST"
mkdir -p "$prefix/native"
if [[ "$HOST" == v1 ]]; then
curl --fail --location --retry 3 --output "$prefix/archive.tar.gz" \
"https://github.com/anomalyco/opencode/releases/download/v$VERSION/opencode-linux-x64-baseline.tar.gz"
echo "24b0d458d21ef548b2752166303defcf7f4945b049fb4876ab78dfaf86d81b27 $prefix/archive.tar.gz" | sha256sum --check
tar -xzf "$prefix/archive.tar.gz" -C "$prefix/native"
else
npm install --prefix "$prefix/native" --no-save --ignore-scripts \
"@opencode/cli-linux-x64-baseline@$VERSION"
node - "$prefix/native/node_modules/@opencode/cli-linux-x64-baseline/package.json" "$VERSION" <<'NODE'
const fs = require('node:fs');
const manifest = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
if (manifest.name !== '@opencode/cli-linux-x64-baseline' || manifest.version !== process.argv[3]) {
throw new Error('Unexpected native host package identity');
}
NODE
fi
mapfile -t binaries < <(find "$prefix/native" -type f -name opencode -perm /111)
[[ "${#binaries[@]}" == 1 ]] || { echo 'Expected one native host executable'; exit 1; }
binary="$(realpath "${binaries[0]}")"
actual="$("$binary" --version)"
actual="${actual#opencode v}"
[[ "$actual" == "$VERSION" ]] || { echo "Host version mismatch: $actual"; exit 1; }
echo "OPENCODE_E2E_BIN=$binary" >> "$GITHUB_ENV"
- name: Cache-installed plugin E2E
shell: bash
env:
HOST: ${{ matrix.host }}
VERSION: ${{ matrix.version }}
run: |
just test-e2e "$HOST" "$OPENCODE_E2E_BIN" "$VERSION" \
"$RUNNER_TEMP/vimcode-e2e-$HOST" 2>&1 | tee "$RUNNER_TEMP/terminal-control-e2e-$HOST.log"
- name: Verify no-plugin negative control
shell: bash
env:
HOST: ${{ matrix.host }}
VERSION: ${{ matrix.version }}
run: |
set +e
VIMCODE_E2E_NO_PLUGIN=1 just test-e2e "$HOST" "$OPENCODE_E2E_BIN" "$VERSION" \
"$RUNNER_TEMP/vimcode-negative-$HOST" 2>&1 | tee "$RUNNER_TEMP/terminal-control-negative-$HOST.log"
status=${PIPESTATUS[0]}
set -e
[[ "$status" == 1 ]] || { echo "Expected negative-control exit 1, got $status"; exit 1; }
node - "$RUNNER_TEMP/vimcode-negative-$HOST/receipt.json" "$HOST" "$VERSION" <<'NODE'
const assert = require('node:assert/strict');
const receipt = require(process.argv[2]);
assert.equal(receipt.host, process.argv[3]);
assert.equal(receipt.version, process.argv[4]);
assert.equal(receipt.negativeControl, true);
assert.equal(receipt.providersDisabled, true);
assert.deepEqual(receipt.providerObservations, {
'word-motion': 'Build · No provider selected Connect a provider'
});
assert.deepEqual(receipt.cleanupErrors, []);
const failures = receipt.checks.filter(check => check.status === 'fail');
assert.deepEqual(failures.map(check => check.name), ['word-home', 'word-motion']);
assert.deepEqual(failures[0].actual.lines, ['one two three0']);
NODE
- name: Upload synthetic E2E failure evidence
if: failure()
uses: actions/upload-artifact@v4
with:
name: terminal-control-e2e-${{ matrix.host }}-failure
path: |
${{ runner.temp }}/terminal-control-e2e-${{ matrix.host }}.log
${{ runner.temp }}/terminal-control-negative-${{ matrix.host }}.log
${{ runner.temp }}/vimcode-negative-${{ matrix.host }}/receipt.json
${{ runner.temp }}/vimcode-negative-${{ matrix.host }}/word-motion/*.txt
${{ runner.temp }}/vimcode-negative-${{ matrix.host }}/word-motion/failure.json
${{ runner.temp }}/vimcode-negative-${{ matrix.host }}/word-motion/failure.termctrl
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/receipt.json
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/cold-load/*.txt
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/cold-load/failure.json
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/cold-load/failure.termctrl
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/word-motion/*.txt
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/word-motion/failure.json
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/word-motion/failure.termctrl
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/quote-change/*.txt
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/quote-change/failure.json
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/quote-change/failure.termctrl
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/multiline-undo/*.txt
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/multiline-undo/failure.json
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/multiline-undo/failure.termctrl
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/answer-paste/*.txt
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/answer-paste/failure.json
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/answer-paste/failure.termctrl
${{ runner.temp }}/vimcode-e2e-${{ matrix.host }}/*/failure-status.json
if-no-files-found: warn
retention-days: 7