Skip to content

Support for triggering Internal Ci(Intel Internal) #665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2025
Merged
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
45 changes: 45 additions & 0 deletions .github/workflows/linux_openvino_ci_intel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Linux OpenVINO CI

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

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
packages: write # Needed if the reusable workflow pushes images
attestations: write # Optional: for artifact attestations if enabled
id-token: write # Optional: may be needed for OIDC authentication (e.g., ACR)

jobs:
build_test_openvino:
name: Build and Test OpenVINO EP (AlamLinux8, Py3.12)
# Use the reusable workflow as the other Linux CI pipelines
uses: ./.github/workflows/reusable_linux_build_intel.yml
with:
pool_name: "onnxruntime-github-Ubuntu2204-AMD-CPU"
build_config: Release
# Architecture: OpenVino only supports Intel X64
architecture: x64
dockerfile_path: tools/ci_build/github/linux/docker/inference/x86_64/python/openvino/Dockerfile
docker_image_repo: onnxruntimeopenvino

execution_providers: 'openvino'

extra_build_flags: '--use_openvino CPU --enable_generic_interface --build_shared_lib'

# Python Path Prefix: Set the correct Python 3.12 path inside the manylinux container
python_path_prefix: 'PATH=/opt/python/cp312-cp312/bin:$PATH'

run_tests: true
upload_build_output: false

# Secrets: Pass the necessary GitHub token
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
183 changes: 183 additions & 0 deletions .github/workflows/reusable_linux_build_intel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
name: Reusable Linux CPU/GPU Build and Test

on:
workflow_call:
inputs:
pool_name:
description: 'The specific 1ES pool name (e.g., onnxruntime-github-Ubuntu2204-AMD-CPU)'
required: true
type: string
build_config:
description: 'Build configuration (Debug or Release)'
required: true
type: string
architecture:
description: 'Target architecture (x64 or arm64)'
required: true
type: string
dockerfile_path:
description: 'Path to the Dockerfile relative to the workspace root'
required: true
type: string
docker_image_repo:
description: 'Name for the Docker image repository'
required: true
type: string
docker_build_args:
description: 'Arguments to pass to the docker image build command'
required: false
type: string
default: ''
execution_providers:
description: 'Space-separated list of execution providers to enable (passed to build.py)'
required: false
type: string
default: ''
extra_build_flags:
description: 'Additional flags for the build.py script (appended after EP flags)'
required: false
type: string
default: ''
python_path_prefix:
description: 'Optional prefix to add to the PATH for python command (e.g., PATH=/opt/python/cp310-cp310/bin:$PATH)'
required: false
type: string
default: ''
python_version:
description: 'Python version to set up on the runner host'
required: false
type: string
default: '3.x'
run_tests:
description: 'Whether to execute the test suite after building'
required: false
type: boolean
default: true
upload_build_output:
description: 'Whether to upload the build output directory as an artifact (used when tests are skipped)'
required: false
type: boolean
default: false
secrets:
GH_TOKEN:
description: 'GitHub token for accessing actions/packages'
required: true

jobs:
build_test_pipeline:
runs-on: [self-hosted, Linux, X64]
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}

- name: Build Docker Image (${{ inputs.architecture }} / ${{ inputs.build_config }})
uses: microsoft/onnxruntime-github-actions/[email protected]
id: build_docker_image_step
with:
dockerfile: ${{ github.workspace }}/${{ inputs.dockerfile_path }}
image-name: ghcr.io/microsoft/onnxruntime/${{ inputs.docker_image_repo }}
build-args: ${{ inputs.docker_build_args }}
push: true
azure-container-registry-name: onnxruntimebuildcache
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
# ------------- Update Step (CMake Generation) -------------
- name: Generate Build Files (CMake) (${{ inputs.architecture }} / ${{ inputs.build_config }})
id: update_step
uses: microsoft/onnxruntime-github-actions/[email protected]
with:
docker_image: ${{ steps.build_docker_image_step.outputs.full-image-name }}
build_config: ${{ inputs.build_config }}
mode: 'update'
execution_providers: ${{ inputs.execution_providers }} # Pass down EP list
extra_build_flags: ${{ inputs.extra_build_flags }}
python_path_prefix: ${{ inputs.python_path_prefix }}

# ------------- Build Step (Compilation) -------------
- name: Build ONNX Runtime (${{ inputs.architecture }} / ${{ inputs.build_config }})
id: build_step
uses: microsoft/onnxruntime-github-actions/[email protected]
with:
docker_image: ${{ steps.build_docker_image_step.outputs.full-image-name }}
build_config: ${{ inputs.build_config }}
mode: 'build'
execution_providers: ${{ inputs.execution_providers }} # Pass down EP list
extra_build_flags: ${{ inputs.extra_build_flags }}
python_path_prefix: ${{ inputs.python_path_prefix }}

# ------------- Test Step -------------
- name: Test ONNX Runtime (${{ inputs.architecture }} / ${{ inputs.build_config }})
id: test_step
if: inputs.run_tests == true
uses: microsoft/onnxruntime-github-actions/[email protected]
with:
docker_image: ${{ steps.build_docker_image_step.outputs.full-image-name }}
build_config: ${{ inputs.build_config }}
mode: 'test'
execution_providers: ${{ inputs.execution_providers }} # Pass down EP list
extra_build_flags: ${{ inputs.extra_build_flags }}
python_path_prefix: ${{ inputs.python_path_prefix }}

# ------------- Prepare Artifact Step -------------
- name: Prepare Build Output for Upload
if: inputs.upload_build_output == true
shell: bash
run: |
#!/bin/bash
set -e -x
BUILD_DIR="${{ runner.temp }}/${{ inputs.build_config }}"
if [ ! -d "${BUILD_DIR}" ]; then
echo "Error: Build directory ${BUILD_DIR} not found. Cannot prepare artifact."
exit 1
fi
echo "--- Cleaning build directory: ${BUILD_DIR} ---"
rm -rf "${BUILD_DIR}/onnxruntime" || true
rm -rf "${BUILD_DIR}/pybind11" || true
rm -rf "${BUILD_DIR}/vcpkg_installed" || true
rm -f "${BUILD_DIR}/models" || true
DEPS_DIR="${BUILD_DIR}/_deps"
if [ -d "${DEPS_DIR}" ]; then
echo "Cleaning ${DEPS_DIR}, keeping onnx-src..."
find "${DEPS_DIR}" -mindepth 1 ! -regex "^${DEPS_DIR}/onnx-src\(/.*\)?$" -delete
else
echo "${DEPS_DIR} does not exist, skipping deps cleanup."
fi
echo "--- Saving executable permissions ---"
cd "${BUILD_DIR}"
find . -executable -type f -printf '%p\n' > perms.txt
echo "--- Cleanup and permission saving complete for ${BUILD_DIR} ---"
# ------------- Upload Build Output Step -------------
- name: Upload Build Output Artifact
if: inputs.upload_build_output == true
uses: actions/upload-artifact@v4
with:
name: build-output-${{ inputs.architecture }}-${{ inputs.build_config }}
path: ${{ runner.temp }}/${{ inputs.build_config }}
if-no-files-found: error

# ------------- Upload Log on Build Failure Step -------------
- name: Upload VCPKG Manifest Install Log on Update or Build Failure
if: steps.update_step.outcome == 'failure' || steps.build_step.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: vcpkg-manifest-install-log-${{ inputs.architecture }}-${{ inputs.build_config }}
path: ${{ runner.temp }}/${{ inputs.build_config }}/${{ inputs.build_config }}/vcpkg-manifest-install.log
if-no-files-found: ignore