Skip to content

Commit 981627b

Browse files
committed
Refactor Android testing steps in CI workflow to build and execute unit tests
1 parent bc0ae1f commit 981627b

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,8 @@ jobs:
374374
rm -rf sqlite-amalgamation-*.zip sqlite-amalgamation-*
375375
echo "::endgroup::"
376376
377-
echo "::group::prepare the test script"
378-
make test PLATFORM=$PLATFORM ARCH=$ARCH || echo "It should fail. Running remaining commands in the emulator"
379-
cat > commands.sh << EOF
380-
mv -f /data/local/tmp/sqlite3 /system/xbin
381-
cd /data/local/tmp
382-
$(make test PLATFORM=$PLATFORM ARCH=$ARCH -n)
383-
EOF
377+
echo "::group::build unittest binary for android"
378+
make build/unittest ${{ matrix.make }}
384379
echo "::endgroup::"
385380
386381
- name: android test sqlite-memory
@@ -390,13 +385,19 @@ jobs:
390385
api-level: 26
391386
arch: ${{ matrix.arch }}
392387
script: |
388+
set -e
393389
adb root
394390
adb remount
395-
adb push ${{ github.workspace }}/commands.sh /data/local/tmp/
396391
adb push ${{ github.workspace }}/sqlite3 /data/local/tmp/
397-
adb push ${{ github.workspace }}/dist /data/local/tmp/
398-
adb push ${{ github.workspace }}/Makefile /data/local/tmp/
399-
adb shell "sh /data/local/tmp/commands.sh"
392+
adb shell "mv -f /data/local/tmp/sqlite3 /system/xbin/"
393+
adb push ${{ github.workspace }}/dist/memory.so /data/local/tmp/
394+
adb push ${{ github.workspace }}/build/unittest /data/local/tmp/
395+
adb shell "chmod +x /data/local/tmp/unittest"
396+
echo "Running unit tests..."
397+
adb shell "/data/local/tmp/unittest"
398+
echo "Testing extension loading..."
399+
adb shell "sqlite3 :memory: '.load /data/local/tmp/memory.so' 'SELECT memory_version();'"
400+
echo "Extension loading test passed!"
400401
401402
- name: unix test sqlite-memory
402403
if: matrix.skip_test != true && matrix.os != 'windows-2022' && matrix.name != 'android'

0 commit comments

Comments
 (0)