Add cross-platform 1DS telemetry to the compiled library (opt-out) #8530
This file contains hidden or 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: "Linux CPU ARM64 Build" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - rel-* | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }} | |
| 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: | |
| linux-cpu-arm64-build: | |
| permissions: | |
| contents: read | |
| packages: write # needed for GHCR push | |
| runs-on: ["self-hosted", "1ES.Pool=onnxruntime-genai-Ubuntu2004-ARM-CPU"] | |
| steps: | |
| - name: Checkout OnnxRuntime GenAI repo | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: 'true' | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| - name: Install Rust with rustup | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| source "$HOME/.cargo/env" | |
| rustup install 1.86.0 | |
| rustup override set 1.86.0 | |
| rustup component add rust-src | |
| rustup show active-toolchain | |
| - name: Get the Latest OnnxRuntime Nightly Version | |
| shell: pwsh | |
| run: | | |
| $resp = Invoke-RestMethod "${{ env.ORT_NIGHTLY_REST_API }}" | |
| $ORT_NIGHTLY_VERSION = $resp.value[0].versions[0].normalizedVersion | |
| Write-Host "$ORT_NIGHTLY_VERSION" | |
| "ORT_NIGHTLY_VERSION=$ORT_NIGHTLY_VERSION" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| - name: Download OnnxRuntime Nightly | |
| run: | | |
| dotnet new console | |
| dotnet add package ${{ env.ORT_PACKAGE_NAME }} --version ${{ env.ORT_NIGHTLY_VERSION }} --source ${{ env.ORT_NIGHTLY_SOURCE }} --package-directory . | |
| continue-on-error: true | |
| - name: list files | |
| shell: bash | |
| run: | | |
| ls -l | |
| ls -R microsoft.ml.onnxruntime | |
| continue-on-error: true | |
| # TODO: Find out why do we need to to have libonnxruntime.so.$ort_version | |
| - name: Extract OnnxRuntime library and header files | |
| run: | | |
| mkdir -p ort/lib | |
| mv microsoft.ml.onnxruntime/**/build/native/include ort/ | |
| mv microsoft.ml.onnxruntime/**/runtimes/linux-arm64/native/* ort/lib/ | |
| cp ort/lib/libonnxruntime.so ort/lib/libonnxruntime.so.1 | |
| - name: Download Docker Image | |
| run: | | |
| set -e -x | |
| az login --identity --object-id 161bbca8-9899-4f61-950c-4d556fbcf830 | |
| az acr login --name onnxruntimebuildcache --subscription 00c06639-6ee4-454e-8058-8d8b1703bd87 | |
| docker login --username "$GITHUB_ACTOR" --password '${{ secrets.GITHUB_TOKEN }}' ghcr.io | |
| python3 tools/ci_build/get_docker_image.py --dockerfile tools/ci_build/github/linux/docker/inference/aarch64/default/cpu/Dockerfile \ | |
| --context tools/ci_build/github/linux/docker/inference/aarch64/default/cpu \ | |
| --docker-build-args "--build-arg BUILD_UID=$( id -u )" \ | |
| --container-registry ghcr.io/microsoft/onnxruntime-genai \ | |
| --repository ort_genai_linux_arm64_gha | |
| - name: Docker -- Configure with CMake and GCC | |
| run: | | |
| docker run --rm \ | |
| --volume $GITHUB_WORKSPACE:/onnxruntime_src \ | |
| -w /onnxruntime_src ort_genai_linux_arm64_gha bash -c "python3 --version && /usr/bin/cmake --preset linux_gcc_cpu_release -DUSE_GUIDANCE=ON" | |
| - name: Docker -- Build with CMake and GCC | |
| run: | | |
| docker run --rm \ | |
| --volume $GITHUB_WORKSPACE:/onnxruntime_src \ | |
| -w /onnxruntime_src ort_genai_linux_arm64_gha bash -c "/usr/bin/cmake --build --preset linux_gcc_cpu_release && /usr/bin/cmake --build --preset linux_gcc_cpu_release --target PyPackageBuild" | |
| - name: Docker -- Build the C Examples | |
| run: | | |
| docker run --rm \ | |
| --volume $GITHUB_WORKSPACE:/onnxruntime_src \ | |
| -w /onnxruntime_src ort_genai_linux_arm64_gha bash -c " \ | |
| /usr/bin/cmake -S examples/c -B examples/c/build \ | |
| -DMODEL_QA=ON -DMODEL_CHAT=ON -DMODEL_MM=ON -DWHISPER=ON -DNEMOTRON_SPEECH=ON \ | |
| -DORT_INCLUDE_DIR=/onnxruntime_src/build/cpu/_deps/ortlib-src/build/native/include \ | |
| -DORT_LIB_DIR=/onnxruntime_src/build/cpu/_deps/ortlib-src/runtimes/linux-arm64/native \ | |
| -DOGA_INCLUDE_DIR=/onnxruntime_src/src \ | |
| -DOGA_LIB_DIR=/onnxruntime_src/build/cpu && \ | |
| /usr/bin/cmake --build examples/c/build --config Release" | |
| - name: Docker -- Check test directory | |
| run: | | |
| docker run --rm \ | |
| --volume $GITHUB_WORKSPACE:/onnxruntime_src \ | |
| -w /onnxruntime_src ort_genai_linux_arm64_gha bash -c "ls -l /onnxruntime_src/build/cpu/test/" | |
| - name: Docker -- Run tests | |
| run: | | |
| docker run --rm \ | |
| --volume $GITHUB_WORKSPACE:/onnxruntime_src \ | |
| -w /onnxruntime_src ort_genai_linux_arm64_gha bash -c "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/onnxruntime_src/ort/lib/ /onnxruntime_src/build/cpu/unit_tests" | |
| - name: Docker -- Build and Run the C# Tests | |
| run: | | |
| docker run --rm \ | |
| --volume $GITHUB_WORKSPACE:/onnxruntime_src \ | |
| --volume $DOTNET_INSTALL_DIR:/opt/dotnet \ | |
| -e PATH="/opt/dotnet:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ | |
| -e DOTNET_ROOT=/opt/dotnet \ | |
| -e DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 \ | |
| -w /onnxruntime_src ort_genai_linux_arm64_gha bash -c " \ | |
| export ORTGENAI_LOG_ORT_LIB=1 && \ | |
| cd /onnxruntime_src/test/csharp && \ | |
| dotnet test /p:Configuration=Release /p:NativeBuildOutputDir=../../build/cpu/ /p:OrtLibDir=../../ort/lib/ --verbosity normal" | |
| - name: Docker -- Build the C# Examples | |
| run: | | |
| docker run --rm \ | |
| --volume $GITHUB_WORKSPACE:/onnxruntime_src \ | |
| --volume $DOTNET_INSTALL_DIR:/opt/dotnet \ | |
| -e PATH="/opt/dotnet:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ | |
| -e DOTNET_ROOT=/opt/dotnet \ | |
| -e DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 \ | |
| -w /onnxruntime_src ort_genai_linux_arm64_gha bash -c " \ | |
| export ORTGENAI_LOG_ORT_LIB=1 && \ | |
| cd /onnxruntime_src/examples/csharp/ModelChat && dotnet build -c Release && \ | |
| cd /onnxruntime_src/examples/csharp/ModelMM && dotnet build -c Release" |