-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* android ci * on * arm names * can't shutdown * no arm for now * google_apis * try 29 * additional setup * another cflags * asm in arch dir * woops * fixes * cache? * target cc * cleanup
- Loading branch information
Showing
11 changed files
with
275 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Android Test | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
test: | ||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
#android-arch: ["arm64-v8a", "x86_64"] | ||
android-arch: ["x86_64"] | ||
android-api-level: [29] | ||
android-ndk-version: ["26.0.10792818"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Go Toolchain | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '=1.18.0' | ||
|
||
- name: Rust Toolchain | ||
run: | | ||
rustup toolchain install stable --profile minimal --no-self-update | ||
#rustup target add aarch64-linux-android | ||
rustup target add x86_64-linux-android | ||
- name: Rust Cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Avd Cache | ||
uses: actions/cache@v3 | ||
id: avd-cache | ||
with: | ||
path: | | ||
~/.android/avd/* | ||
~/.android/adb* | ||
key: avd-${{ matrix.android-api-level }} | ||
|
||
- name: Avd Snapshot | ||
if: steps.avd-cache.outputs.cache-hit != 'true' | ||
env: | ||
ANDROID_API_LEVEL: ${{ matrix.android-api-level }} | ||
ANDROID_NDK_VERSION: ${{ matrix.android-ndk-version }} | ||
ANDROID_ARCH: ${{ matrix.android-arch }} | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: ${{ matrix.android-api-level }} | ||
ndk: ${{ matrix.android-ndk-version }} | ||
arch: ${{ matrix.android-arch }} | ||
target: google_apis | ||
force-avd-creation: false | ||
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: false | ||
script: echo "Generated AVD snapshot for caching." | ||
|
||
- name: Build and Run Tests | ||
env: | ||
ANDROID_API_LEVEL: ${{ matrix.android-api-level }} | ||
ANDROID_NDK_VERSION: ${{ matrix.android-ndk-version }} | ||
ANDROID_ARCH: ${{ matrix.android-arch }} | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: ${{ matrix.android-api-level }} | ||
ndk: ${{ matrix.android-ndk-version }} | ||
arch: ${{ matrix.android-arch }} | ||
target: google_apis | ||
force-avd-creation: false | ||
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: true | ||
script: ./android-build-tests.bash && ./android-run-tests.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/target | ||
/output-* |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
set -eEuxo pipefail | ||
|
||
if [[ "${ANDROID_API_LEVEL:-x}" == "x" ]]; then | ||
echo "ANDROID_API_LEVEL required" | ||
exit 127 | ||
fi | ||
|
||
if [[ "${ANDROID_NDK_VERSION:-x}" == "x" ]]; then | ||
echo "ANDROID_NDK_VERSION required" | ||
exit 127 | ||
fi | ||
|
||
if [[ "${ANDROID_ARCH:-x}" == "x" ]]; then | ||
echo "ANDROID_ARCH required" | ||
exit 127 | ||
else | ||
if [[ "${ANDROID_ARCH}" == "arm64-v8a" ]]; then | ||
export ANDROID_ARCH="aarch64" | ||
fi | ||
fi | ||
|
||
|
||
if [[ "${ANDROID_SDK_ROOT:-x}" == "x" ]]; then | ||
echo "ANDROID_SDK_ROOT required" | ||
exit 127 | ||
fi | ||
|
||
_ndk_root=(${ANDROID_SDK_ROOT}/ndk/${ANDROID_NDK_VERSION}/toolchains/llvm/prebuilt/*) | ||
|
||
# This workaround may be needed if upgrading android api level | ||
#cat << EOF > ${_ndk_root}/lib/clang/17/lib/linux/${ANDROID_ARCH}/libgcc.a | ||
#INPUT(-lunwind) | ||
#EOF | ||
|
||
export PKG_CONFIG_SYSROOT_DIR="${_ndk_root}/sysroot" | ||
export TARGET_CC="${_ndk_root}/bin/${ANDROID_ARCH}-linux-android${ANDROID_API_LEVEL}-clang" | ||
export TARGET_CFLAGS="-I${_ndk_root}/sysroot/usr/include -I${_ndk_root}/sysroot/usr/include/${ANDROID_ARCH}-linux-android" | ||
export TARGET_AR="${_ndk_root}/bin/llvm-ar" | ||
export TARGET_RANLIB="${_ndk_root}/bin/llvm-ranlib" | ||
export CGO_CFLAGS="-I${_ndk_root}/sysroot/usr/include -I${_ndk_root}/sysroot/usr/include/${ANDROID_ARCH}-linux-android" | ||
|
||
cargo test --no-run --release --target ${ANDROID_ARCH}-linux-android --config target.${ANDROID_ARCH}-linux-android.linker="\"${_ndk_root}/bin/${ANDROID_ARCH}-linux-android34-clang\"" --config target.${ANDROID_ARCH}-linux-android.ar="\"${_ndk_root}/bin/llvm-ar\"" 2>&1 | tee output-cargo-test | ||
cat output-cargo-test | grep Executable | sed -E 's/[^(]*\(([^)]*)\)/\1/' > output-test-executables | ||
echo "BUILD TESTS:" | ||
cat output-test-executables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
set -eEuxo pipefail | ||
|
||
for i in $(cat output-test-executables); do | ||
adb push $i /data/local/tmp/$(basename $i) | ||
adb shell /data/local/tmp/$(basename $i) | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters