Skip to content

Commit

Permalink
Merge pull request #192 from edtubbs/0.1.3-dev-android-ci-tests
Browse files Browse the repository at this point in the history
ci: added test for aarch64-android
  • Loading branch information
xanimo authored Feb 7, 2024
2 parents 1ce63c2 + 82206e5 commit ad3a516
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 15 deletions.
95 changes: 80 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ jobs:
CCACHE_TEMPDIR: /tmp/.ccache-temp
CCACHE_COMPRESS: "1"
PYTHON_DEBUG: "1"
SDK_URL: https://bitcoincore.org/depends-sources/sdks
MAC_SDK_URL: https://bitcoincore.org/depends-sources/sdks
ANDROID_NDK_URL: https://dl.google.com/android/repository/

strategy:
fail-fast: false
matrix:
name:
- armhf-linux
- aarch64-linux
- aarch64-android
- x86_64-linux-dbg
- x86_64-linux-openenclave
- x86_64-macos
Expand All @@ -51,6 +53,16 @@ jobs:
config-opts: "LIBS='-levent_pthreads' --enable-static --disable-shared --enable-test-passwd"
run-tests: true
goal: install
- name: aarch64-android
host: aarch64-linux-android
os: ubuntu-20.04
packages: unzip
dep-opts: "CROSS_COMPILE='yes' SPEED=slow V=1"
config-opts: "--enable-static --disable-shared --enable-test-passwd"
run-tests: true
goal: install
android-ndk: android-ndk-r25c-linux
android-ndk-shasum: "769ee342ea75f80619d985c2da990c48b3d8eaf45f48783a2d48870d04b46108"
- name: x86_64-linux-dbg
host: x86_64-pc-linux-gnu
os: ubuntu-20.04
Expand All @@ -75,9 +87,9 @@ jobs:
config-opts: "--enable-static --disable-shared --enable-test-passwd"
packages: cmake zlib xorriso
goal: install
sdk: 12.2
sdk-build: 12B45b
sdk-shasum: "df75d30ecafc429e905134333aeae56ac65fac67cb4182622398fd717df77619"
mac-sdk: 12.2
mac-sdk-build: 12B45b
mac-sdk-shasum: "df75d30ecafc429e905134333aeae56ac65fac67cb4182622398fd717df77619"
# - name: arm64-macos
# host: arm64-apple-darwin
# os: macos-latest
Expand All @@ -86,9 +98,9 @@ jobs:
# config-opts: ""
# packages: cmake zlib xorriso
# goal: install
# sdk: 12.2
# sdk-build: 12B45b
# sdk-shasum: "df75d30ecafc429e905134333aeae56ac65fac67cb4182622398fd717df77619"
# mac-sdk: 12.2
# mac-sdk-build: 12B45b
# mac-sdk-shasum: "df75d30ecafc429e905134333aeae56ac65fac67cb4182622398fd717df77619"
- name: x86_64-win
host: x86_64-w64-mingw32
arch: i386
Expand Down Expand Up @@ -177,27 +189,48 @@ jobs:
- name: checkout
uses: actions/checkout@v4

- name: sdk cache
if: ${{ matrix.sdk }}
- name: mac sdk cache
if: ${{ matrix.mac-sdk }}
uses: actions/cache@v4
env:
cache-name: sdk
with:
path: ./depends/sdk-sources
key: ${{ matrix.name }}-${{ env.cache-name }}-${{ hashFiles('.github/workflows/ci.yml') }}

