|
13 | 13 | workflow_dispatch: |
14 | 14 |
|
15 | 15 | concurrency: |
16 | | - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' }} |
17 | | - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| 16 | + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + packages: write |
| 22 | + attestations: write |
| 23 | + id-token: write |
18 | 24 |
|
19 | 25 | jobs: |
| 26 | + AndroidBinarySizeCheckJob_MinimalBaseline: |
| 27 | + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] |
| 28 | + steps: |
| 29 | + - name: Checkout repository |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + submodules: false |
| 33 | + |
| 34 | + - name: Setup Android NDK |
| 35 | + uses: ./.github/actions/setup-android-ndk |
| 36 | + with: |
| 37 | + ndk-version: 28.0.13004108 |
| 38 | + |
| 39 | + - name: Get Docker Image using Action |
| 40 | + uses: microsoft/onnxruntime-github-actions/build-docker-image@v0.0.6 |
| 41 | + id: build_docker_image_step |
| 42 | + with: |
| 43 | + dockerfile: ${{ github.workspace }}/tools/ci_build/github/linux/docker/inference/x86_64/default/cpu/Dockerfile |
| 44 | + image-name: ghcr.io/microsoft/onnxruntime/onnxruntimecpubuildcix64 |
| 45 | + push: true |
| 46 | + azure-container-registry-name: onnxruntimebuildcache |
| 47 | + env: |
| 48 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + |
| 50 | + - name: Set variables from config file |
| 51 | + id: set_vars |
| 52 | + run: | |
| 53 | + import json, os |
| 54 | +
|
| 55 | + config_file_path = "tools/ci_build/github/linux/ort_minimal/build_check_binsize_config/android_minimal_baseline.config" |
| 56 | + with open(config_file_path, mode="r") as config_file: |
| 57 | + config = json.load(config_file) |
| 58 | +
|
| 59 | + def set_var(name, value): |
| 60 | + print(f"Setting variable: {name} = '{value}'") |
| 61 | + # Use GITHUB_ENV for setting environment variables |
| 62 | + with open(os.environ['GITHUB_ENV'], 'a') as f: |
| 63 | + f.write(f"{name}={value}\n") |
| 64 | +
|
| 65 | + set_var("BuildConfigType", config["type"]) |
| 66 | + set_var("BuildConfigOs", config["os"]) |
| 67 | + shell: python |
| 68 | + working-directory: ${{ github.workspace }} |
| 69 | + |
| 70 | + - name: Export GitHub Actions cache environment variables |
| 71 | + uses: actions/github-script@v7 |
| 72 | + with: |
| 73 | + script: | |
| 74 | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); |
| 75 | + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); |
| 76 | +
|
| 77 | + - name: 1a. Build onnxruntime |
| 78 | + run: | |
| 79 | + set -e -x |
| 80 | + BINARY_SIZE_THRESHOLD_ARGS="" |
| 81 | + echo "Binary size threshold in bytes: 1306224" |
| 82 | + BINARY_SIZE_THRESHOLD_ARGS="--threshold_size_in_bytes 1306224" |
| 83 | +
|
| 84 | + # Ensure ANDROID_NDK_HOME is available and get its real path |
| 85 | + if [ -z "$ANDROID_NDK_HOME" ]; then |
| 86 | + echo "ANDROID_NDK_HOME is not set." |
| 87 | + exit 1 |
| 88 | + fi |
| 89 | + NDK_HOME_REALPATH=$(realpath $ANDROID_NDK_HOME) |
| 90 | +
|
| 91 | + # Ensure ANDROID_HOME is available |
| 92 | + if [ -z "$ANDROID_HOME" ]; then |
| 93 | + echo "ANDROID_HOME is not set. Using default /usr/local/lib/android/sdk" |
| 94 | + export ANDROID_HOME=/usr/local/lib/android/sdk |
| 95 | + fi |
| 96 | +
|
| 97 | + docker run -e SYSTEM_COLLECTIONURI --rm \ |
| 98 | + --volume ${{ github.workspace }}:/onnxruntime_src \ |
| 99 | + --volume ${{ runner.temp }}:/build \ |
| 100 | + --volume $ANDROID_HOME:/android_home \ |
| 101 | + --volume $NDK_HOME_REALPATH:/ndk_home \ |
| 102 | + -w /onnxruntime_src \ |
| 103 | + -e ALLOW_RELEASED_ONNX_OPSET_ONLY=1 \ |
| 104 | + -e NIGHTLY_BUILD=1 \ |
| 105 | + -e BUILD_BUILDNUMBER=${{ github.run_number }} \ |
| 106 | + -e BUILD_SOURCEVERSION=${{ github.sha }} \ |
| 107 | + -e BUILD_ID=${{ github.run_id }} \ |
| 108 | + -e BUILD_REASON=${{ github.event_name }} \ |
| 109 | + -e BUILD_BRANCH=${{ github.ref }} \ |
| 110 | + -e ACTIONS_CACHE_URL \ |
| 111 | + -e ACTIONS_RUNTIME_TOKEN \ |
| 112 | + -e RUNNER_TEMP=/build \ |
| 113 | + ${{ steps.build_docker_image_step.outputs.full-image-name }} \ |
| 114 | + bash -c "python3 -m pip install -r /onnxruntime_src/tools/ci_build/requirements/pybind/requirements.txt && \ |
| 115 | + python3 tools/ci_build/github/linux/ort_minimal/build_ort_and_check_binary_size.py \ |
| 116 | + --build_dir /build/1a \ |
| 117 | + ${BINARY_SIZE_THRESHOLD_ARGS} \ |
| 118 | + tools/ci_build/github/linux/ort_minimal/build_check_binsize_config/android_minimal_baseline.config" |
| 119 | + shell: bash |
| 120 | + |
20 | 121 | android_nnapi_ep: |
21 | 122 | runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] |
22 | 123 | steps: |
|
32 | 133 |
|
33 | 134 | - uses: microsoft/onnxruntime-github-actions/setup-build-tools@v0.0.5 |
34 | 135 | with: |
35 | | - vcpkg-version: '2025.03.19' |
36 | | - vcpkg-hash: '17e96169cd3f266c4716fcdc1bb728e6a64f103941ece463a2834d50694eba4fb48f30135503fd466402afa139abc847ef630733c442595d1c34979f261b0114' |
| 136 | + vcpkg-version: '2025.04.09' |
| 137 | + vcpkg-hash: '31a28b58854b7c7b503db99bb2eb41582d9f835b401adf3bd0f680ef329faa4ab4278b987b586a2a6141e2c98f007833266a4e3b60c3164226a3905466a082ce' |
37 | 138 | cmake-version: '3.31.6' |
38 | 139 | cmake-hash: '42395e20b10a8e9ef3e33014f9a4eed08d46ab952e02d2c1bbc8f6133eca0d7719fb75680f9bbff6552f20fcd1b73d86860f7f39388d631f98fb6f622b37cf04' |
39 | 140 | add-cmake-to-path: 'true' |
|
71 | 172 |
|
72 | 173 |
|
73 | 174 | - name: Build Minimal ORT with NNAPI and run tests |
74 | | - run: tools/ci_build/github/linux/ort_minimal/nnapi_minimal_build_minimal_ort_and_run_tests.sh "$(pwd)" |
| 175 | + run: |
| 176 | + tools/ci_build/github/linux/ort_minimal/nnapi_minimal_build_minimal_ort_and_run_tests.sh |
| 177 | + "$(pwd)" |
75 | 178 | shell: bash |
76 | 179 |
|
77 | 180 | - name: Install psutil for emulator shutdown by run_android_emulator.py |
|
0 commit comments