forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 23
248 lines (212 loc) · 7.65 KB
/
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
name: Mac_CI
on:
push:
branches:
- main
- rel-*
pull_request:
branches:
- main
- rel-*
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
python_version: 3.11
jobs:
ARM64-Xcode16:
runs-on: macos-15
env:
xcode_version: 16
timeout-minutes: 60
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Verify ARM64 machine
shell: python
run: |
import platform
assert platform.machine() == "arm64", "This job expects to be run on an ARM64 machine."
- name: Use Xcode ${{ env.xcode_version }}
shell: bash
run: |
XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer"
sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"
- uses: actions/checkout@v4
- name: Build and test
shell: bash
run: |
python ./tools/ci_build/build.py \
--build_dir ./build \
--update \
--build --parallel \
--test \
--build_shared_lib \
--build_objc \
--use_coreml \
--use_xnnpack \
--use_binskim_compliant_compile_flags
ARM64-Xcode16-targeting-iphonesimulator:
runs-on: macos-15
env:
xcode_version: 16
strategy:
matrix:
target_arch: [x86_64, arm64]
timeout-minutes: 60
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Verify ARM64 machine
shell: python
run: |
import platform
assert platform.machine() == "arm64", "This job expects to be run on an ARM64 machine."
- name: Use Xcode ${{ env.xcode_version }}
shell: bash
run: |
XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer"
sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"
- uses: actions/checkout@v4
- name: Build for iphonesimulator ${{ matrix.target_arch }}
shell: bash
run: |
python ./tools/ci_build/build.py \
--build_dir ./build \
--update \
--build --parallel \
--test \
--build_apple_framework \
--use_xcode \
--use_coreml \
--use_xnnpack \
--use_binskim_compliant_compile_flags \
--ios \
--apple_deploy_target=13.0 \
--apple_sysroot=iphonesimulator \
--osx_arch=${{ matrix.target_arch }}
Vcpkg:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: "Run vcpkg(x64-osx)"
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: "${{ runner.temp }}/vcpkg"
vcpkgGitCommitId: "1de2026f28ead93ff1773e6e680387643e914ea1" # 2024.07.12
runVcpkgInstall: true
vcpkgJsonGlob: "cmake/vcpkg.json"
vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json"
env:
VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build"
VCPKG_DEFAULT_TRIPLET: "x64-osx"
# VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching
- name: "Run compile_schema.py"
run: |
set -e -x
# Runner's host triplet should be x64-osx or arm64-osx
export FLATC_DIR="${{ github.workspace }}/.build/${{ runner.arch }}-osx/tools/flatbuffers"
export PATH="$FLATC_DIR:$PATH"
flatc --version
python onnxruntime/core/flatbuffers/schema/compile_schema.py --flatc "$(which flatc)"
python onnxruntime/lora/adapter_format/compile_schema.py --flatc "$(which flatc)"
- name: "Detect protoc"
id: protoc-detect
run: |
export PROTOC_DIR="${{ github.workspace }}/.build/${{ runner.arch }}-osx/tools/protobuf"
export PATH="$PROTOC_DIR:$PATH"
protoc --version
echo "protoc_path=$(which protoc)" >> "$GITHUB_OUTPUT"
- name: "Run build.py(x64-osx)"
run: |
python ./tools/ci_build/build.py \
--build_dir "build/x64-osx" \
--skip_submodule_sync \
--skip_tests \
--compile_no_warning_as_error \
--parallel \
--path_to_protoc_exe "${{ steps.protoc-detect.outputs.protoc_path }}" \
--osx_arch x86_64 \
--use_vcpkg \
--cmake_extra_defines "CMAKE_TOOLCHAIN_FILE:FILEPATH=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
--cmake_extra_defines "VCPKG_TARGET_TRIPLET=x64-osx" \
--cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" \
--cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests"
shell: bash
- name: "Run vcpkg(arm64-osx)"
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: "${{ runner.temp }}/vcpkg"
vcpkgGitCommitId: "1de2026f28ead93ff1773e6e680387643e914ea1" # 2024.07.12
runVcpkgInstall: true
vcpkgJsonGlob: "cmake/vcpkg.json"
vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json"
env:
VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build"
VCPKG_DEFAULT_TRIPLET: "arm64-osx"
# VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching
- name: "Run build.py(arm64-osx)"
run: |
python ./tools/ci_build/build.py \
--build_dir "build/arm64-osx" \
--skip_submodule_sync \
--skip_tests \
--compile_no_warning_as_error \
--parallel \
--path_to_protoc_exe "${{ steps.protoc-detect.outputs.protoc_path }}" \
--osx_arch arm64 \
--use_vcpkg \
--cmake_extra_defines "CMAKE_TOOLCHAIN_FILE:FILEPATH=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
--cmake_extra_defines "VCPKG_TARGET_TRIPLET=arm64-osx" \
--cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" \
--cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests"
shell: bash
Objective-C-StaticAnalysis:
runs-on: macos-14
env:
xcode_version: 15.2
timeout-minutes: 30
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Use Xcode ${{ env.xcode_version }}
shell: bash
run: |
XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer"
sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"
- uses: actions/checkout@v4
- name: Generate compile_commands.json and ONNX protobuf files
shell: bash
run: |
python ./tools/ci_build/build.py \
--build_dir ./build \
--cmake_generator "Unix Makefiles" \
--config Debug \
--build_shared_lib \
--use_coreml \
--build_objc \
--enable_training_apis \
--cmake_extra_defines CMAKE_EXPORT_COMPILE_COMMANDS=ON \
--use_binskim_compliant_compile_flags \
--update \
--build --parallel \
--target onnx_proto
- name: Analyze Objective-C/C++ source code
shell: bash
run: |
CLANG_TIDY_CHECKS="-*,clang-analyzer-*"
"$(brew --prefix llvm@15)/bin/clang-tidy" \
-p=./build/Debug \
--checks="${CLANG_TIDY_CHECKS}" \
--warnings-as-errors="${CLANG_TIDY_CHECKS}" \
--header-filter="objectivec/include|objectivec|onnxruntime/core" \
./objectivec/*.mm \
./onnxruntime/core/platform/apple/logging/apple_log_sink.mm \
./onnxruntime/core/providers/coreml/model/*.mm