Skip to content

Commit cd10ac0

Browse files
committed
fix android build and test
1 parent cfccaff commit cd10ac0

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,31 @@ permissions:
1010
jobs:
1111
build:
1212
runs-on: ${{ matrix.os }}
13-
name: build${{ matrix.skip-test != true && ' and test' || ''}} for ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }}
13+
name: ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} build${{ matrix.arch != 'arm64-v8a' && matrix.name != 'isim' && matrix.name != 'ios' && ' + test' || ''}}
1414
timeout-minutes: 20
1515
strategy:
1616
fail-fast: false
1717
matrix:
1818
include:
1919
- os: macos-latest
2020
name: isim
21-
skip-test: true
2221
make: PLATFORM=isim
2322
- os: macos-latest
2423
name: ios
25-
skip-test: true
2624
make: PLATFORM=ios
2725
- os: ubuntu-latest
2826
arch: arm64-v8a
2927
name: android
30-
skip-test: true
3128
make:
3229
PLATFORM=android
3330
CC=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang
3431
- os: ubuntu-latest
3532
arch: x86_64
3633
name: android
37-
skip-test: true
3834
make:
3935
PLATFORM=android
4036
CC=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android26-clang
37+
sqlite-amalgamation-zip: https://sqlite.org/2025/sqlite-amalgamation-3490100.zip
4138
- os: ubuntu-latest
4239
arch: x86_64
4340
name: linux
@@ -71,8 +68,46 @@ jobs:
7168
if: matrix.name == 'macos'
7269
run: brew link sqlite --force
7370

71+
- name: android setup test environment
72+
if: matrix.name == 'android' && matrix.arch != 'arm64-v8a'
73+
run: |
74+
75+
echo "::group::enable kvm group perms"
76+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
77+
sudo udevadm control --reload-rules
78+
sudo udevadm trigger --name-match=kvm
79+
echo "::endgroup::"
80+
81+
echo "::group::download and build sqlite3 without SQLITE_OMIT_LOAD_EXTENSION"
82+
curl -O ${{ matrix.sqlite-amalgamation-zip }}
83+
unzip sqlite-amalgamation-*.zip
84+
export ${{ matrix.make }}
85+
$CC sqlite-amalgamation-*/shell.c sqlite-amalgamation-*/sqlite3.c -o sqlite3 -ldl
86+
rm -rf sqlite-amalgamation-*.zip sqlite-amalgamation-*
87+
echo "::endgroup::"
88+
89+
echo "::group::prepare the test script"
90+
cat > commands.sh << EOF
91+
mv -f /data/local/tmp/sqlite3 /system/xbin
92+
cd /data/local/tmp
93+
$(make test -n)
94+
EOF
95+
echo "::endgroup::"
96+
97+
- name: android test sqlite-js
98+
if: matrix.name == 'android' && matrix.arch != 'arm64-v8a'
99+
uses: reactivecircus/[email protected]
100+
with:
101+
api-level: 26
102+
arch: ${{ matrix.arch }}
103+
script: |
104+
adb root
105+
adb remount
106+
adb push ${{ github.workspace }}/. /data/local/tmp/
107+
adb shell "sh /data/local/tmp/commands.sh"
108+
74109
- name: test sqlite-js
75-
if: matrix.skip-test != true
110+
if: matrix.name == 'linux' || matrix.name == 'macos' || matrix.name == 'windows'
76111
run: make test
77112

78113
- uses: actions/[email protected]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ else ifeq ($(PLATFORM),android)
4949
$(error "CC must be set to the Android NDK's Clang compiler")
5050
endif
5151
TARGET := $(DIST_DIR)/js.so
52-
LDFLAGS := -shared
52+
LDFLAGS := -shared -lm
5353
# Android-specific flags
5454
CFLAGS += -D__ANDROID__
5555
else ifeq ($(PLATFORM),ios)

0 commit comments

Comments
 (0)