-
Notifications
You must be signed in to change notification settings - Fork 44
306 lines (280 loc) · 9.46 KB
/
test-install.yml
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
---
name: Installation Test
on:
release:
types: [published]
workflow_dispatch: {}
jobs:
test-unix-install:
name: Test Unix Installation
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Clean existing tags
shell: bash
run: |
if [ -d ".git/refs/tags" ]; then
rm -rf .git/refs/tags/
fi
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get install script
id: get_linux_install_script
shell: bash
run: |
script=$(awk '/<!-- LINUX_INSTALLATION_BEGIN -->/{p=1;next}/<!-- LINUX_INSTALLATION_END -->/{p=0}p' README.md | grep -v '^```')
# Ensure script is not empty
if [ -z "$script" ]; then
echo "Error: Could not extract Linux installation script from README.md"
exit 1
fi
# Escape multiline output
script="${script//'%'/'%25'}"
script="${script//$'\n'/'%0A'}"
script="${script//$'\r'/'%0D'}"
echo "script=$script" >> $GITHUB_OUTPUT
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build yek
shell: bash
run: |
cargo build --release --target ${{ matrix.target }} --locked
# Verify binary exists
binary="target/${{ matrix.target }}/release/yek"
if [ ! -f "$binary" ]; then
echo "Error: Binary not found at: $binary"
find target -name "yek" -o -name "yek.exe"
exit 1
fi
ls -l "$binary"
- name: Setup test environment
shell: bash
run: |
# Create test directory
sudo mkdir -p /usr/local/bin
# Copy binary
sudo cp "target/${{ matrix.target }}/release/yek" /usr/local/bin/
# Make executable
sudo chmod +x /usr/local/bin/yek
# Verify binary is executable
if ! which yek; then
echo "Error: yek not found in PATH after manual installation"
echo "PATH: $PATH"
exit 1
fi
- name: Test installation script
run: ${{ steps.get_linux_install_script.outputs.script }}
- name: Verify installation
run: |
# Ensure yek is in PATH
which yek || {
echo "Error: yek not found in PATH"
echo "PATH: $PATH"
exit 1
}
# Test version output
yek --version || {
echo "Error: yek --version failed"
exit 1
}
# Create test file
echo "test content" > test.txt
# Test basic functionality
yek test.txt || {
echo "Error: yek failed to process test file"
exit 1
}
# Verify output exists
test -f repo-serialized/chunk-0.txt || {
echo "Error: Output file not found"
ls -la repo-serialized/ || true
exit 1
}
test-windows-install:
name: Test Windows Installation
runs-on: windows-latest
steps:
- name: Clean existing tags
shell: bash
run: |
if [ -d ".git/refs/tags" ]; then
rm -rf .git/refs/tags/
fi
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get install script
id: get_windows_install_script
shell: bash
run: |
script=$(awk '/<!-- WINDOWS_INSTALLATION_BEGIN -->/{p=1;next}/<!-- WINDOWS_INSTALLATION_END -->/{p=0}p' README.md | grep -v '^```')
# Ensure script is not empty
if [ -z "$script" ]; then
echo "Error: Could not extract Windows installation script from README.md"
exit 1
fi
# Escape multiline output
script="${script//'%'/'%25'}"
script="${script//$'\n'/'%0A'}"
script="${script//$'\r'/'%0D'}"
echo "script=$script" >> $GITHUB_OUTPUT
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Build yek
shell: powershell
run: |
cargo build --release --target x86_64-pc-windows-msvc --locked
# Verify binary exists
$binary = "target\x86_64-pc-windows-msvc\release\yek.exe"
if (-not (Test-Path $binary)) {
Write-Error "Binary not found at: $binary"
Get-ChildItem target -Recurse | Where-Object { $_.Name -like "yek.exe" }
exit 1
}
Write-Host "Binary size: $((Get-Item $binary).Length) bytes"
- name: Setup test environment
shell: powershell
run: |
# Create test directory
New-Item -ItemType Directory -Path "$env:USERPROFILE\.local\bin" -Force
# Add to PATH
$env:Path = "$env:USERPROFILE\.local\bin;" + $env:Path
# Copy binary
Copy-Item "target\x86_64-pc-windows-msvc\release\yek.exe" "$env:USERPROFILE\.local\bin\yek.exe"
# Verify binary is executable
if (-not (Get-Command yek -ErrorAction SilentlyContinue)) {
Write-Error "yek not found in PATH after manual installation"
Write-Host "PATH: $env:Path"
exit 1
}
- name: Test installation script
shell: powershell
run: ${{ steps.get_windows_install_script.outputs.script }}
- name: Verify installation
shell: powershell
run: |
# Ensure yek is in PATH
if (-not (Get-Command yek -ErrorAction SilentlyContinue)) {
Write-Error "yek not found in PATH"
Write-Host "PATH: $env:PATH"
exit 1
}
# Test version output
$version = yek --version
if (-not $?) {
Write-Error "yek --version failed"
exit 1
}
Write-Host "Version: $version"
# Create test file
"test content" | Out-File -FilePath test.txt -Encoding utf8
# Test basic functionality
yek test.txt
if (-not $?) {
Write-Error "yek failed to process test file"
exit 1
}
# Verify output exists
if (-not (Test-Path repo-serialized/chunk-0.txt)) {
Write-Error "Output file not found"
Get-ChildItem repo-serialized -ErrorAction SilentlyContinue
exit 1
}
test-install-script:
name: Test Install Script
runs-on: ubuntu-latest
steps:
- name: Clean existing tags
shell: bash
run: |
if [ -d ".git/refs/tags" ]; then
rm -rf .git/refs/tags/
fi
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get install script
id: get_install_script
shell: bash
run: |
script=$(awk '/<!-- INSTALLATION_SCRIPT_BEGIN -->/{p=1;next}/<!-- INSTALLATION_SCRIPT_END -->/{p=0}p' README.md | grep -v '^```')
# Ensure script is not empty
if [ -z "$script" ]; then
echo "Error: Could not extract installation script from README.md"
exit 1
fi
# Escape multiline output
script="${script//'%'/'%25'}"
script="${script//$'\n'/'%0A'}"
script="${script//$'\r'/'%0D'}"
echo "script=$script" >> $GITHUB_OUTPUT
- name: Test installation script
run: ${{ steps.get_install_script.outputs.script }}
test-cargo-installation:
name: Test Cargo Installation
runs-on: ubuntu-latest
steps:
- name: Clean existing tags
shell: bash
run: |
if [ -d ".git/refs/tags" ]; then
rm -rf .git/refs/tags/
fi
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get install script
id: get_cargo_install_script
shell: bash
run: |
script=$(awk '/<!-- CARGO_INSTALLATION_BEGIN -->/{p=1;next}/<!-- CARGO_INSTALLATION_END -->/{p=0}p' README.md | grep -v '^```')
# Ensure script is not empty
if [ -z "$script" ]; then
echo "Error: Could not extract Cargo installation script from README.md"
exit 1
fi
# Escape multiline output
script="${script//'%'/'%25'}"
script="${script//$'\n'/'%0A'}"
script="${script//$'\r'/'%0D'}"
echo "script=$script" >> $GITHUB_OUTPUT
- name: Install via Cargo
run: ${{ steps.get_cargo_install_script.outputs.script }}
- name: Verify installation
run: |
# Ensure yek is in PATH
which yek || {
echo "Error: yek not found in PATH"
echo "PATH: $PATH"
exit 1
}
# Test version output
yek --version || {
echo "Error: yek --version failed"
exit 1
}
# Create test file
echo "test content" > test.txt
# Test basic functionality
yek test.txt || {
echo "Error: yek failed to process test file"
exit 1
}
# Verify output exists
test -f repo-serialized/chunk-0.txt || {
echo "Error: Output file not found"
ls -la repo-serialized/ || true
exit 1
}