forked from onnx/onnx
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (106 loc) · 4.84 KB
/
release_mac.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
name: MacRelease
on: # Specifies the event triggering the workflow
workflow_call: # Indicates that this is a reusable workflow
inputs:
os:
required: true
type: string
# Use MACOSX_DEPLOYMENT_TARGET=12.0 to produce compatible wheel
env:
MACOSX_DEPLOYMENT_TARGET: "12.0"
permissions:
contents: read
jobs:
build:
if: github.event_name != 'pull_request' || startsWith( github.base_ref, 'rel-') || contains( github.event.pull_request.labels.*.name, 'run release CIs')
runs-on: macos-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
target-architecture: ['x86_64', 'arm64']
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install -q --upgrade pip
python -m pip install -q -r requirements-release.txt
- name: Build wheel
env:
CC: "clang"
CXX: "clang++"
ONNX_ML: 1
CMAKE_OSX_ARCHITECTURES: "arm64;x86_64"
CMAKE_ARGS: "-DONNX_USE_LITE_PROTO=ON"
run: |
# Install Protobuf from source
export NUM_CORES=`sysctl -n hw.logicalcpu`
source workflow_scripts/protobuf/build_protobuf_unix.sh $NUM_CORES $(pwd)/protobuf/protobuf_install
if [ '${{ github.event_name }}' == 'schedule' ] || [ '${{ github.event_name }}' == 'workflow_dispatch' ]; then
sed -i '' 's/name = "onnx"/name = "onnx-weekly"/' 'pyproject.toml'
export ONNX_PREVIEW_BUILD=1
fi
python -m build --wheel
- name: Upload wheel artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
with:
name: wheels-${{ inputs.os }}-${{ matrix.python-version }}-${{ matrix.target-architecture }}
path: dist/*.whl
test:
needs: build
runs-on: ${{ (matrix.target-architecture == 'x86_64') && 'macos-15' || 'macos-14' }}
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
target-architecture: ['x86_64', 'arm64']
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
arch -${{ matrix.target-architecture }} python -m pip install -q --upgrade pip
arch -${{ matrix.target-architecture }} python -m pip install -q -r requirements-release.txt
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: wheels-${{ inputs.os }}-${{ matrix.python-version }}-${{ matrix.target-architecture }}
path: dist
- name: Test the wheel
run: |
arch -${{ matrix.target-architecture }} python -m pip install --upgrade dist/*.whl
arch -${{ matrix.target-architecture }} pytest
- name: Verify ONNX with the latest numpy
if: ${{ always() }}
run: |
arch -${{ matrix.target-architecture }} python -m pip uninstall -y numpy onnx
arch -${{ matrix.target-architecture }} python -m pip install numpy
arch -${{ matrix.target-architecture }} python -m pip install --upgrade dist/*.whl
arch -${{ matrix.target-architecture }} pytest
- name: Verify ONNX with the latest protobuf
if: ${{ always() }}
run: |
arch -${{ matrix.target-architecture }} python -m pip uninstall -y protobuf onnx
arch -${{ matrix.target-architecture }} python -m pip install protobuf
arch -${{ matrix.target-architecture }} python -m pip install --upgrade dist/*.whl
arch -${{ matrix.target-architecture }} pytest
- name: Verify ONNX with the minimumly supported packages
if: always() && (matrix.target-architecture == 'x86_64' || (matrix.python-version != '3.9'))
run: |
arch -${{ matrix.target-architecture }} python -m pip uninstall -y numpy protobuf onnx
arch -${{ matrix.target-architecture }} python -m pip install -r requirements-min.txt
arch -${{ matrix.target-architecture }} python -m pip install --upgrade dist/*.whl
arch -${{ matrix.target-architecture }} pytest