Skip to content

Commit 5d8be3e

Browse files
authored
Fix pipeline issues (microsoft#530)
1 parent 34b09e1 commit 5d8be3e

33 files changed

+1541
-171
lines changed

.clang-format

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
# Defaults for all languages.
33
BasedOnStyle: Google
44

5-
ColumnLimit: 120
5+
# Setting ColumnLimit to 0 so developer choices about where to break lines are maintained.
6+
# Developers are responsible for adhering to the 120 character maximum.
7+
ColumnLimit: 120
8+
SortIncludes: false
9+
DerivePointerAlignment: false
10+
# Avoid adding spaces between tokens in GSL_SUPPRESS arguments.
11+
# E.g., don't change "GSL_SUPPRESS(r.11)" to "GSL_SUPPRESS(r .11)".
12+
WhitespaceSensitiveMacros: ["GSL_SUPPRESS"]
13+
14+
# if you want to customize when working locally see https://clang.llvm.org/docs/ClangFormatStyleOptions.html for options.
15+
# See ReformatSource.ps1 for a script to update all source according to the current options in this file.
16+
# e.g. customizations to use Allman bracing and more indenting.
17+
# AccessModifierOffset: -2
18+
# BreakBeforeBraces: Allman
19+
# CompactNamespaces: false
20+
# IndentCaseLabels: true
21+
# IndentWidth: 4
22+
# NamespaceIndentation: All
623

724
...
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# .github/actions/setup-android-ndk/action.yml
2+
name: 'Setup Android NDK'
3+
description: 'Installs and configures a specific version of the Android NDK'
4+
inputs:
5+
ndk-version:
6+
description: 'The version of the Android NDK to install (e.g., 27.2.12479018)'
7+
required: true
8+
default: '28.0.13004108'
9+
android-sdk-root:
10+
description: 'The root directory of the Android SDK'
11+
required: true
12+
default: '/usr/local/lib/android/sdk'
13+
14+
runs:
15+
using: "composite" # Use a composite action for multiple shell commands
16+
steps:
17+
- name: Install coreutils and ninja
18+
shell: bash
19+
run: sudo apt-get update -y && sudo apt-get install -y coreutils ninja-build
20+
21+
- name: Install Android NDK
22+
shell: bash
23+
run: |
24+
set -e
25+
python -m pip install psutil
26+
"${{ inputs.android-sdk-root }}/cmdline-tools/latest/bin/sdkmanager" --install "ndk;${{ inputs.ndk-version }}"
27+
28+
NDK_PATH="${{ inputs.android-sdk-root }}/ndk/${{ inputs.ndk-version }}"
29+
if [[ ! -d "${NDK_PATH}" ]]; then
30+
echo "NDK directory is not in expected location: ${NDK_PATH}"
31+
exit 1
32+
fi
33+
34+
# Use standard environment variable setting in bash and add to GITHUB_ENV
35+
echo "ANDROID_NDK_HOME=${NDK_PATH}" >> $GITHUB_ENV
36+
echo "ANDROID_NDK_ROOT=${NDK_PATH}" >> $GITHUB_ENV
37+
echo "ANDROID_NDK_HOME: ${NDK_PATH}"
38+
echo "ANDROID_NDK_ROOT: ${NDK_PATH}"
39+
40+
- name: Check if emulator are installed and add to PATH
41+
shell: bash
42+
run: |
43+
if [[ ":$PATH:" == *":${ANDROID_SDK_ROOT}/emulator:"* ]]; then
44+
echo "${ANDROID_SDK_ROOT}/emulator is in PATH"
45+
else
46+
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --install "emulator"
47+
echo "${ANDROID_SDK_ROOT}/emulator" >> $GITHUB_PATH
48+
fi
49+
50+
- name: Check if platform tools are installed and add to PATH
51+
shell: bash
52+
run: |
53+
if [[ ":$PATH:" == *":${ANDROID_SDK_ROOT}/platform-tools:"* ]]; then
54+
echo "${ANDROID_SDK_ROOT}/platform-tools is in PATH"
55+
else
56+
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --install "platform-tools"
57+
echo "${ANDROID_SDK_ROOT}/platform-tools" >> $GITHUB_PATH
58+
fi
59+
ls -R "${ANDROID_SDK_ROOT}/platform-tools"
60+
61+
- name: Create Android Emulator
62+
shell: bash
63+
env:
64+
ANDROID_AVD_HOME: ${{ runner.temp }}/android-avd
65+
run: |
66+
python3 tools/python/run_android_emulator.py \
67+
--android-sdk-root "${ANDROID_SDK_ROOT}" \
68+
--create-avd --system-image "system-images;android-31;default;x86_64"
69+
70+
- name: List Android AVDs
71+
shell: bash
72+
env:
73+
ANDROID_AVD_HOME: ${{ runner.temp }}/android-avd
74+
run: |
75+
"${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/avdmanager" list avd
76+
77+
- name: Check emulator.pid does not exist
78+
shell: bash
79+
run: |
80+
if test -f ./emulator.pid; then
81+
echo "Emulator PID file was not expected to exist but does and has pid: `cat ./emulator.pid`"
82+
exit 1
83+
fi
84+
85+
- name: Start Android Emulator
86+
shell: bash
87+
env:
88+
ANDROID_AVD_HOME: ${{ runner.temp }}/android-avd
89+
run: |
90+
set -e -x
91+
python3 tools/python/run_android_emulator.py \
92+
--android-sdk-root "${ANDROID_SDK_ROOT}" \
93+
--start --emulator-extra-args="-partition-size 2047" \
94+
--emulator-pid-file ./emulator.pid
95+
echo "Emulator PID: `cat ./emulator.pid`"
96+
97+
- name: View Android ENVs
98+
shell: bash
99+
run: env | grep ANDROID

.github/workflows/gradle-wrapper-validation.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,20 @@
33
# This workflow was copied from the link above.
44

55
name: "Validate Gradle Wrapper"
6-
on: [push, pull_request]
6+
on:
7+
push:
8+
branches: [main, 'rel-*']
9+
pull_request:
10+
branches: [main, 'rel-*']
11+
workflow_dispatch:
712

813
jobs:
914
validation:
1015
name: "Validation"
11-
runs-on: ubuntu-latest
16+
runs-on: ["self-hosted", "1ES.Pool=onnxruntime-examples-Ubuntu2204-CPU"]
1217
steps:
13-
- uses: actions/checkout@v3
14-
- uses: gradle/wrapper-validation-action@v1
18+
- uses: actions/checkout@v5
19+
- uses: gradle/actions/wrapper-validation@v4
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
22+
cancel-in-progress: true

.github/workflows/lint.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main, 'rel-*']
6+
pull_request:
7+
branches: [main, 'rel-*']
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
packages: write
13+
attestations: write
14+
id-token: write
15+
16+
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v5
21+
- name: Set up Python
22+
uses: actions/setup-python@v6
23+
with:
24+
python-version: '3.10'
25+
- name: Install dependencies
26+
run: pip install -r requirements.txt
27+
- name: Run lintrunner
28+
run: lintrunner

0 commit comments

Comments
 (0)