-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (106 loc) · 4.16 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
name: MacRelease
on:
schedule:
# Run weekly on Monday 00:00
- cron: '00 00 * * MON'
push:
branches: [master, rel-*]
pull_request:
branches: [master, rel-*]
workflow_dispatch:
# Use MACOSX_DEPLOYMENT_TARGET=10.12 to produce compatible wheel
env:
MACOSX_DEPLOYMENT_TARGET: 10.12
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-10.15
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
architecture: ['x64']
steps:
- uses: actions/checkout@v2
- 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@v1
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Install protobuf dependencies
run: |
# Install protobuf 3.16.0
export NUM_CORES=`sysctl -n hw.ncpu`
echo Using $NUM_CORES cores
brew update
brew install autoconf && brew install automake
export ONNX_PATH=$(pwd)
cd ..
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.16.0/protobuf-cpp-3.16.0.tar.gz
tar -xvf protobuf-cpp-3.16.0.tar.gz
cd protobuf-3.16.0
mkdir build_source && cd build_source
cmake ../cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release
make -j${NUM_CORES}
make install
export PATH=$(pwd)/bin:$PATH
cd $ONNX_PATH
- name: Install Python dependencies
run: |
python -m pip install -q --upgrade pip
python -m pip install -q -r requirements-release.txt
- name: Build wheel and install
env:
CC: "clang"
CXX: "clang++"
ONNX_ML: 1
run: |
# Currently GitHub Action agent is using 10.14 Python, use -p to force change the final MACOSX_DEPLOYMENT_TARGET
# Change -p if MACOSX_DEPLOYMENT_TARGET is different
if [ '${{ github.event_name }}' == 'schedule' ]; then
python setup.py bdist_wheel -p macosx_10_12_x86_64 --weekly_build
else
python setup.py bdist_wheel -p macosx_10_12_x86_64
fi
for file in dist/*.whl; do python -m pip install --upgrade $file; done
- name: Test the installed wheel
run: |
pytest
- name: Test backend test data
run: |
# onnx.checker all existing backend data
python workflow_scripts/test_generated_backend.py
# onnx.checker all generated backend data
python onnx/backend/test/cmd_tools.py generate-data
python workflow_scripts/test_generated_backend.py
- uses: actions/upload-artifact@v1
with:
name: wheels
path: dist
- name: Upload wheel to TestPyPI weekly
if: (github.event_name == 'schedule') # Only triggered by weekly event
run: |
twine upload --verbose dist/*.whl --repository-url https://test.pypi.org/legacy/ -u ${{ secrets.TESTPYPI_USERNAME }} -p ${{ secrets.TESTPYPI_PASSWORD }}
- name: Verify ONNX with the latest numpy
if: ${{ always() }}
run: |
python -m pip uninstall -y numpy onnx && python -m pip install numpy
for file in dist/*.whl; do python -m pip install --upgrade $file; done
pytest
- name: Verify ONNX with the latest protobuf
if: ${{ always() }}
run: |
python -m pip uninstall -y protobuf onnx && python -m pip install protobuf
for file in dist/*.whl; do python -m pip install --upgrade $file; done
pytest
- name: Verify ONNX with ort-nightly
if: ${{ always() }}
run: |
python -m pip install -q flatbuffers
python -m pip install -q -i https://test.pypi.org/simple/ ort-nightly
python onnx/test/test_with_ort.py