@@ -35,32 +35,16 @@ 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() {
44+ # Only needed on Windows runners: copy required DLL next to the executable
45+ ensure_dll_in_dir() {
6246 local bindir="$1"
63- # Copy required DLLs next to the executable
47+ # (strict)
6448 local src
6549 for src in \
6650 build/_deps/objectbox-sync-download-src/lib/objectbox.dll \
@@ -75,11 +59,18 @@ jobs:
7559
7660 find_bin() {
7761 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"
62+ local candidate
63+ local exe_file="$base"
64+ if [ "${RUNNER_OS:-}" == "Windows" ]; then;
65+ exe_file="$base.exe"
66+ fi
67+
68+ for candidate in "build/$exe_file" "build/Debug/$exe_file" "build/Release/$exe_file"; do
69+ if [ -f "$candidate" ]; then
70+ if [ "${RUNNER_OS:-}" == "Windows" ]; then;
71+ ensure_dll_in_dir "$(dirname "$candidate")"
72+ fi
73+ echo "$candidate"
8374 return 0
8475 fi
8576 done
0 commit comments