Skip to content

Commit 7c696b7

Browse files
committed
test: add release validation test workflow and fix release workflow validation
1 parent 7f2e2bf commit 7c696b7

File tree

2 files changed

+308
-9
lines changed

2 files changed

+308
-9
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -351,19 +351,33 @@ jobs:
351351
run: |
352352
echo "🔍 Validating Linux artifacts..."
353353
354-
# Check DEB files
355-
DEB_FILES=$(find src-tauri/target/release/bundle/deb -type f -name "*.deb")
356-
if [ -z "$DEB_FILES" ]; then
357-
echo "❌ Error: No DEB files found"
354+
# Debug: Show what find actually returns
355+
echo "📋 Searching for DEB files..."
356+
find src-tauri/target/release/bundle/deb -type f -name "*.deb" -print || {
357+
echo "❌ Error running find command"
358358
echo "Contents of bundle directory:"
359359
ls -laR src-tauri/target/release/bundle/ || true
360360
exit 1
361+
}
362+
363+
# Check DEB files using a more robust approach
364+
cd src-tauri/target/release/bundle/deb
365+
shopt -s nullglob
366+
DEB_FILES=(*.deb)
367+
368+
if [ ${#DEB_FILES[@]} -eq 0 ]; then
369+
echo "❌ Error: No DEB files found"
370+
echo "Contents of deb directory:"
371+
ls -laR . || true
372+
exit 1
361373
fi
362374
363-
for deb in $DEB_FILES; do
375+
echo "📦 Found ${#DEB_FILES[@]} DEB file(s)"
376+
377+
for deb in "${DEB_FILES[@]}"; do
364378
FILE_SIZE=$(stat -c%s "$deb")
365379
SIZE_MB=$(awk "BEGIN {printf \"%.2f\", $FILE_SIZE/1048576}")
366-
echo "✅ $(basename "$deb"): ${SIZE_MB} MB"
380+
echo "✅ $deb: ${SIZE_MB} MB"
367381
368382
if [ "$FILE_SIZE" -lt 1048576 ]; then
369383
echo "❌ Error: DEB file is suspiciously small ($FILE_SIZE bytes)"
@@ -372,11 +386,12 @@ jobs:
372386
done
373387
374388
# Check checksum file
375-
CHECKSUM_FILE="src-tauri/target/release/bundle/checksums-linux.txt"
389+
cd ../..
390+
CHECKSUM_FILE="checksums-linux.txt"
376391
if [ ! -f "$CHECKSUM_FILE" ]; then
377-
echo "❌ Error: Checksum file not found at: $CHECKSUM_FILE"
392+
echo "❌ Error: Checksum file not found at: $(pwd)/$CHECKSUM_FILE"
378393
echo "Contents of bundle directory:"
379-
ls -laR src-tauri/target/release/bundle/ || true
394+
ls -la . || true
380395
exit 1
381396
fi
382397
Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
name: Test Release Validation
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- test-release-*
8+
9+
jobs:
10+
test-linux-validation:
11+
runs-on: ubicloud-standard-8
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v5
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v5
19+
with:
20+
node-version: '20'
21+
cache: 'npm'
22+
23+
- name: Setup Rust
24+
uses: dtolnay/rust-toolchain@stable
25+
26+
- name: Install system dependencies
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y \
30+
libgtk-3-dev \
31+
libwebkit2gtk-4.1-dev \
32+
libappindicator3-dev \
33+
librsvg2-dev \
34+
patchelf
35+
36+
- name: Install dependencies
37+
run: npm ci
38+
39+
- name: Build Tauri app
40+
run: npm run tauri build
41+
42+
- name: Generate checksums
43+
run: |
44+
cd src-tauri/target/release/bundle/deb
45+
46+
# Verify DEB files exist
47+
if ! ls *.deb 1> /dev/null 2>&1; then
48+
echo "❌ Error: No DEB files found for checksum generation"
49+
exit 1
50+
fi
51+
52+
echo "📦 Generating checksums..."
53+
shasum -a 256 *.deb > ../checksums-linux.txt
54+
55+
# Verify checksum file was created and is not empty
56+
if [ ! -s ../checksums-linux.txt ]; then
57+
echo "❌ Error: Checksum file is empty or was not created"
58+
exit 1
59+
fi
60+
61+
echo "✅ Checksums generated:"
62+
cat ../checksums-linux.txt
63+
64+
- name: Validate Linux artifacts
65+
run: |
66+
echo "🔍 Validating Linux artifacts..."
67+
68+
# Debug: Show what find actually returns
69+
echo "📋 Searching for DEB files..."
70+
find src-tauri/target/release/bundle/deb -type f -name "*.deb" -print || {
71+
echo "❌ Error running find command"
72+
echo "Contents of bundle directory:"
73+
ls -laR src-tauri/target/release/bundle/ || true
74+
exit 1
75+
}
76+
77+
# Check DEB files using a more robust approach
78+
cd src-tauri/target/release/bundle/deb
79+
shopt -s nullglob
80+
DEB_FILES=(*.deb)
81+
82+
if [ ${#DEB_FILES[@]} -eq 0 ]; then
83+
echo "❌ Error: No DEB files found"
84+
echo "Contents of deb directory:"
85+
ls -laR . || true
86+
exit 1
87+
fi
88+
89+
echo "📦 Found ${#DEB_FILES[@]} DEB file(s)"
90+
91+
for deb in "${DEB_FILES[@]}"; do
92+
FILE_SIZE=$(stat -c%s "$deb")
93+
SIZE_MB=$(awk "BEGIN {printf \"%.2f\", $FILE_SIZE/1048576}")
94+
echo "✅ $deb: ${SIZE_MB} MB"
95+
96+
if [ "$FILE_SIZE" -lt 1048576 ]; then
97+
echo "❌ Error: DEB file is suspiciously small ($FILE_SIZE bytes)"
98+
exit 1
99+
fi
100+
done
101+
102+
# Check checksum file
103+
cd ../..
104+
CHECKSUM_FILE="checksums-linux.txt"
105+
if [ ! -f "$CHECKSUM_FILE" ]; then
106+
echo "❌ Error: Checksum file not found at: $(pwd)/$CHECKSUM_FILE"
107+
echo "Contents of bundle directory:"
108+
ls -la . || true
109+
exit 1
110+
fi
111+
112+
CHECKSUM_SIZE=$(stat -c%s "$CHECKSUM_FILE")
113+
if [ "$CHECKSUM_SIZE" -eq 0 ]; then
114+
echo "❌ Error: Checksum file is empty"
115+
exit 1
116+
fi
117+
118+
echo "✅ Checksum file: $CHECKSUM_SIZE bytes"
119+
echo "✅ All Linux artifact validations passed!"
120+
121+
- name: Test artifact upload structure
122+
uses: actions/upload-artifact@v4
123+
with:
124+
name: test-linux-packages
125+
path: |
126+
src-tauri/target/release/bundle/deb/*.deb
127+
src-tauri/target/release/bundle/checksums-linux.txt
128+
129+
- name: Show final structure
130+
run: |
131+
echo "📁 Final bundle structure:"
132+
ls -laR src-tauri/target/release/bundle/
133+
134+
test-windows-validation:
135+
runs-on: windows-2022-16-cores
136+
137+
steps:
138+
- name: Checkout code
139+
uses: actions/checkout@v5
140+
141+
- name: Setup Node.js
142+
uses: actions/setup-node@v5
143+
with:
144+
node-version: '20'
145+
cache: 'npm'
146+
147+
- name: Setup Rust
148+
uses: dtolnay/rust-toolchain@stable
149+
150+
- name: Install dependencies
151+
run: npm ci
152+
153+
- name: Build Tauri app
154+
run: npm run tauri build
155+
156+
- name: Generate checksums
157+
shell: pwsh
158+
run: |
159+
cd src-tauri/target/release/bundle/msi
160+
161+
# Verify MSI files exist
162+
$msiFiles = Get-ChildItem -Filter *.msi
163+
if ($msiFiles.Count -eq 0) {
164+
Write-Host "❌ Error: No MSI files found for checksum generation"
165+
exit 1
166+
}
167+
168+
Write-Host "📦 Found $($msiFiles.Count) MSI file(s)"
169+
170+
# Generate checksums
171+
$msiFiles | ForEach-Object {
172+
$hash = Get-FileHash $_.FullName -Algorithm SHA256
173+
"$($hash.Hash) $($_.Name)"
174+
} | Out-File -FilePath ..\checksums-windows.txt -Encoding UTF8
175+
176+
# Verify checksum file was created and is not empty
177+
$checksumFile = "..\checksums-windows.txt"
178+
if (-not (Test-Path $checksumFile)) {
179+
Write-Host "❌ Error: Checksum file was not created"
180+
exit 1
181+
}
182+
183+
$fileSize = (Get-Item $checksumFile).Length
184+
if ($fileSize -eq 0) {
185+
Write-Host "❌ Error: Checksum file is empty"
186+
exit 1
187+
}
188+
189+
Write-Host "✅ Checksums generated ($fileSize bytes):"
190+
Get-Content $checksumFile
191+
192+
- name: Validate Windows artifacts
193+
shell: pwsh
194+
run: |
195+
$msiPath = "src-tauri/target/release/bundle/msi"
196+
$checksumPath = "src-tauri/target/release/bundle/checksums-windows.txt"
197+
198+
Write-Host "🔍 Validating Windows artifacts..."
199+
200+
# Check MSI files
201+
$msiFiles = Get-ChildItem -Path $msiPath -Filter *.msi
202+
if ($msiFiles.Count -eq 0) {
203+
Write-Host "❌ Error: No MSI files found"
204+
exit 1
205+
}
206+
207+
foreach ($msi in $msiFiles) {
208+
$sizeMB = [math]::Round($msi.Length / 1MB, 2)
209+
Write-Host "✅ $($msi.Name): $sizeMB MB"
210+
211+
if ($msi.Length -lt 1MB) {
212+
Write-Host "❌ Error: MSI file is suspiciously small"
213+
exit 1
214+
}
215+
}
216+
217+
# Check checksum file
218+
if (-not (Test-Path $checksumPath)) {
219+
Write-Host "❌ Error: Checksum file not found"
220+
exit 1
221+
}
222+
223+
$checksumSize = (Get-Item $checksumPath).Length
224+
if ($checksumSize -eq 0) {
225+
Write-Host "❌ Error: Checksum file is empty"
226+
exit 1
227+
}
228+
229+
Write-Host "✅ Checksum file: $checksumSize bytes"
230+
Write-Host "✅ All Windows artifact validations passed!"
231+
232+
- name: Test artifact upload structure
233+
uses: actions/upload-artifact@v4
234+
with:
235+
name: test-windows-installers
236+
path: |
237+
src-tauri/target/release/bundle/msi/*.msi
238+
src-tauri/target/release/bundle/checksums-windows.txt
239+
240+
- name: Show final structure
241+
shell: pwsh
242+
run: |
243+
Write-Host "📁 Final bundle structure:"
244+
Get-ChildItem -Recurse src-tauri/target/release/bundle/
245+
246+
test-artifact-download:
247+
needs: [test-linux-validation, test-windows-validation]
248+
runs-on: ubicloud-standard-8
249+
250+
steps:
251+
- name: Download all test artifacts
252+
uses: actions/download-artifact@v4
253+
with:
254+
path: test-artifacts
255+
256+
- name: Display artifact structure
257+
run: |
258+
echo "📦 Downloaded artifact structure:"
259+
ls -laR test-artifacts/
260+
261+
- name: Verify artifact paths match release workflow expectations
262+
run: |
263+
echo "🔍 Verifying paths..."
264+
265+
# Check Linux artifacts
266+
if [ -d "test-artifacts/test-linux-packages/deb" ]; then
267+
echo "✅ Linux: artifacts/linux-packages/deb/*.deb path exists"
268+
ls -la test-artifacts/test-linux-packages/deb/*.deb || echo "⚠️ No .deb files in subdirectory"
269+
else
270+
echo "📋 Linux artifacts are at root level (not in deb/ subdirectory)"
271+
ls -la test-artifacts/test-linux-packages/*.deb || echo "⚠️ No .deb files"
272+
fi
273+
274+
# Check Windows artifacts
275+
if [ -d "test-artifacts/test-windows-installers/msi" ]; then
276+
echo "✅ Windows: artifacts/windows-installers/msi/*.msi path exists"
277+
ls -la test-artifacts/test-windows-installers/msi/*.msi || echo "⚠️ No .msi files in subdirectory"
278+
else
279+
echo "📋 Windows artifacts are at root level (not in msi/ subdirectory)"
280+
ls -la test-artifacts/test-windows-installers/*.msi || echo "⚠️ No .msi files"
281+
fi
282+
283+
echo ""
284+
echo "💡 Use these paths in the release workflow files: section"

0 commit comments

Comments
 (0)