ci: Verify the Android build
authorBart Van Assche <bvanassche@acm.org>
Wed, 22 Jun 2022 22:37:29 +0000 (15:37 -0700)
committerBart Van Assche <bvanassche@acm.org>
Thu, 23 Jun 2022 13:29:12 +0000 (06:29 -0700)
Let the continuous integration infrastructure verify the fio Android build
in order to detect regressions in the Android build quickly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
.github/workflows/ci.yml
ci/actions-build.sh
ci/actions-full-test.sh
ci/actions-install.sh
ci/actions-smoke-test.sh

index cd8ce1429ceca8517f6a9bfd4bc7f50f942d5af5..650366b23d87d5d7030aa918f9c58c5a48815436 100644 (file)
@@ -15,6 +15,7 @@ jobs:
         - linux-clang
         - macos
         - linux-i686-gcc
+        - android
         include:
         - build: linux-gcc
           os: ubuntu-20.04
@@ -27,8 +28,12 @@ jobs:
         - build: linux-i686-gcc
           os: ubuntu-20.04
           arch: i686
+        - build: android
+          os: ubuntu-20.04
+          arch: aarch64-linux-android32
 
     env:
+      CI_TARGET_BUILD: ${{ matrix.build }}
       CI_TARGET_ARCH: ${{ matrix.arch }}
       CC: ${{ matrix.cc }}
 
index 74a6fdcbf0e7d1af1e5ef9324ee8cdb7391d7171..2b3de8e3daa272cff5638d745b322ae65da45d28 100755 (executable)
@@ -11,8 +11,23 @@ main() {
     local configure_flags=()
 
     set_ci_target_os
-    case "${CI_TARGET_OS}" in
-        "linux")
+    case "${CI_TARGET_BUILD}/${CI_TARGET_OS}" in
+        android/*)
+            export UNAME=Android
+            if [ -z "${CI_TARGET_ARCH}" ]; then
+                echo "Error: CI_TARGET_ARCH has not been set"
+                return 1
+            fi
+            NDK=$PWD/android-ndk-r24/toolchains/llvm/prebuilt/linux-x86_64/bin
+            export PATH="${NDK}:${PATH}"
+            export LIBS="-landroid"
+            CC=${NDK}/${CI_TARGET_ARCH}-clang
+            if [ ! -e "${CC}" ]; then
+                echo "Error: could not find ${CC}"
+                return 1
+            fi
+            ;;
+        */linux)
             case "${CI_TARGET_ARCH}" in
                 "i686")
                     extra_cflags="${extra_cflags} -m32"
index 8282002f76a3ccb89c527b76cae20be974fbf750..d1675f6eb2f17c0d5e08142245e0cbdde2efcdc1 100755 (executable)
@@ -3,6 +3,8 @@
 set -eu
 
 main() {
+    [ "${CI_TARGET_BUILD}" = android ] && return 0
+
     echo "Running long running tests..."
     export PYTHONUNBUFFERED="TRUE"
     if [[ "${CI_TARGET_ARCH}" == "arm64" ]]; then
index 0e472717d26e4c48f514dc99b07758d4533bf93f..ff5149265e07b8cef6464f7427bfc70676a46fe6 100755 (executable)
@@ -83,6 +83,13 @@ install_macos() {
 }
 
 main() {
+    if [ "${CI_TARGET_BUILD}" = "android" ]; then
+       echo "Installing Android NDK..."
+       wget --quiet https://dl.google.com/android/repository/android-ndk-r24-linux.zip
+       unzip -q android-ndk-r24-linux.zip
+       return 0
+    fi
+
     set_ci_target_os
 
     install_function="install_${CI_TARGET_OS}"
index c129c89fadd0d1ead1f258f797b71ab448842f02..3196f6a1ba33a0c2a1a8bfad0fdff3e60bb6e2f5 100755 (executable)
@@ -3,6 +3,8 @@
 set -eu
 
 main() {
+    [ "${CI_TARGET_BUILD}" = "android" ] && return 0
+
     echo "Running smoke tests..."
     make test
 }