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