Skip to content

Commit 06f2bbc

Browse files
authored
Merge pull request #111 from aaravlu/fix109
Embed CLI into editor packages and update tests
2 parents a4ef128 + d39a6ed commit 06f2bbc

File tree

4 files changed

+65
-74
lines changed

4 files changed

+65
-74
lines changed

.github/workflows/test-integration.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
- name: Verify release files
111111
run: |
112112
# Check that all expected files exist
113-
EXPECTED_FILES=("cli.exe" "cli.zip" "zed.exe" "zed.zip" "zed-opengl.exe" "zed-opengl.zip" "sha256sums.txt")
113+
EXPECTED_FILES=("zed.zip" "zed-opengl.zip" "sha256sums.txt")
114114
115115
for file in "${EXPECTED_FILES[@]}"; do
116116
if [ ! -f "release/$file" ]; then
@@ -135,22 +135,18 @@ jobs:
135135
strategy:
136136
matrix:
137137
scenario:
138-
- name: "cli-only"
139-
create_dx11: false
140-
create_opengl: false
141-
expected_files: 3
142138
- name: "dx11-only"
143139
create_dx11: true
144140
create_opengl: false
145-
expected_files: 5
141+
expected_files: 2
146142
- name: "opengl-only"
147143
create_dx11: false
148144
create_opengl: true
149-
expected_files: 5
145+
expected_files: 2
150146
- name: "both-builds"
151147
create_dx11: true
152148
create_opengl: true
153-
expected_files: 7
149+
expected_files: 3
154150

155151
steps:
156152
- name: Checkout repository

.github/workflows/test.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,33 +52,11 @@ jobs:
5252
# Run the script
5353
./scripts/prepare-release.sh
5454
55-
# Verify outputs
56-
if [ ! -f "release/cli.exe" ]; then
57-
echo "❌ FAIL: Missing cli.exe"
58-
exit 1
59-
fi
60-
61-
if [ ! -f "release/cli.zip" ]; then
62-
echo "❌ FAIL: Missing cli.zip"
63-
exit 1
64-
fi
65-
66-
if [ ! -f "release/zed.exe" ]; then
67-
echo "❌ FAIL: Missing zed.exe"
68-
exit 1
69-
fi
70-
7155
if [ ! -f "release/zed.zip" ]; then
7256
echo "❌ FAIL: Missing zed.zip"
7357
exit 1
7458
fi
7559
76-
if [ ! -f "release/zed-opengl.exe" ]; then
77-
echo "❌ FAIL: Missing zed-opengl.exe"
78-
exit 1
79-
fi
80-
81-
8260
if [ ! -f "release/zed-opengl.zip" ]; then
8361
echo "❌ FAIL: Missing zed-opengl.zip"
8462
exit 1

scripts/prepare-release.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,33 @@ mkdir -p "$RELEASE_DIR"
1414
# Check if CLI build exists
1515
if [ -f "$ARTIFACTS_DIR/cli-release/cli.exe" ]; then
1616
echo "Found CLI build, adding to release..."
17-
mv "$ARTIFACTS_DIR/cli-release/cli.exe" "$RELEASE_DIR/cli.exe"
18-
zip -j "$RELEASE_DIR/cli.zip" -9 "$RELEASE_DIR/cli.exe"
17+
mv "$ARTIFACTS_DIR/cli-release/cli.exe" "$ARTIFACTS_DIR/cli-release/zed.exe"
1918
fi
2019

2120
# Check if DX11 build exists
2221
if [ -f "$ARTIFACTS_DIR/editor-dx11-release/zed.exe" ]; then
2322
echo "Found DX11 build, adding to release..."
24-
mv "$ARTIFACTS_DIR/editor-dx11-release/zed.exe" "$RELEASE_DIR/zed.exe"
25-
zip -j "$RELEASE_DIR/zed.zip" -9 "$RELEASE_DIR/zed.exe"
23+
24+
mkdir -p "$ARTIFACTS_DIR/editor-dx11-release/zed/bin"
25+
mv "$ARTIFACTS_DIR/editor-dx11-release/zed.exe" "$ARTIFACTS_DIR/editor-dx11-release/zed"
26+
cp "$ARTIFACTS_DIR/cli-release/zed.exe" "$ARTIFACTS_DIR/editor-dx11-release/zed/bin"
27+
28+
cd "$ARTIFACTS_DIR/editor-dx11-release"
29+
zip -r "../../$RELEASE_DIR/zed.zip" -9 "zed/"
30+
cd -
2631
fi
2732

2833
# Check if OpenGL build exists
2934
if [ -f "$ARTIFACTS_DIR/editor-opengl-release/zed.exe" ]; then
3035
echo "Found OpenGL build, adding to release..."
31-
mv "$ARTIFACTS_DIR/editor-opengl-release/zed.exe" "$RELEASE_DIR/zed-opengl.exe"
32-
zip -j "$RELEASE_DIR/zed-opengl.zip" -9 "$RELEASE_DIR/zed-opengl.exe"
36+
37+
mkdir -p "$ARTIFACTS_DIR/editor-opengl-release/zed/bin"
38+
mv "$ARTIFACTS_DIR/editor-opengl-release/zed.exe" "$ARTIFACTS_DIR/editor-opengl-release/zed"
39+
cp "$ARTIFACTS_DIR/cli-release/zed.exe" "$ARTIFACTS_DIR/editor-opengl-release/zed/bin"
40+
41+
cd "$ARTIFACTS_DIR/editor-opengl-release"
42+
zip -r "../../$RELEASE_DIR/zed-opengl.zip" -9 "zed/"
43+
cd -
3344
fi
3445

3546
# Generate checksums for existing files in release folder

scripts/test-prepare-release.sh

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ setup_test() {
2020
mkdir -p artifacts
2121
}
2222

