Skip to content

Exclude a script file from the published package #78

Exclude a script file from the published package

Exclude a script file from the published package #78

Workflow file for this run

on:
push:
branches:
- master
pull_request:
branches:
- master
name: android
env:
NDK_VERSION: "r26d"
ANDROID_VERSION: "12.0.0"
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-linux-android
- name: Setup Android Environment
run: |
NDK_URL="https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-linux.zip"
NDK_DIR="${HOME}/android-ndk-${NDK_VERSION}"
# Download and extract NDK
echo "Downloading NDK from $NDK_URL"
wget -q "$NDK_URL" -O android-ndk.zip
unzip -q android-ndk.zip -d "$HOME"
# Set ANDROID_NDK_ROOT environment variable
echo "ANDROID_NDK_ROOT=$NDK_DIR" >> $GITHUB_ENV
# Setup & start redroid container
sudo apt-get install -y linux-modules-extra-$(uname -r) android-tools-adb
sudo modprobe binder_linux devices=binder,hwbinder,vndbinder
docker run -itd --rm --privileged \
--mount "type=bind,src=$(pwd),dst=/data/host$(pwd),ro" \
--mount "type=bind,src=/tmp,dst=/data/host/tmp,ro" \
--mount "type=bind,src=$(pwd)/.github/workflows/run-on-host.sh,dst=/system/xbin/run-on-host,ro" \
--name redroid-test \
-p 5555:5555 \
redroid/redroid:${ANDROID_VERSION}_64only-latest
# Start ADB server and connect to our redroid container
adb start-server
timeout 60 bash -c 'until adb connect localhost:5555; do sleep 2; done'
# Configure Android environment
echo "CARGO_TARGET_X86_64_LINUX_ANDROID_RUNNER=adb -s localhost:5555 shell run-on-host" >> $GITHUB_ENV
echo "CC_X86_64_linux_android=$NDK_DIR/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android34-clang" >> $GITHUB_ENV
echo "AR_x86_64_linux_android=$NDK_DIR/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" >> $GITHUB_ENV
echo "CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=$NDK_DIR/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android34-clang" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_LINUX_ANDROID_RUSTFLAGS=-C link-arg=-Wl,--as-needed" >> $GITHUB_ENV
- run: cargo build --verbose --target x86_64-linux-android
- run: cargo test --verbose --target x86_64-linux-android -- --nocapture
- name: Stop the redroid container
run: docker stop redroid-test || true