Skip to content

Commit bc54d50

Browse files
fix: improve binary file detection in CI workflow
1 parent 25ab4e4 commit bc54d50

File tree

1 file changed

+39
-13
lines changed

1 file changed

+39
-13
lines changed

.github/workflows/CI.yml

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,23 +179,49 @@ jobs:
179179
echo "Debug: Showing all downloaded artifacts:"
180180
find . -type f -name "*.node" -ls
181181
182-
echo "\nMoving binaries to their respective package directories:"
182+
echo "\nEnsuring binaries exist in their respective package directories:"
183183
184-
# Copy binaries to their package directories
185-
find . -name "cel-typescript.darwin-arm64.node" -exec cp {} libs/darwin-arm64/ \;
186-
find . -name "cel-typescript.darwin-x64.node" -exec cp {} libs/darwin-x64/ \;
187-
find . -name "cel-typescript.linux-x64-gnu.node" -exec cp {} libs/linux-x64-gnu/ \;
188-
find . -name "cel-typescript.linux-arm64-gnu.node" -exec cp {} libs/linux-arm64-gnu/ \;
189-
find . -name "cel-typescript.win32-x64-msvc.node" -exec cp {} libs/win32-x64-msvc/ \;
184+
# Make sure each package directory has exactly one binary
185+
# Copy only if not already present in the target directory
186+
if [ ! -f libs/darwin-arm64/cel-typescript.darwin-arm64.node ]; then
187+
find . -path "./libs/darwin-arm64" -prune -o -name "cel-typescript.darwin-arm64.node" -exec cp {} libs/darwin-arm64/ \;
188+
fi
189+
190+
if [ ! -f libs/darwin-x64/cel-typescript.darwin-x64.node ]; then
191+
find . -path "./libs/darwin-x64" -prune -o -name "cel-typescript.darwin-x64.node" -exec cp {} libs/darwin-x64/ \;
192+
fi
193+
194+
if [ ! -f libs/linux-x64-gnu/cel-typescript.linux-x64-gnu.node ]; then
195+
find . -path "./libs/linux-x64-gnu" -prune -o -name "cel-typescript.linux-x64-gnu.node" -exec cp {} libs/linux-x64-gnu/ \;
196+
fi
197+
198+
if [ ! -f libs/linux-arm64-gnu/cel-typescript.linux-arm64-gnu.node ]; then
199+
find . -path "./libs/linux-arm64-gnu" -prune -o -name "cel-typescript.linux-arm64-gnu.node" -exec cp {} libs/linux-arm64-gnu/ \;
200+
fi
201+
202+
if [ ! -f libs/win32-x64-msvc/cel-typescript.win32-x64-msvc.node ]; then
203+
find . -path "./libs/win32-x64-msvc" -prune -o -name "cel-typescript.win32-x64-msvc.node" -exec cp {} libs/win32-x64-msvc/ \;
204+
fi
190205
191-
# Count our binaries to ensure we have all of them
192-
node_count=$(find libs -name "cel-typescript.*.node" | wc -l)
193-
expected_count=5 # We target 5 platforms
206+
# Verify each package directory has exactly one binary
207+
darwin_arm64_count=$(find libs/darwin-arm64 -maxdepth 1 -name "cel-typescript.darwin-arm64.node" | wc -l)
208+
darwin_x64_count=$(find libs/darwin-x64 -maxdepth 1 -name "cel-typescript.darwin-x64.node" | wc -l)
209+
linux_x64_gnu_count=$(find libs/linux-x64-gnu -maxdepth 1 -name "cel-typescript.linux-x64-gnu.node" | wc -l)
210+
linux_arm64_gnu_count=$(find libs/linux-arm64-gnu -maxdepth 1 -name "cel-typescript.linux-arm64-gnu.node" | wc -l)
211+
win32_x64_msvc_count=$(find libs/win32-x64-msvc -maxdepth 1 -name "cel-typescript.win32-x64-msvc.node" | wc -l)
194212
195-
echo "\nFound $node_count cel-typescript binaries in package directories (expected $expected_count)"
213+
echo "\nVerifying binaries in package directories:"
214+
echo "darwin-arm64: $darwin_arm64_count"
215+
echo "darwin-x64: $darwin_x64_count"
216+
echo "linux-x64-gnu: $linux_x64_gnu_count"
217+
echo "linux-arm64-gnu: $linux_arm64_gnu_count"
218+
echo "win32-x64-msvc: $win32_x64_msvc_count"
196219
197-
if [ "$node_count" -ne "$expected_count" ]; then
198-
echo "Error: Expected $expected_count binaries but found $node_count"
220+
# Error if any platform is missing its binary
221+
if [ "$darwin_arm64_count" -ne 1 ] || [ "$darwin_x64_count" -ne 1 ] || \
222+
[ "$linux_x64_gnu_count" -ne 1 ] || [ "$linux_arm64_gnu_count" -ne 1 ] || \
223+
[ "$win32_x64_msvc_count" -ne 1 ]; then
224+
echo "Error: Each package directory should have exactly one binary"
199225
exit 1
200226
fi
201227

0 commit comments

Comments
 (0)