23-
create_dx11_artifact() {
23+
create_fake_dx11_artifact() {
2424
mkdir -p artifacts/editor-dx11-release
2525
echo "fake dx11 executable" > artifacts/editor-dx11-release/zed.exe
2626
}
2727

28-
create_opengl_artifact() {
28+
create_fake_opengl_artifact() {
2929
mkdir -p artifacts/editor-opengl-release
3030
echo "fake opengl executable" > artifacts/editor-opengl-release/zed.exe
3131
}
3232

33-
create_cli_artifact() {
33+
create_fake_cli_artifact() {
3434
mkdir -p artifacts/cli-release
3535
echo "fake cli executable" > artifacts/cli-release/cli.exe
3636
}
@@ -74,48 +74,35 @@ run_test() {
7474
fi
7575
}
7676

77-
# Test 1: All three builds exist (CLI + DX11 + OpenGL)
77+
# Test 1: All three builds exist (DX11 + OpenGL)
7878
setup_test "All three builds exist"
79-
create_cli_artifact
80-
create_dx11_artifact
81-
create_opengl_artifact
79+
create_fake_cli_artifact
80+
create_fake_dx11_artifact
81+
create_fake_opengl_artifact
8282
run_test "success"
83-
verify_file_count 7 # cli.exe, cli.zip, zed.exe, zed.zip, zed-opengl.exe, zed-opengl.zip, sha256sums.txt
84-
verify_file_exists "release/cli.exe"
85-
verify_file_exists "release/cli.zip"
86-
verify_file_exists "release/zed.exe"
83+
verify_file_count 3
8784
verify_file_exists "release/zed.zip"
88-
verify_file_exists "release/zed-opengl.exe"
8985
verify_file_exists "release/zed-opengl.zip"
9086
verify_file_exists "release/sha256sums.txt"
9187

9288
# Test 2: Only DX11 build exists
9389
setup_test "Only DX11 build exists"
94-
create_dx11_artifact
90+
create_fake_cli_artifact
91+
create_fake_dx11_artifact
9592
run_test "success"
96-
verify_file_count 3 # zed.exe, zed.zip, sha256sums.txt
97-
verify_file_exists "release/zed.exe"
93+
verify_file_count 2
9894
verify_file_exists "release/zed.zip"
9995
verify_file_exists "release/sha256sums.txt"
10096

10197
# Test 3: Only OpenGL build exists
10298
setup_test "Only OpenGL build exists"
103-
create_opengl_artifact
99+
create_fake_cli_artifact
100+
create_fake_opengl_artifact
104101
run_test "success"
105-
verify_file_count 3 # zed-opengl.exe, zed-opengl.zip, sha256sums.txt
106-
verify_file_exists "release/zed-opengl.exe"
102+
verify_file_count 2
107103
verify_file_exists "release/zed-opengl.zip"
108104
verify_file_exists "release/sha256sums.txt"
109105

110-
# Test 3.5: Only CLI build exists
111-
setup_test "Only CLI build exists"
112-
create_cli_artifact
113-
run_test "success"
114-
verify_file_count 3 # cli.exe, cli.zip, sha256sums.txt
115-
verify_file_exists "release/cli.exe"
116-
verify_file_exists "release/cli.zip"
117-
verify_file_exists "release/sha256sums.txt"
118-
119106
# Test 4: No builds exist
120107
setup_test "No builds exist"
121108
run_test "failure"
@@ -129,9 +116,9 @@ echo "✅ No release files created when no builds exist"
129116

130117
# Test 5: Verify checksums are correct
131118
setup_test "Checksum verification"
132-
create_cli_artifact
133-
create_dx11_artifact
134-
create_opengl_artifact
119+
create_fake_cli_artifact
120+
create_fake_dx11_artifact
121+
create_fake_opengl_artifact
135122
run_test "success"
136123

137124
# Verify checksums
@@ -144,16 +131,35 @@ else
144131
fi
145132
cd ..
146133

147-
# Test 6: Verify zip files contain executables
148-
setup_test "Zip file content verification"
149-
create_dx11_artifact
150-
run_test "success"
134+
# Check GUI editor in `zed.zip`
135+
echo "Checking `zed.zip` structure"
136+
if unzip -l release/zed.zip | grep -q "^.*zed/zed.exe$" ;then
137+
echo "✅ GUI editor is in the correct location"
138+
else
139+
echo "❌ GUI editor missing or in wrong location"
140+
exit 1
141+
fi
142+
# Check CLI launcher in `zed.zip`
143+
if unzip -l release/zed.zip | grep -q "^.*zed/bin/zed.exe$"; then
144+
echo "✅ CLI launcher is in the correct location"
145+
else
146+
echo "❌ CLI launcher missing or in wrong location"
147+
exit 1
148+
fi
151149

152-
# Check zip content
153-
if unzip -l release/zed.zip | grep -q "zed.exe"; then
154-
echo "✅ Zip file contains executable"
150+
# Check GUI editor in `zed-opengl.zip`
151+
echo "Checking `zed-opengl.zip` structure"
152+
if unzip -l release/zed-opengl.zip | grep -q "^.*zed/zed.exe$"; then
153+
echo "✅ GUI editor is in the correct location"
154+
else
155+
echo "❌ GUI editor missing or in wrong location"
156+
exit 1
157+
fi
158+
# Check CLI launcher in `zed-opengl.zip`
159+
if unzip -l release/zed-opengl.zip | grep -q "^.*zed/bin/zed.exe$"; then
160+
echo "✅ CLI launcher is in the correct location"
155161
else
156-
echo "FAIL: Zip file does not contain executable"
162+
echo "CLI launcher missing or in wrong location"
157163
exit 1
158164
fi
159165

0 commit comments

Comments
 (0)