Skip to content

Commit bb2b743

Browse files
amarin16fajin-corpchilo-mstianleiwuyf711
authored
Cherry picks for 1.21.1 (#24188)
This contains the following cherry-picks for the `1.21.1` patch release: - #23928 - #23978 - #24010 - #24017 - #24113 - #24174 (including a small change to fix a conflict) - #24179 --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Jing Fang <[email protected]> Co-authored-by: Chi Lo <[email protected]> Co-authored-by: Tianlei Wu <[email protected]> Co-authored-by: Yifan Li <[email protected]> Co-authored-by: Andreas Hussing <[email protected]> Co-authored-by: Andreas Hussing <[email protected]> Co-authored-by: George Wu <[email protected]> Co-authored-by: Yulong Wang <[email protected]> Co-authored-by: Changming Sun <[email protected]> Co-authored-by: Edward Chen <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent e0b66ca commit bb2b743

File tree

83 files changed

+4202
-2428
lines changed

Some content is hidden

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

83 files changed

+4202
-2428
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: 'Install ONNX Runtime Wheel'
2+
description: 'Uninstalls existing ONNX Runtime packages and installs a wheel from a specified directory.'
3+
inputs:
4+
whl-directory:
5+
description: 'The directory containing the ONNX Runtime wheel files.'
6+
required: true
7+
runs:
8+
using: 'composite'
9+
steps:
10+
- name: Uninstall onnxruntime packages
11+
shell: pwsh
12+
run: |
13+
python -m pip uninstall -y onnxruntime onnxruntime-gpu onnxruntime-training onnxruntime-directml -qq
14+
15+
- name: Install onnxruntime wheel from specified directory
16+
shell: pwsh
17+
run: |
18+
Get-ChildItem -Path ${{ inputs.whl-directory }}/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: "Web Build Initialize and Check on Linux"
2+
description: "Initializes and checks the ONNX Runtime Web build on Linux."
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Setup Node.js
7+
uses: actions/setup-node@v3
8+
with:
9+
node-version: "22.x"
10+
11+
- name: npm ci /js/
12+
run: npm ci
13+
shell: bash
14+
working-directory: ${{ github.workspace }}/js
15+
16+
- name: npm ci /js/common/
17+
run: npm ci
18+
shell: bash
19+
working-directory: ${{ github.workspace }}/js/common
20+
21+
- name: run onnxruntime-common tests
22+
run: npm test
23+
shell: bash
24+
working-directory: ${{ github.workspace }}/js/common
25+
26+
- name: run onnxruntime-common tests (enable Float16Array)
27+
run: npm run test:f16
28+
shell: bash
29+
working-directory: ${{ github.workspace }}/js/common
30+
31+
- name: npm ci /js/web/
32+
run: npm ci
33+
shell: bash
34+
working-directory: ${{ github.workspace }}/js/web
35+
36+
- name: run TypeScript type check in /js/web/
37+
run: npm run prebuild
38+
shell: bash
39+
working-directory: ${{ github.workspace }}/js/web
40+
41+
- name: run ESLint
42+
run: npm run lint
43+
shell: bash
44+
working-directory: ${{ github.workspace }}/js
45+
46+
- name: Format code
47+
run: npm run format
48+
shell: bash
49+
working-directory: ${{ github.workspace }}/js
50+
51+
- name: Check unformatted files
52+
run: |
53+
node -e "a=require('child_process').execSync('git diff --name-only').toString();if(a)throw new Error('Following source files are not formatted: (did you run \"npm run format\"?)\n'+a)"
54+
shell: bash
55+
working-directory: ${{ github.workspace }}/js
56+
57+
- name: TypeDoc Validation
58+
run: npx typedoc --emit none --treatWarningsAsErrors
59+
shell: bash
60+
working-directory: ${{ github.workspace }}/js/common
61+
62+
- name: Generating documents
63+
run: npm run build:doc
64+
shell: bash
65+
working-directory: ${{ github.workspace }}/js/web
66+
67+
- name: Check out of dated documents
68+
run: |
69+
node -e "a=require('child_process').execSync('git diff --name-only').toString();if(a)throw new Error('Following documents are not up-to-date: (did you run \"npm run build:doc\"?)\n'+a)"
70+
shell: bash
71+
working-directory: ${{ github.workspace }}/js/web
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: 'Locate vcvarsall and Setup Environment'
2+
description: 'Locates vcvarsall.bat, sets up the environment, and handles PATH updates.'
3+
inputs:
4+
architecture:
5+
description: 'Target architecture (x64 or x86)'
6+
required: true
7+
default: 'x64'
8+
outputs:
9+
vcvarsall_path:
10+
description: "Path to vcvarsall.bat"
11+
value: ${{ steps.find-vcvarsall.outputs.vcvarsall_path }}
12+
runs:
13+
using: "composite"
14+
steps:
15+
16+
- name: Setup VCPKG
17+
uses: microsoft/onnxruntime-github-actions/[email protected]
18+
with:
19+
vcpkg-version: '2025.03.19'
20+
vcpkg-hash: '17e96169cd3f266c4716fcdc1bb728e6a64f103941ece463a2834d50694eba4fb48f30135503fd466402afa139abc847ef630733c442595d1c34979f261b0114'
21+
cmake-version: '3.31.6'
22+
cmake-hash: '0f1584e8666cf4a65ec514bd02afe281caabf1d45d2c963f3151c41484f457386aa03273ab25776a670be02725354ce0b46f3a5121857416da37366342a833a0'
23+
add-cmake-to-path: 'true'
24+
disable-terrapin: 'false'
25+
26+
- name: Verify vcpkg setup
27+
shell: pwsh # Use powershell to easily access env var
28+
run: |
29+
Write-Host "VCPKG_INSTALLATION_ROOT is set to: $env:VCPKG_INSTALLATION_ROOT"
30+
& "$env:VCPKG_INSTALLATION_ROOT/vcpkg" version
31+
32+
- name: Find vcvarsall.bat
33+
id: find-vcvarsall
34+
shell: python # Use Python shell
35+
run: |
36+
import os
37+
import subprocess
38+
39+
vswhere_path = os.path.join(os.environ["ProgramFiles(x86)"], "Microsoft Visual Studio", "Installer", "vswhere.exe")
40+
41+
try:
42+
process = subprocess.run([vswhere_path, "-latest", "-property", "installationPath"], capture_output=True, text=True, check=True)
43+
vs_install_path = process.stdout.strip()
44+
vcvarsall_path = os.path.join(vs_install_path, "VC", "Auxiliary", "Build", "vcvarsall.bat")
45+
46+
if os.path.exists(vcvarsall_path):
47+
print(f"vcvarsall found at: {vcvarsall_path}")
48+
# Use GITHUB_OUTPUT environment variable
49+
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
50+
f.write(f"vcvarsall_path={vcvarsall_path}\n")
51+
else:
52+
print(f"vcvarsall.bat not found at expected path: {vcvarsall_path}")
53+
# Use 'exit(1)' for Python to properly signal failure to GitHub Actions
54+
exit(1)
55+
56+
57+
except subprocess.CalledProcessError as e:
58+
print(f"Error running vswhere.exe: {e}")
59+
print(f"vswhere output: {e.stdout}")
60+
print(f"vswhere stderr: {e.stderr}")
61+
exit(1) # Exit with a non-zero code on error
62+
except FileNotFoundError:
63+
print(f"vswhere.exe not found at: {vswhere_path}")
64+
exit(1)
65+
66+
67+
- name: Setup Environment
68+
shell: cmd
69+
run: |
70+
REM Get initial environment variables
71+
set > initial_env.txt
72+
73+
REM Call vcvarsall.bat using the output from the previous step
74+
call "${{ steps.find-vcvarsall.outputs.vcvarsall_path }}" ${{ inputs.architecture }}
75+
76+
REM Get environment variables after calling vcvarsall.bat
77+
set > final_env.txt
78+
79+
REM Call the Python script to update the GitHub Actions environment
80+
python ${{ github.action_path }}\update_environment.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@echo off
2+
setlocal
3+
4+
set vswherepath="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
5+
set vcvarsall_arch=%1
6+
if "%vcvarsall_arch%" == "x86" (
7+
set vcvarsall_arch=x86
8+
) else (
9+
set vcvarsall_arch=x64
10+
)
11+
12+
for /f "usebackq delims=" %%i in (`%vswherepath% -latest -property installationPath`) do (
13+
if exist "%%i\VC\Auxiliary\Build\vcvars%vcvarsall_arch%.bat" (
14+
set "vcvarsall=%%i\VC\Auxiliary\Build\vcvars%vcvarsall_arch%.bat"
15+
)
16+
)
17+
18+
echo "Get initial environment variables"
19+
set > initial_env.txt
20+
21+
echo "Call vcvarsall.bat"
22+
call "%vcvarsall%"
23+
24+
echo "Get environment variables after calling vcvarsall.bat"
25+
set > final_env.txt
26+
27+
echo "Call the Python script to update the GitHub Actions environment"
28+
python "%~dp0\update_environment.py"
29+
30+
endlocal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import os
2+
import re
3+
4+
5+
def read_env_file(filepath):
6+
env_vars = {}
7+
with open(filepath) as f:
8+
for line in f:
9+
match = re.match(r"^(.*?)=(.*)$", line.strip())
10+
if match:
11+
env_vars[match.group(1).upper()] = match.group(2)
12+
return env_vars
13+
14+
15+
initial_env = read_env_file("initial_env.txt")
16+
final_env = read_env_file("final_env.txt")
17+
18+
for key, value in final_env.items():
19+
if key not in initial_env or initial_env[key] != value:
20+
if key.startswith("_"):
21+
continue
22+
if key.upper() == "PATH":
23+
new_paths = value.split(";")
24+
initial_paths = initial_env.get("PATH", "").split(";")
25+
added_paths = [p for p in new_paths if p not in initial_paths and p]
26+
27+
if added_paths:
28+
print("Adding paths")
29+
with open(os.environ["GITHUB_PATH"], "a") as f:
30+
for path in added_paths:
31+
print(f"Adding PATH: {path}")
32+
f.write(path + os.linesep)
33+
else:
34+
# Use GITHUB_ENV
35+
with open(os.environ["GITHUB_ENV"], "a") as f:
36+
print(f"Setting {key}={value}\n")
37+
f.write(f"{key}={value}\n")
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: "macOS CI pipeline setup steps"
2+
description: "Common setup steps for macOS CI pipelines"
3+
4+
inputs:
5+
platform_machine:
6+
required: false
7+
type: string
8+
default: "arm64"
9+
python_version:
10+
required: false
11+
type: string
12+
default: "3.11"
13+
node_version:
14+
required: false
15+
type: string
16+
default: "20.x"
17+
java_version:
18+
required: false
19+
type: string
20+
default: "17"
21+
xcode_version:
22+
required: false
23+
type: string
24+
default: "16"
25+
use_cache:
26+
required: false
27+
type: boolean
28+
default: false
29+
30+
runs:
31+
using: "composite"
32+
steps:
33+
- name: Use Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ inputs.python_version }}
37+
38+
- name: Verify machine architecture
39+
shell: python
40+
run: |
41+
import platform
42+
print(f"Running on {platform.machine()}")
43+
assert platform.machine().lower() == "${{ inputs.platform_machine}}", "This job expects to be run on an ${{ inputs.platform_machine}} machine."
44+
45+
- name: Use Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: ${{ inputs.node_version }}
49+
50+
- name: Install coreutils and ninja
51+
shell: bash
52+
run: brew install coreutils ninja
53+
54+
- name: Install Java
55+
uses: actions/setup-java@v4
56+
with:
57+
distribution: "temurin"
58+
java-version: ${{ inputs.java_version }}
59+
60+
- name: Use Xcode ${{ inputs.xcode_version }}
61+
shell: bash
62+
run: |
63+
XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ inputs.xcode_version }}.app/Contents/Developer"
64+
sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"
65+
66+
- name: Export GitHub Actions cache environment variables
67+
if: ${{ inputs.use_cache }}
68+
uses: actions/github-script@v7
69+
with:
70+
script: |
71+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
72+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
73+
74+
- name: Install python dependencies
75+
shell: bash
76+
working-directory: ${{ github.workspace }}
77+
run: |
78+
python -m pip install --upgrade pip
79+
python -m pip install -r requirements-dev.txt

0 commit comments

Comments
 (0)