Skip to content

Commit 22f301c

Browse files
committed
Add GitHub Actions
1 parent 29d69bf commit 22f301c

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -58,62 +58,60 @@ jobs:
5858
run: |
5959
set -e
6060
61-
find_bin() {
62-
local base="$1"
63-
for cand in "build/$base" "build/Debug/$base.exe" "build/Release/$base.exe"; do
64-
if [ -f "$cand" ]; then
65-
echo "$cand"
61+
ensure_dlls_in_dir() {
62+
local bindir="$1"
63+
# Copy required DLLs next to the executable
64+
local src
65+
for src in \
66+
build/_deps/objectbox-sync-download-src/lib/objectbox.dll \
67+
build/_deps/objectbox-download-src/lib/objectbox.dll; do
68+
if [ -f "$src" ]; then
69+
echo "Copying DLL: $src -> $bindir/"
70+
cp -f "$src" "$bindir/"
6671
return 0
6772
fi
6873
done
74+
echo "DLL not found" >&2
6975
return 1
7076
}
7177
72-
ensure_dll() {
73-
local bindir="$1"
74-
for dll_src in \
75-
"build/_deps/objectbox-sync-download-src/lib/objectbox.dll" \
76-
"build/_deps/objectbox-download-src/lib/objectbox.dll"; do
77-
if [ -f "$dll_src" ]; then
78-
echo "Copying DLL: $dll_src to $bindir/"
79-
cp -f "$dll_src" "$bindir/"
78+
find_bin() {
79+
local base="$1"
80+
local cand
81+
for cand in "build/$base" "build/Debug/$base.exe" "build/Release/$base.exe"; do
82+
if [ -f "$cand" ]; then
83+
ensure_dlls_in_dir "$(dirname "$cand")"
84+
echo "$cand"
8085
return 0
8186
fi
8287
done
83-
echo "Warning: DLL not found"
88+
echo "Executable not found: $base" >&2
8489
return 1
8590
}
8691
8792
# c-tasks example
8893
cd examples/c-tasks && ./build.sh
8994
bin=$(find_bin objectbox-examples-c-tasks)
90-
ensure_dll "$(dirname "$bin")"
9195
"$bin" "Buy raspberries"
9296
"$bin"
9397
9498
# c-tasks-lowlevel example
9599
cd ../c-tasks-lowlevel && ./build.sh
96100
bin=$(find_bin objectbox-examples-c-tasks-lowlevel)
97-
ensure_dll "$(dirname "$bin")"
98101
"$bin" "Buy blueberries"
99102
"$bin"
100103
101104
# tasks example
102105
cd ../tasks && ./build.sh
103106
bin=$(find_bin objectbox-examples-tasks)
104-
ensure_dll "$(dirname "$bin")"
105-
printf "new \"Buy apples\"\r\nls\r\nexit\r\n" | "$bin"
107+
printf "new \"Buy apples\"\nls\nexit\n" | "$bin"
106108
107-
# tasks-sync example (may fail to build without sync feature)
108-
cd ../tasks-sync && ./build.sh || true
109-
if bin=$(find_bin objectbox-examples-tasks-sync); then
110-
ensure_dll "$(dirname "$bin")"
111-
printf "new \"Buy bananas\"\r\nls\r\nexit\r\n" | "$bin" || echo "tasks-sync failed; continuing"
112-
fi
109+
# tasks-sync example
110+
cd ../tasks-sync && ./build.sh
111+
bin=$(find_bin objectbox-examples-tasks-sync)
112+
printf "new \"Buy bananas\"\nls\nexit\n" | "$bin"
113113
114-
# vectorsearch-cities example (may fail without vector search feature)
114+
# vectorsearch-cities example
115115
cd ../vectorsearch-cities && ./build.sh
116-
if bin=$(find_bin objectbox-examples-vectorsearch-cities); then
117-
ensure_dll "$(dirname "$bin")"
118-
echo -e "name berlin\nexit" | "$bin" || echo "vectorsearch-cities returned non-zero (likely missing feature); continuing"
119-
fi
116+
bin=$(find_bin objectbox-examples-vectorsearch-cities)
117+
printf "name berlin\nexit\n" | "$bin"

0 commit comments

Comments
 (0)