Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5694a73

Browse files
committedApr 24, 2025·
update
1 parent 7801c51 commit 5694a73

File tree

52 files changed

+2747
-2554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2747
-2554
lines changed
 

‎.github/actions/locate-vcvarsall-and-setup-env/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ runs:
1414
steps:
1515

1616
- name: Setup VCPKG
17-
uses: microsoft/onnxruntime-github-actions/setup-build-tools@v0.0.5
17+
uses: microsoft/onnxruntime-github-actions/setup-build-tools@v0.0.6
1818
with:
1919
vcpkg-version: '2025.03.19'
2020
vcpkg-hash: '17e96169cd3f266c4716fcdc1bb728e6a64f103941ece463a2834d50694eba4fb48f30135503fd466402afa139abc847ef630733c442595d1c34979f261b0114'

‎.github/workflows/android.yml

Lines changed: 108 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,119 @@ on:
66
branches:
77
- main
88
- rel-*
9+
- snnn/ci
910
pull_request:
1011
branches:
1112
- main
1213
- rel-*
1314
workflow_dispatch:
1415

1516
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
1825

1926
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+
20122
android_nnapi_ep:
21123
runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"]
22124
steps:
@@ -30,7 +132,7 @@ jobs:
30132
architecture: x64
31133

32134

33-
- uses: microsoft/onnxruntime-github-actions/setup-build-tools@v0.0.5
135+
- uses: microsoft/onnxruntime-github-actions/setup-build-tools@v0.0.6
34136
with:
35137
vcpkg-version: '2025.03.19'
36138
vcpkg-hash: '17e96169cd3f266c4716fcdc1bb728e6a64f103941ece463a2834d50694eba4fb48f30135503fd466402afa139abc847ef630733c442595d1c34979f261b0114'
@@ -71,7 +173,9 @@ jobs:
71173

72174

73175
- 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)"
75179
shell: bash
76180

77181
- name: Install psutil for emulator shutdown by run_android_emulator.py

0 commit comments

Comments
 (0)
Please sign in to comment.