5cbd3f29e3
Fuzz / Run fuzz harnesses (${{ github.event_name == 'schedule' && 'nightly' || 'smoke' }}) (push) Has been cancelled
Create Releases / call-mac (push) Has been cancelled
Create Releases / call-linux (push) Has been cancelled
Create Releases / call-sdist (push) Has been cancelled
Create Releases / call-win (push) Has been cancelled
Create Releases / call-pyodide (push) Has been cancelled
Windows_No_Exception_CI / build (x64, 3.10) (push) Has been cancelled
Check URLs / build (push) Has been cancelled
Create Releases / Attest CI build artifacts (push) Has been cancelled
Create Releases / Check for Publish release build to pypi (push) Has been cancelled
Create Releases / Check for Publish preview build to test.pypi-weekly (push) Has been cancelled
Create Releases / Publish preview build to test.pypi-weekly (push) Has been cancelled
Create Releases / Check for Publish release build to test.pypi (rc-candidates) (push) Has been cancelled
Create Releases / Publish release build to test.pypi (push) Has been cancelled
Create Releases / Check for Publish preview build to pypi-weekly (push) Has been cancelled
Create Releases / Publish preview build to pypi-weekly (push) Has been cancelled
Create Releases / Publish release build to pypi (push) Has been cancelled
Create Releases / test source distribution (push) Has been cancelled
clang-tidy / clang-tidy (push) Has been cancelled
Lint / Validate SBOM (push) Has been cancelled
Lint / Enforce style (push) Has been cancelled
CI / Test windows-2022, 3.14, External, debug=0, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
CI / Test windows-latest, 3.10, Internal, debug=0, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
CI / Test windows-latest, 3.14, Internal, debug=0, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
CI / Test windows-latest, 3.14t, Internal, debug=0, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
CI / Test ubuntu-24.04, 3.14, Internal, debug=1, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
CI / Test ubuntu-24.04, 3.14, External, debug=0, unity_build=1, onnx_ml=1, autogen=1 (push) Has been cancelled
CI / Test ubuntu-24.04, 3.14, External, debug=0, unity_build=0, onnx_ml=0, autogen=0 (push) Has been cancelled
CI / Test macos-latest, 3.10, Internal, debug=0, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
CI / Test macos-latest, 3.14, Internal, debug=0, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
CI / Test macos-latest, 3.14t, Internal, debug=0, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
CI / Test ubuntu-24.04, 3.14, External, debug=0, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
CI / Test ubuntu-24.04, 3.10, Internal, debug=0, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
CI / Test ubuntu-24.04, 3.14, Internal, debug=0, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
CI / Test ubuntu-24.04, 3.14t, Internal, debug=0, unity_build=0, onnx_ml=1, autogen=0 (push) Has been cancelled
Pixi CI / Install and lint (ubuntu-24.04-arm) (push) Has been cancelled
Pixi CI / Install and lint (windows-2022) (push) Has been cancelled
Pixi CI / Xcode generator build (push) Has been cancelled
Pixi CI / Install and test (macos-latest, default) (push) Has been cancelled
Pixi CI / Install and test (ubuntu-24.04-arm, default) (push) Has been cancelled
Pixi CI / Install and test (ubuntu-latest, default) (push) Has been cancelled
Pixi CI / Install and test (windows-2022, default) (push) Has been cancelled
Pixi CI / Install and test (macos-latest, oldies) (push) Has been cancelled
Pixi CI / Install and test (ubuntu-24.04-arm, oldies) (push) Has been cancelled
Pixi CI / Install and test (ubuntu-latest, oldies) (push) Has been cancelled
Pixi CI / Install and test (windows-2022, oldies) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Copilot Setup Steps / copilot-setup-steps (push) Has been cancelled
Generate and publish ONNX docs / build (push) Has been cancelled
Generate and publish ONNX docs / deploy (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
281 lines
11 KiB
YAML
281 lines
11 KiB
YAML
# Copyright (c) ONNX Project Contributors
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
name: CI
|
|
|
|
env:
|
|
ASAN_OPTIONS: detect_leaks=0:symbolize=1:detect_stack_use_after_return=true:strict_init_order=true:detect_odr_violation=1:detect_container_overflow=0:check_initialization_order=true:debug=true:fast_unwind_on_malloc=1:verify_asan_link_order=0
|
|
UBSAN_OPTIONS: print_stacktrace=1
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 0 * * *' # every day at midnight for reporting code coverage to codecov
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
merge_group:
|
|
workflow_dispatch:
|
|
|
|
permissions: # set top-level default permissions as security good practice
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: Test ${{ matrix.os }}, ${{ matrix.python_version }}, ${{ matrix.protobuf_type }}, debug=${{ matrix.debug_build }}, unity_build=${{ matrix.unity_build }}, onnx_ml=${{ matrix.onnx_ml }}, autogen=${{ matrix.autogenerate_files }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-24.04, windows-latest, macos-latest]
|
|
# Test on the oldest and latest supported Python versions
|
|
autogenerate_files: [0]
|
|
debug_build: [0]
|
|
onnx_ml: [1]
|
|
protobuf_type: ['Internal']
|
|
python_version: ['3.14t', '3.14', '3.10']
|
|
unity_build: [0]
|
|
|
|
include:
|
|
# Ubuntu debug build runs with sanitizer
|
|
- python_version: "3.14"
|
|
autogenerate_files: 0
|
|
debug_build: 1
|
|
onnx_ml: 1
|
|
os: "ubuntu-24.04"
|
|
protobuf_type: 'Internal'
|
|
unity_build: 0
|
|
|
|
# Test compilation with dynamically linked protobuf.
|
|
# This is actually redundant with the pixi-tests which
|
|
# also use dynamic linking.
|
|
- python_version: "3.14"
|
|
autogenerate_files: 0
|
|
debug_build: 0
|
|
onnx_ml: 1
|
|
os: "ubuntu-24.04"
|
|
protobuf_type: 'External'
|
|
unity_build: 0
|
|
- python_version: "3.14"
|
|
autogenerate_files: 0
|
|
debug_build: 0
|
|
onnx_ml: 1
|
|
os: "windows-2022"
|
|
protobuf_type: 'External'
|
|
unity_build: 0
|
|
# build_protobuf_unix.sh appears broken on macos-arm64
|
|
# - python_version: "3.14"
|
|
# debug_build: 0
|
|
# unity_build: 0
|
|
# autogenerate_files: 0
|
|
# protobuf_type: 'External'
|
|
# os: "macos-latest"
|
|
|
|
# Unity build AND autogenerated files
|
|
# The unity build may surface name clashes at compile time
|
|
# but produces functionally identical binaries. We can
|
|
# therefore safely reuse this build to test the
|
|
# autogenerated files.
|
|
- python_version: '3.14'
|
|
autogenerate_files: 1
|
|
debug_build: 0
|
|
onnx_ml: 1
|
|
os: "ubuntu-24.04"
|
|
protobuf_type: 'External'
|
|
unity_build: 1
|
|
|
|
# Toggling onnx_ml should be additive. There is likely very
|
|
# different signal in testing it in relation with other
|
|
# parameters.
|
|
- python_version: '3.14'
|
|
autogenerate_files: 0
|
|
debug_build: 0
|
|
onnx_ml: 0
|
|
os: "ubuntu-24.04"
|
|
protobuf_type: 'External'
|
|
unity_build: 0
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
with:
|
|
submodules: recursive
|
|
persist-credentials: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
|
with:
|
|
python-version: ${{ matrix.python_version }}
|
|
|
|
- name: Show versions
|
|
run: |
|
|
python --version
|
|
cmake --version
|
|
|
|
- name: Install external protobuf - Linux
|
|
if: matrix.protobuf_type == 'External' && startsWith(matrix.os,'ubuntu')
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install libprotobuf-dev protobuf-compiler
|
|
|
|
- name: Install external protobuf - MacOS
|
|
if: matrix.protobuf_type == 'External' && matrix.os == 'macos-latest'
|
|
run: |
|
|
source workflow_scripts/protobuf/build_protobuf_unix.sh 3 $(pwd)/protobuf/protobuf_install
|
|
|
|
- name: Set up MSBuild (x64)
|
|
if: startsWith(matrix.os,'windows')
|
|
uses: microsoft/setup-msbuild@30375c66a4eea26614e0d39710365f22f8b0af57 # v3.0.0
|
|
with:
|
|
msbuild-architecture: x64
|
|
|
|
- name: Install external protobuf - Windows
|
|
if: matrix.protobuf_type == 'External' && startsWith(matrix.os, 'windows')
|
|
run: |
|
|
if ($matrix.os -like "windows-11-arm*") {
|
|
$cmake_arch = "ARM64"
|
|
} else {
|
|
$cmake_arch = "x64"
|
|
}
|
|
|
|
workflow_scripts/protobuf/build_protobuf_win.ps1 -cmake_arch $cmake_arch
|
|
shell: pwsh
|
|
|
|
- name: Build and install ONNX - Linux
|
|
if: startsWith(matrix.os,'ubuntu')
|
|
run: |
|
|
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
|
|
if [ "${{ matrix.python_version }}" == "3.14" ]; then
|
|
sudo apt-get update
|
|
sudo apt-get install libjpeg-dev zlib1g-dev libpng-dev
|
|
fi
|
|
|
|
if [ "${{ matrix.protobuf_type }}" == "External" ]; then
|
|
export CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
|
|
fi
|
|
pip install -e ".[reference]" -v
|
|
env:
|
|
DEBUG: ${{ matrix.debug_build }}
|
|
ONNX_ML: ${{ matrix.onnx_ml }}
|
|
ONNX_BUILD_TESTS: 1
|
|
CMAKE_ARGS: "-DONNX_WERROR=ON -DONNX_USE_ASAN=${{ matrix.debug_build }} -DONNX_USE_UNITY_BUILD=${{ matrix.unity_build }} -DONNX_HARDENING=ON"
|
|
|
|
- name: Build and install ONNX - MacOS
|
|
if: matrix.os == 'macos-latest'
|
|
run: |
|
|
pip install -e ".[reference]" -v
|
|
env:
|
|
DEBUG: ${{ matrix.debug_build }}
|
|
ONNX_ML: ${{ matrix.onnx_ml }}
|
|
ONNX_BUILD_TESTS: 1
|
|
CMAKE_ARGS: "-DONNX_WERROR=ON -DONNX_USE_UNITY_BUILD=${{ matrix.unity_build }} -DONNX_HARDENING=ON"
|
|
|
|
- name: Build and install ONNX - Windows
|
|
if: startsWith(matrix.os,'windows')
|
|
run: |
|
|
pip install -e . -v
|
|
env:
|
|
DEBUG: ${{ matrix.debug_build }}
|
|
ONNX_ML: ${{ matrix.onnx_ml }}
|
|
ONNX_BUILD_TESTS: 1
|
|
CMAKE_ARGS: "-DONNX_WERROR=ON -DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DONNX_USE_LITE_PROTO=ON -DONNX_USE_UNITY_BUILD=${{ matrix.unity_build }} -DONNX_HARDENING=ON"
|
|
|
|
- name: pip freeze
|
|
run: |
|
|
pip freeze
|
|
|
|
- name: Setup GCC ASAN LD_PRELOAD
|
|
if: startsWith(matrix.os,'ubuntu') && (matrix.python_version != '3.13t')
|
|
run: |
|
|
export LD_PRELOAD="$(/usr/bin/c++ -print-file-name=libasan.so):$LD_PRELOAD"
|
|
|
|
- name: Install test dependencies
|
|
run: |
|
|
python -m pip install -r requirements-release_test.txt
|
|
|
|
- name: Run Python tests
|
|
# Prohibitively slow for Windows debug builds
|
|
if: ${{ !(startsWith(matrix.os, 'windows') && matrix.debug_build == 1) }}
|
|
run: |
|
|
pytest -sv --cov=onnx --cov-report=xml --cov-append --cov-branch --junitxml junit.xml -n auto --dist loadscope
|
|
- name: Run C++ tests
|
|
if: startsWith(matrix.os,'ubuntu') || matrix.os == 'macos-latest'
|
|
run: |
|
|
export LD_LIBRARY_PATH="./.setuptools-cmake-build/:$LD_LIBRARY_PATH"
|
|
./.setuptools-cmake-build/onnx_gtests
|
|
|
|
- name: Run C++ extension test
|
|
if: (startsWith(matrix.os,'ubuntu') || matrix.os == 'macos-latest') && matrix.debug_build == 0 && matrix.protobuf_type == 'External'
|
|
run: |
|
|
cmake -S . -B build_for_install \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
|
-DONNX_ML=${{ matrix.onnx_ml }} \
|
|
-DONNX_USE_PROTOBUF_SHARED_LIBS=ON
|
|
cmake --build build_for_install --parallel
|
|
sudo cmake --install build_for_install
|
|
|
|
cmake -S onnx/test/cmake -B onnx/test/cmake/build \
|
|
-DONNX_ML=${{ matrix.onnx_ml }}
|
|
cmake --build onnx/test/cmake/build
|
|
./onnx/test/cmake/build/main
|
|
|
|
- name: Upload coverage to Codecov
|
|
if: github.repository_owner == 'onnx'
|
|
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
- name: Upload test results to Codecov
|
|
if: github.repository_owner == 'onnx' && !cancelled()
|
|
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
report_type: test_results
|
|
|
|
# Note that the test data should be generated with numpy>=2.0.
|
|
# numpy 1.x and numpy 2.0 produce slightly different numerical values.
|
|
- name: Test backend test data
|
|
if: matrix.autogenerate_files == 1 && startsWith(matrix.os,'ubuntu')
|
|
run: |
|
|
python onnx/backend/test/cmd_tools.py generate-data --clean
|
|
git status
|
|
git diff --exit-code -- . ':!onnx/onnx-data.proto' ':!onnx/onnx-data.proto3' ':!*output_*.pb' ':!*input_*.pb'
|
|
if [ $? -ne 0 ]; then
|
|
echo "git diff for test generation returned failures. Please check updated node test files"
|
|
exit 1
|
|
fi
|
|
git diff --exit-code --diff-filter=ADR -- . ':!onnx/onnx-data.proto' ':!onnx/onnx-data.proto3'
|
|
if [ $? -ne 0 ]; then
|
|
echo "Test generation returned failures. Please check the number of node test files (input_*.pb or output_*.pb)"
|
|
exit 1
|
|
fi
|
|
pip uninstall -y pillow
|
|
python onnx/backend/test/cmd_tools.py generate-data --clean
|
|
git status
|
|
git diff --exit-code -- . ':!onnx/onnx-data.proto' ':!onnx/onnx-data.proto3' ':!*output_*.pb' ':!*input_*.pb'
|
|
if [ $? -ne 0 ]; then
|
|
echo "git diff for test generation without pillow returned failures. Please check updated node test files"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Run Python tests with numpy<2.0 (win, mac)
|
|
if: (matrix.python_version == '3.10') && (matrix.os == 'windows-latest' || matrix.os == 'macos-latest') && (matrix.debug_build != 1)
|
|
run: |
|
|
pip install "numpy<2.0" pillow
|
|
pytest -s
|
|
|
|
- name: Run Python tests with numpy<2.0 (ubuntu, python<3.13)
|
|
if: (matrix.python_version == '3.10') && startsWith(matrix.os,'ubuntu')
|
|
run: |
|
|
# 2024.10.15: Error message: The headers or library files could not be found for jpeg, a required dependency when compiling Pillow from source.
|
|
sudo apt-get update
|
|
sudo apt-get install libjpeg-dev zlib1g-dev libpng-dev
|
|
pip install --prefer-binary "numpy<2.0" pillow
|
|
pytest -s
|