Skip to content

Commit e8c6aeb

Browse files
authored
Merge branch 'ovep-develop' into jemartin/stop_context_sharing
2 parents cb57f62 + 4c0acd8 commit e8c6aeb

File tree

2 files changed

+228
-0
lines changed

2 files changed

+228
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Linux OpenVINO CI
2+
3+
on:
4+
push:
5+
branches: [ main, 'rel-*' ]
6+
pull_request:
7+
branches: ['**' ]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
packages: write # Needed if the reusable workflow pushes images
17+
attestations: write # Optional: for artifact attestations if enabled
18+
id-token: write # Optional: may be needed for OIDC authentication (e.g., ACR)
19+
20+
jobs:
21+
build_test_openvino:
22+
name: Build and Test OpenVINO EP (AlamLinux8, Py3.12)
23+
# Use the reusable workflow as the other Linux CI pipelines
24+
uses: ./.github/workflows/reusable_linux_build_intel.yml
25+
with:
26+
pool_name: "onnxruntime-github-Ubuntu2204-AMD-CPU"
27+
build_config: Release
28+
# Architecture: OpenVino only supports Intel X64
29+
architecture: x64
30+
dockerfile_path: tools/ci_build/github/linux/docker/inference/x86_64/python/openvino/Dockerfile
31+
docker_image_repo: onnxruntimeopenvino
32+
33+
execution_providers: 'openvino'
34+
35+
extra_build_flags: '--use_openvino CPU --enable_generic_interface --build_shared_lib'
36+
37+
# Python Path Prefix: Set the correct Python 3.12 path inside the manylinux container
38+
python_path_prefix: 'PATH=/opt/python/cp312-cp312/bin:$PATH'
39+
40+
run_tests: true
41+
upload_build_output: false
42+
43+
# Secrets: Pass the necessary GitHub token
44+
secrets:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
name: Reusable Linux CPU/GPU Build and Test
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
pool_name:
7+
description: 'The specific 1ES pool name (e.g., onnxruntime-github-Ubuntu2204-AMD-CPU)'
8+
required: true
9+
type: string
10+
build_config:
11+
description: 'Build configuration (Debug or Release)'
12+
required: true
13+
type: string
14+
architecture:
15+
description: 'Target architecture (x64 or arm64)'
16+
required: true
17+
type: string
18+
dockerfile_path:
19+
description: 'Path to the Dockerfile relative to the workspace root'
20+
required: true
21+
type: string
22+
docker_image_repo:
23+
description: 'Name for the Docker image repository'
24+
required: true
25+
type: string
26+
docker_build_args:
27+
description: 'Arguments to pass to the docker image build command'
28+
required: false
29+
type: string
30+
default: ''
31+
execution_providers:
32+
description: 'Space-separated list of execution providers to enable (passed to build.py)'
33+
required: false
34+
type: string
35+
default: ''
36+
extra_build_flags:
37+
description: 'Additional flags for the build.py script (appended after EP flags)'
38+
required: false
39+
type: string
40+
default: ''
41+
python_path_prefix:
42+
description: 'Optional prefix to add to the PATH for python command (e.g., PATH=/opt/python/cp310-cp310/bin:$PATH)'
43+
required: false
44+
type: string
45+
default: ''
46+
python_version:
47+
description: 'Python version to set up on the runner host'
48+
required: false
49+
type: string
50+
default: '3.x'
51+
run_tests:
52+
description: 'Whether to execute the test suite after building'
53+
required: false
54+
type: boolean
55+
default: true
56+
upload_build_output:
57+
description: 'Whether to upload the build output directory as an artifact (used when tests are skipped)'
58+
required: false
59+
type: boolean
60+
default: false
61+
secrets:
62+
GH_TOKEN:
63+
description: 'GitHub token for accessing actions/packages'
64+
required: true
65+
66+
jobs:
67+
build_test_pipeline:
68+
runs-on: [self-hosted, Linux, X64]
69+
permissions:
70+
contents: read
71+
packages: write
72+
attestations: write
73+
id-token: write
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v4
77+
78+
- name: Set up Python ${{ inputs.python_version }}
79+
uses: actions/setup-python@v5
80+
with:
81+
python-version: ${{ inputs.python_version }}
82+
83+
- name: Build Docker Image (${{ inputs.architecture }} / ${{ inputs.build_config }})
84+
uses: microsoft/onnxruntime-github-actions/[email protected]
85+
id: build_docker_image_step
86+
with:
87+
dockerfile: ${{ github.workspace }}/${{ inputs.dockerfile_path }}
88+
image-name: ghcr.io/microsoft/onnxruntime/${{ inputs.docker_image_repo }}
89+
build-args: ${{ inputs.docker_build_args }}
90+
push: true
91+
azure-container-registry-name: onnxruntimebuildcache
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
94+
95+
- name: Export GitHub Actions cache environment variables
96+
uses: actions/github-script@v7
97+
with:
98+
script: |
99+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
100+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
101+
# ------------- Update Step (CMake Generation) -------------
102+
- name: Generate Build Files (CMake) (${{ inputs.architecture }} / ${{ inputs.build_config }})
103+
id: update_step
104+
uses: microsoft/onnxruntime-github-actions/[email protected]
105+
with:
106+
docker_image: ${{ steps.build_docker_image_step.outputs.full-image-name }}
107+
build_config: ${{ inputs.build_config }}
108+
mode: 'update'
109+
execution_providers: ${{ inputs.execution_providers }} # Pass down EP list
110+
extra_build_flags: ${{ inputs.extra_build_flags }}
111+
python_path_prefix: ${{ inputs.python_path_prefix }}
112+
113+
# ------------- Build Step (Compilation) -------------
114+
- name: Build ONNX Runtime (${{ inputs.architecture }} / ${{ inputs.build_config }})
115+
id: build_step
116+
uses: microsoft/onnxruntime-github-actions/[email protected]
117+
with:
118+
docker_image: ${{ steps.build_docker_image_step.outputs.full-image-name }}
119+
build_config: ${{ inputs.build_config }}
120+
mode: 'build'
121+
execution_providers: ${{ inputs.execution_providers }} # Pass down EP list
122+
extra_build_flags: ${{ inputs.extra_build_flags }}
123+
python_path_prefix: ${{ inputs.python_path_prefix }}
124+
125+
# ------------- Test Step -------------
126+
- name: Test ONNX Runtime (${{ inputs.architecture }} / ${{ inputs.build_config }})
127+
id: test_step
128+
if: inputs.run_tests == true
129+
uses: microsoft/onnxruntime-github-actions/[email protected]
130+
with:
131+
docker_image: ${{ steps.build_docker_image_step.outputs.full-image-name }}
132+
build_config: ${{ inputs.build_config }}
133+
mode: 'test'
134+
execution_providers: ${{ inputs.execution_providers }} # Pass down EP list
135+
extra_build_flags: ${{ inputs.extra_build_flags }}
136+
python_path_prefix: ${{ inputs.python_path_prefix }}
137+
138+
# ------------- Prepare Artifact Step -------------
139+
- name: Prepare Build Output for Upload
140+
if: inputs.upload_build_output == true
141+
shell: bash
142+
run: |
143+
#!/bin/bash
144+
set -e -x
145+
BUILD_DIR="${{ runner.temp }}/${{ inputs.build_config }}"
146+
if [ ! -d "${BUILD_DIR}" ]; then
147+
echo "Error: Build directory ${BUILD_DIR} not found. Cannot prepare artifact."
148+
exit 1
149+
fi
150+
echo "--- Cleaning build directory: ${BUILD_DIR} ---"
151+
rm -rf "${BUILD_DIR}/onnxruntime" || true
152+
rm -rf "${BUILD_DIR}/pybind11" || true
153+
rm -rf "${BUILD_DIR}/vcpkg_installed" || true
154+
rm -f "${BUILD_DIR}/models" || true
155+
DEPS_DIR="${BUILD_DIR}/_deps"
156+
if [ -d "${DEPS_DIR}" ]; then
157+
echo "Cleaning ${DEPS_DIR}, keeping onnx-src..."
158+
find "${DEPS_DIR}" -mindepth 1 ! -regex "^${DEPS_DIR}/onnx-src\(/.*\)?$" -delete
159+
else
160+
echo "${DEPS_DIR} does not exist, skipping deps cleanup."
161+
fi
162+
echo "--- Saving executable permissions ---"
163+
cd "${BUILD_DIR}"
164+
find . -executable -type f -printf '%p\n' > perms.txt
165+
echo "--- Cleanup and permission saving complete for ${BUILD_DIR} ---"
166+
167+
# ------------- Upload Build Output Step -------------
168+
- name: Upload Build Output Artifact
169+
if: inputs.upload_build_output == true
170+
uses: actions/upload-artifact@v4
171+
with:
172+
name: build-output-${{ inputs.architecture }}-${{ inputs.build_config }}
173+
path: ${{ runner.temp }}/${{ inputs.build_config }}
174+
if-no-files-found: error
175+
176+
# ------------- Upload Log on Build Failure Step -------------
177+
- name: Upload VCPKG Manifest Install Log on Update or Build Failure
178+
if: steps.update_step.outcome == 'failure' || steps.build_step.outcome == 'failure'
179+
uses: actions/upload-artifact@v4
180+
with:
181+
name: vcpkg-manifest-install-log-${{ inputs.architecture }}-${{ inputs.build_config }}
182+
path: ${{ runner.temp }}/${{ inputs.build_config }}/${{ inputs.build_config }}/vcpkg-manifest-install.log
183+
if-no-files-found: ignore

0 commit comments

Comments
 (0)