diff --git a/.github/workflows/_android.yml b/.github/workflows/_android.yml index f4f04e4eef3..922762210ca 100644 --- a/.github/workflows/_android.yml +++ b/.github/workflows/_android.yml @@ -66,6 +66,16 @@ jobs: # avoid permission issue sudo chown -R "${USER}" /opt/android + - name: Download Artifacts + shell: bash + run: | + set -eux + curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/llm_demo/app-debug.apk + curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/llm_demo/app-debug-androidTest.apk + curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/fp32-xnnpack-custom/model.zip + unzip model.zip + mv *.pte model.pte + - name: Gradle cache uses: gradle/actions/setup-gradle@v3 diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 4ba24f635e5..dd5b432e5a4 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -99,6 +99,8 @@ jobs: submodules: 'true' ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} timeout: 900 + upload-artifact: android-models + upload-artifact-to-s3: true script: | # The generic Linux job chooses to use base env, not the one setup by the image CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") @@ -107,13 +109,15 @@ jobs: DTYPE=${{ matrix.dtype }} BUILD_TOOL="cmake" MODE=${{ matrix.mode }} + ARTIFACTS_DIR_NAME="artifacts-to-be-uploaded/${DTYPE}-${MODE}" + ARTIFACTS_DIR_NAME="${ARTIFACTS_DIR_NAME/+/-}" # Setup executorch PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}" # Install requirements for export_llama PYTHON_EXECUTABLE=python bash examples/models/llama/install_requirements.sh # Test llama2 - PYTHON_EXECUTABLE=python bash .ci/scripts/test_llama.sh stories110M "${BUILD_TOOL}" "${DTYPE}" "${MODE}" + PYTHON_EXECUTABLE=python bash .ci/scripts/test_llama.sh stories110M "${BUILD_TOOL}" "${DTYPE}" "${MODE}" "${ARTIFACTS_DIR_NAME}" test-llama-runner-linux-android: name: test-llama-runner-linux-android @@ -320,6 +324,7 @@ jobs: android: uses: ./.github/workflows/_android.yml + needs: test-llama-runner-linux unittest: uses: ./.github/workflows/_unittest.yml diff --git a/build/run_android_emulator.sh b/build/run_android_emulator.sh index aa63e2a86a8..62d5ea767fa 100755 --- a/build/run_android_emulator.sh +++ b/build/run_android_emulator.sh @@ -18,5 +18,10 @@ $ADB_PATH wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; d echo "List all running emulators" $ADB_PATH devices -# TODO: Run tests on emulator here, atm the script only boots up the emulator -# and exits without doing anything yet +adb install -t app-debug.apk +adb install -t app-debug-androidTest.apk + +adb shell mkdir -p /data/local/tmp/llama +adb push model.pte /data/local/tmp/llama +adb push tokenizer.bin /data/local/tmp/llama +adb shell am instrument -w -r com.example.executorchllamademo.test/androidx.test.runner.AndroidJUnitRunner