Try and make workflow runnable #1
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
name: "Android x64 Build" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- rel-* | |
- skottmckay/* | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
ORT_NIGHTLY_REST_API: "https://feeds.dev.azure.com/aiinfra/PublicPackages/_apis/packaging/Feeds/ORT-Nightly/packages?packageNameQuery=Microsoft.ML.OnnxRuntime&api-version=6.0-preview.1" | |
ORT_PACKAGE_NAME: "Microsoft.ML.OnnxRuntime" | |
ORT_NIGHTLY_SOURCE: "https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/nuget/v3/index.json" | |
# DOTNET_INSTALL_DIR: "${{ github.workspace }}/dotnet" | |
jobs: | |
android_x64: | |
runs-on: [ "self-hosted", "1ES.Pool=onnxruntime-genai-Ubuntu2204-AMD-CPU" ] | |
steps: | |
- name: Checkout OnnxRuntime GenAI repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
# expecting Android SDK and JDK to be pre-installed | |
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md | |
- name: Check pre-installed requirements | |
run: | | |
set -e -x | |
echo $JAVA_HOME | |
echo $JAVA_HOME_11_X64 | |
echo $ANDROID_NDK_LATEST_HOME | |
ls -l $ANDROID_HOME | |
ls -l $ANDROID_HOME/ndk | |
- name: Install jq | |
run: | | |
sudo apt-get install jq | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Get the Latest OnnxRuntime Nightly Version | |
run: | | |
ORT_NIGHTLY_VERSION=$(curl -s "${{ env.ORT_NIGHTLY_REST_API }}" | jq -r '.value[0].versions[0].normalizedVersion') | |
echo "$ORT_NIGHTLY_VERSION" | |
echo "ORT_NIGHTLY_VERSION=$ORT_NIGHTLY_VERSION" >> $GITHUB_ENV | |
- name: Download ONNX Runtime Nightly | |
run: | | |
dotnet new console | |
dotnet add package ${{ env.ORT_PACKAGE_NAME }} --version ${{ env.ORT_NIGHTLY_VERSION }} --source ${{ env.ORT_NIGHTLY_SOURCE }} --package-directory . | |
dotnet build | |
continue-on-error: true | |
- name: list files | |
shell: bash | |
run: | | |
ls -l | |
ls -R ${{ env.ORT_PACKAGE_NAME }} | |
continue-on-error: true | |
- name: Extract ONNX Runtime AAR | |
run: | | |
set -e -x | |
mv microsoft.ml.onnxruntime/${{ env.ORT_NIGHTLY_VERSION }}/runtimes/android/native/onnxruntime.aar ort | |
unzip ort/onnxruntime.aar -d ort | |
ls -l ort | |
ort_version=$(echo ${{ env.ORT_NIGHTLY_VERSION }} | cut -d- -f1-1) | |
- name: Create Android build | |
run: | | |
set -e -x | |
rm -rf build | |
./build --android --android_api=27 --android_ndk_path=${ANDROID_NDK_LATEST} --config=RelWithDebInfo --android_abi=x86_64 --parallel --cmake_generator=Ninja --build_java --update | |
- name: Run Android build | |
run: | | |
set -e -x | |
./build --android --android_api=27 --android_ndk_path=${ANDROID_NDK_LATEST} --config=RelWithDebInfo --android_abi=x86_64 --parallel --cmake_generator=Ninja --build_java --build | |
- name: Run Android tests | |
run: | | |
set -e -x | |
./build --android --android_api=27 --android_ndk_path=${ANDROID_NDK_LATEST} --config=RelWithDebInfo --android_abi=x86_64 --parallel --cmake_generator=Ninja --build_java --android_run_emulator --test |