Skip to content

Commit

Permalink
Run a mock Android emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
huydhn committed Jul 24, 2024
1 parent 11b2fcb commit 2c524af
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 9 deletions.
28 changes: 19 additions & 9 deletions .ci/docker/common/install_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,27 @@ set -ex
[ -n "${ANDROID_NDK_VERSION}" ]

install_prerequiresites() {
apt-get update
OS=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
case "$OS" in
amzn)
yum install -y java-1.7.0-openjdk \
ca-certificates \
and
;;
*)
apt-get update

# NB: Need OpenJDK 17 at the minimum
apt-get install -y --no-install-recommends \
openjdk-17-jdk \
ca-certificates-java \
ant
# NB: Need OpenJDK 17 at the minimum
apt-get install -y --no-install-recommends \
openjdk-17-jdk \
ca-certificates-java \
ant

# Cleanup package manager
apt-get autoclean && apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Cleanup package manager
apt-get autoclean && apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
;;
esac
}

install_ndk() {
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
# Build LLM Demo for Android
bash build/build_android_llm_demo.sh ${{ matrix.tokenizer }} ${ARTIFACTS_DIR_NAME}
# Upload artifacts to S3. The artifacts are needed not only by the device farm but also TorchChat
upload-artifacts:
needs: build-llm-demo
Expand Down Expand Up @@ -77,6 +78,34 @@ jobs:
if-no-files-found: ignore
path: ${{ runner.temp }}/artifacts/

# Running Android emulator directly on the runner, not using Docker
run-emulator:
# DEBUG
# needs: build-llm-demo
runs-on: linux.4xlarge
env:
ANDROID_NDK_VERSION: r26c
steps:
- name: Setup SSH (Click me for login details)
uses: pytorch/test-infra/.github/actions/setup-ssh@main
if: ${{ !contains(matrix.runner, 'gcp.a100') }}
with:
github-secret: ${{ secrets.GITHUB_TOKEN }}
instructions: |
All testing is done inside the container, to start an interactive session run:
docker exec -it $(docker container ps --format '{{.ID}}') bash
- name: Checkout PyTorch
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main

- name: Install Android dependencies
shell: bash
run: |
set -eux
# Reuse the script that install Android on ET Docker image
sudo bash .ci/docker/common/install_android.sh
# Let's see how expensive this job is, we might want to tone it down by running it periodically
test-llama-app:
needs: upload-artifacts
Expand Down

0 comments on commit 2c524af

Please sign in to comment.