- name: install sdk
if: ${{ matrix.sdk }}
- name: install mac sdk
if: ${{ matrix.mac-sdk }}
env:
sdk-filename: Xcode-${{ matrix.sdk }}-${{ matrix.sdk-build }}-extracted-SDK-with-libcxx-headers.tar.gz
sdk-filename: Xcode-${{ matrix.mac-sdk }}-${{ matrix.mac-sdk-build }}-extracted-SDK-with-libcxx-headers.tar.gz
run: |
mkdir -p ./depends/sdk-sources
mkdir -p ./depends/SDKs
echo "${{ matrix.sdk-shasum }} depends/sdk-sources/${{ env.sdk-filename }}" | sha256sum -c || \
curl --location --fail $SDK_URL/${{ env.sdk-filename }} -o depends/sdk-sources/${{ env.sdk-filename }} &&\
echo "${{ matrix.sdk-shasum }} depends/sdk-sources/${{ env.sdk-filename }}" | sha256sum -c
echo "${{ matrix.mac-sdk-shasum }} depends/sdk-sources/${{ env.sdk-filename }}" | sha256sum -c || \
curl --location --fail $MAC_SDK_URL/${{ env.sdk-filename }} -o depends/sdk-sources/${{ env.sdk-filename }} &&\
echo "${{ matrix.mac-sdk-shasum }} depends/sdk-sources/${{ env.sdk-filename }}" | sha256sum -c
tar -C depends/SDKs -xf depends/sdk-sources/${{ env.sdk-filename }}
- name: android ndk cache
if: ${{ matrix.android-ndk }}
uses: actions/cache@v3
env:
cache-name: android-ndk
with:
path: ./depends/sdk-sources
key: ${{ matrix.name }}-${{ env.cache-name }}-${{ hashFiles('.github/workflows/ci.yml') }}

- name: install android ndk
if: ${{ matrix.android-ndk }}
env:
ndk-filename: ${{ matrix.android-ndk }}.zip
run: |
mkdir -p ./depends/sdk-sources
mkdir -p ./depends/SDKs
echo "${{ matrix.android-ndk-shasum }} depends/sdk-sources/${{ env.ndk-filename }}" | sha256sum -c || \
curl --location --fail $ANDROID_NDK_URL/${{ env.ndk-filename }} -o depends/sdk-sources/${{ env.ndk-filename }} &&\
echo "${{ matrix.android-ndk-shasum }} depends/sdk-sources/${{ env.ndk-filename }}" | sha256sum -c
unzip depends/sdk-sources/${{ env.ndk-filename }} -d depends/SDKs
- name: dependency cache
uses: actions/cache@v4
env:
Expand Down Expand Up @@ -296,6 +329,38 @@ jobs:
make
make simulate
;;
"aarch64-android"):
wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip
unzip commandlinetools-linux-6858069_latest.zip
mkdir -p ~/.android-sdk/cmdline-tools/latest
mv cmdline-tools/* ~/.android-sdk/cmdline-tools/latest
export ANDROID_SDK_ROOT=~/.android-sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools
yes | sdkmanager --licenses --sdk_root=$ANDROID_SDK_ROOT
sdkmanager --update --sdk_root=$ANDROID_SDK_ROOT
sdkmanager "platform-tools" --sdk_root=$ANDROID_SDK_ROOT
DOCKER_IMAGE=us-docker.pkg.dev/android-emulator-268719/images/r-google-x64:30.0.23
PORT=15555
container_id=$(docker run -d \
--device /dev/kvm \
--publish 8554:8554/tcp \
--publish $PORT:5555/tcp \
-e TOKEN="$(cat ~/.emulator_console_auth_token)" \
-e ADBKEY="$(cat ~/.android/adbkey)" \
$DOCKER_IMAGE)
echo "The container is running with id: $container_id"
adb connect localhost:$PORT
adb wait-for-device
while [ "$(adb shell getprop sys.boot_completed | tr -d '\r')" != "1" ]; do
sleep 1
done
echo "The device is ready"
adb push ./tests /data/local/tmp/
adb shell "mkdir -p /data/local/tmp/test"
adb push ./test/wordlist /data/local/tmp/test
adb shell "cd /data/local/tmp/; chmod 755 tests; ./tests"
echo "docker stop ${container_id}"
;;
*)
make check -j"$(getconf _NPROCESSORS_ONLN)" V=1
;;
Expand Down
4 changes: 4 additions & 0 deletions src/logdb/test/logdb_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
static const char *dbtmpfile = "dummy";
#else
#include <unistd.h>
#ifdef __ANDROID__
static const char *dbtmpfile = "/data/local/tmp/dummy";
#else
static const char *dbtmpfile = "/tmp/dummy";
#endif
#endif

#include <errno.h>

Expand Down
4 changes: 4 additions & 0 deletions test/wallet_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
static const char *wallettmpfile = "dummy";
#else
#include <unistd.h>
#ifdef __ANDROID__
static const char *wallettmpfile = "/data/local/tmp/dummy";
#else
static const char *wallettmpfile = "/tmp/dummy";
#endif
#endif

#include <test/utest.h>

Expand Down

0 comments on commit ad3a516

Please sign in to comment.