@@ -35,38 +35,21 @@ jobs:
3535 steps :
3636 - name : Checkout
3737 uses : actions/checkout@v4
38- - name : Build and run examples (Linux/macOS)
39- if : ${{ runner.os != 'Windows' }}
40- shell : bash
41- run : |
42- set -e
43- cd examples/c-tasks && ./build.sh
44- build/objectbox-examples-c-tasks "Buy raspberries"
45- build/objectbox-examples-c-tasks
46- cd ../c-tasks-lowlevel && ./build.sh
47- build/objectbox-examples-c-tasks-lowlevel "Buy blueberries"
48- build/objectbox-examples-c-tasks-lowlevel
49- cd ../tasks && ./build.sh
50- printf "new \"Buy apples\"\nls\nexit" | build/objectbox-examples-tasks
51- cd ../tasks-sync && ./build.sh || true
52- if [ -x build/objectbox-examples-tasks-sync ]; then printf "new \"Buy bananas\"\nls\nexit" | build/objectbox-examples-tasks-sync; fi
53- cd ../vectorsearch-cities && ./build.sh
54- printf "name berlin\nexit" | build/objectbox-examples-vectorsearch-cities
55- - name : Build and run examples (Windows)
56- if : ${{ runner.os == 'Windows' }}
38+ - name : Build and run examples
39+ # unified script for Linux/macOS/Windows
5740 shell : bash
5841 run : |
5942 set -e
6043
61- ensure_dlls_in_dir() {
62- local bindir="$1"
63- # Copy required DLLs next to the executable
44+ # Only needed on Windows runners: copy required DLL next to the executable
45+ copy_dll_to_dir() {
46+ local bin_dir="$1"
6447 local src
6548 for src in \
6649 build/_deps/objectbox-sync-download-src/lib/objectbox.dll \
6750 build/_deps/objectbox-download-src/lib/objectbox.dll; do
6851 if [ -f "$src" ]; then
69- cp -f "$src" "$bindir /"
52+ cp -f "$src" "$bin_dir /"
7053 return 0
7154 fi
7255 done
@@ -75,11 +58,18 @@ jobs:
7558
7659 find_bin() {
7760 local base="$1"
78- local cand
79- for cand in "build/$base" "build/Debug/$base.exe" "build/Release/$base.exe"; do
80- if [ -f "$cand" ]; then
81- ensure_dlls_in_dir "$(dirname "$cand")"
82- echo "$cand"
61+ local candidate
62+ local exe_file="$base"
63+ if [ "${RUNNER_OS:-}" == "Windows" ]; then
64+ exe_file="$base.exe"
65+ fi
66+
67+ for candidate in "build/$exe_file" "build/Debug/$exe_file" "build/Release/$exe_file"; do
68+ if [ -f "$candidate" ]; then
69+ if [ "${RUNNER_OS:-}" == "Windows" ]; then
70+ copy_dll_to_dir "$(dirname "$candidate")"
71+ fi
72+ echo "$candidate"
8373 return 0
8474 fi
8575 done
0 commit comments