Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@
# Defaults for all languages.
BasedOnStyle: Google

ColumnLimit: 120
# Setting ColumnLimit to 0 so developer choices about where to break lines are maintained.
# Developers are responsible for adhering to the 120 character maximum.
ColumnLimit: 120
SortIncludes: false
DerivePointerAlignment: false
# Avoid adding spaces between tokens in GSL_SUPPRESS arguments.
# E.g., don't change "GSL_SUPPRESS(r.11)" to "GSL_SUPPRESS(r .11)".
WhitespaceSensitiveMacros: ["GSL_SUPPRESS"]

# if you want to customize when working locally see https://clang.llvm.org/docs/ClangFormatStyleOptions.html for options.
# See ReformatSource.ps1 for a script to update all source according to the current options in this file.
# e.g. customizations to use Allman bracing and more indenting.
# AccessModifierOffset: -2
# BreakBeforeBraces: Allman
# CompactNamespaces: false
# IndentCaseLabels: true
# IndentWidth: 4
# NamespaceIndentation: All

...
99 changes: 99 additions & 0 deletions .github/actions/setup-android-ndk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# .github/actions/setup-android-ndk/action.yml
name: 'Setup Android NDK'
description: 'Installs and configures a specific version of the Android NDK'
inputs:
ndk-version:
description: 'The version of the Android NDK to install (e.g., 27.2.12479018)'
required: true
default: '28.0.13004108'
android-sdk-root:
description: 'The root directory of the Android SDK'
required: true
default: '/usr/local/lib/android/sdk'

runs:
using: "composite" # Use a composite action for multiple shell commands
steps:
- name: Install coreutils and ninja
shell: bash
run: sudo apt-get update -y && sudo apt-get install -y coreutils ninja-build

- name: Install Android NDK
shell: bash
run: |
set -e
python -m pip install psutil
"${{ inputs.android-sdk-root }}/cmdline-tools/latest/bin/sdkmanager" --install "ndk;${{ inputs.ndk-version }}"

NDK_PATH="${{ inputs.android-sdk-root }}/ndk/${{ inputs.ndk-version }}"
if [[ ! -d "${NDK_PATH}" ]]; then
echo "NDK directory is not in expected location: ${NDK_PATH}"
exit 1
fi

# Use standard environment variable setting in bash and add to GITHUB_ENV
echo "ANDROID_NDK_HOME=${NDK_PATH}" >> $GITHUB_ENV
echo "ANDROID_NDK_ROOT=${NDK_PATH}" >> $GITHUB_ENV
echo "ANDROID_NDK_HOME: ${NDK_PATH}"
echo "ANDROID_NDK_ROOT: ${NDK_PATH}"

- name: Check if emulator are installed and add to PATH
shell: bash
run: |
if [[ ":$PATH:" == *":${ANDROID_SDK_ROOT}/emulator:"* ]]; then
echo "${ANDROID_SDK_ROOT}/emulator is in PATH"
else
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --install "emulator"
echo "${ANDROID_SDK_ROOT}/emulator" >> $GITHUB_PATH
fi

- name: Check if platform tools are installed and add to PATH
shell: bash
run: |
if [[ ":$PATH:" == *":${ANDROID_SDK_ROOT}/platform-tools:"* ]]; then
echo "${ANDROID_SDK_ROOT}/platform-tools is in PATH"
else
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --install "platform-tools"
echo "${ANDROID_SDK_ROOT}/platform-tools" >> $GITHUB_PATH
fi
ls -R "${ANDROID_SDK_ROOT}/platform-tools"

- name: Create Android Emulator
shell: bash
env:
ANDROID_AVD_HOME: ${{ runner.temp }}/android-avd
run: |
python3 tools/python/run_android_emulator.py \
--android-sdk-root "${ANDROID_SDK_ROOT}" \
--create-avd --system-image "system-images;android-31;default;x86_64"

- name: List Android AVDs
shell: bash
env:
ANDROID_AVD_HOME: ${{ runner.temp }}/android-avd
run: |
"${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/avdmanager" list avd

- name: Check emulator.pid does not exist
shell: bash
run: |
if test -f ./emulator.pid; then
echo "Emulator PID file was not expected to exist but does and has pid: `cat ./emulator.pid`"
exit 1
fi

- name: Start Android Emulator
shell: bash
env:
ANDROID_AVD_HOME: ${{ runner.temp }}/android-avd
run: |
set -e -x
python3 tools/python/run_android_emulator.py \
--android-sdk-root "${ANDROID_SDK_ROOT}" \
--start --emulator-extra-args="-partition-size 2047" \
--emulator-pid-file ./emulator.pid
echo "Emulator PID: `cat ./emulator.pid`"

- name: View Android ENVs
shell: bash
run: env | grep ANDROID
16 changes: 12 additions & 4 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
# This workflow was copied from the link above.

name: "Validate Gradle Wrapper"
on: [push, pull_request]
on:
push:
branches: [main, 'rel-*']
pull_request:
branches: [main, 'rel-*']
workflow_dispatch:

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
runs-on: ["self-hosted", "1ES.Pool=onnxruntime-examples-Ubuntu2204-CPU"]
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/checkout@v5
- uses: gradle/actions/wrapper-validation@v4
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
cancel-in-progress: true
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint

on:
push:
branches: [main, 'rel-*']
pull_request:
branches: [main, 'rel-*']
workflow_dispatch:

permissions:
contents: read
packages: write
attestations: write
id-token: write

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run lintrunner
run: lintrunner
Loading
Loading