File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6464 fi
6565 echo "AAR contains binding classes and native libs"
6666
67+ # Acceptance test: drive the AAR's actual compiled binding classes over JNA
68+ # against a host-built libdoltlite (the Android-ABI .so's can't load on the
69+ # x86_64 runner, but the binding logic + C API are identical). Catches
70+ # runtime breakage the assembly/content guards can't.
71+ - name : Runtime acceptance test
72+ run : |
73+ sudo apt-get update -qq && sudo apt-get install -y -qq zlib1g-dev
74+ mkdir -p native out
75+ cc -O2 -fPIC -DNDEBUG -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1 \
76+ -DDOLTLITE_PROLLY=1 -DDOLTLITE_VERSION='"smoke"' \
77+ -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_DBSTAT_VTAB \
78+ -DSQLITE_HAVE_ZLIB=1 -Wno-comment \
79+ -shared doltlite/sqlite3.c -lz -o native/libdoltlite.so
80+ aar="$(find build/outputs/aar -name '*-release.aar' | head -1)"
81+ unzip -p "$aar" classes.jar > classes.jar
82+ curl -fsSL -o jna.jar https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar
83+ curl -fsSL -o kotlin-stdlib.jar https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/2.0.20/kotlin-stdlib-2.0.20.jar
84+ javac -cp classes.jar:jna.jar -d out scripts/RuntimeSmoke.java
85+ java -Djna.library.path="$PWD/native" -cp classes.jar:jna.jar:kotlin-stdlib.jar:out RuntimeSmoke
86+
6787 - name : Create release with the AAR
6888 if : github.event_name != 'workflow_dispatch'
6989 env :
Original file line number Diff line number Diff line change 1+ import com .dolthub .doltlite .Doltlite ;
2+ import java .util .List ;
3+
4+ /**
5+ * Runtime smoke for the doltlite-android binding: drives the real compiled
6+ * Doltlite/CDoltlite classes (extracted from the assembled AAR) over JNA against
7+ * a host-built libdoltlite, exercising open -> bind -> dolt_commit -> dolt_log.
8+ * The Android-ABI .so's can't load on the desktop CI runner, but the binding
9+ * logic and C-API calls are identical, so this guards the binding at runtime.
10+ */
11+ public class RuntimeSmoke {
12+ public static void main (String [] args ) {
13+ try (Doltlite db = new Doltlite (":memory:" )) {
14+ Object engine = db .query ("SELECT doltlite_engine()" ).get (0 ).get (0 );
15+ if (!"prolly" .equals (engine )) throw new RuntimeException ("engine=" + engine );
16+
17+ db .execute ("CREATE TABLE t(id INTEGER PRIMARY KEY, v TEXT)" );
18+ db .execute ("INSERT INTO t(v) VALUES (?)" , "a" );
19+
20+ String hash = db .doltCommit ("c1" , true );
21+ if (hash == null || hash .isEmpty ()) throw new RuntimeException ("no commit hash" );
22+
23+ long commits = (Long ) db .query ("SELECT count(*) FROM dolt_log" ).get (0 ).get (0 );
24+ if (commits != 2 ) throw new RuntimeException ("dolt_log count=" + commits + " (expected 2)" );
25+
26+ System .out .println ("runtime smoke OK: engine=" + engine
27+ + " commit=" + hash .substring (0 , 8 ) + " commits=" + commits );
28+ }
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments