diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml new file mode 100644 index 00000000000..cfdf171f44a --- /dev/null +++ b/.github/workflows/win.yml @@ -0,0 +1,101 @@ +name: WindowsRelease + +on: + push: + branches: [ master, rel-* ] + pull_request: + branches: [ master, rel-* ] + + +jobs: + build: + runs-on: windows-latest + strategy: + matrix: + python-version: [3.6] + architecture: ['x64', 'x86'] + steps: + - name: Checkout Protobuf + uses: actions/checkout@master + with: + repository: protocolbuffers/protobuf + ref: refs/tags/v3.11.3 + path: ./protobuf_root/protobuf + + - name: Checkout Protobuf submodules + shell: bash + run: | + cd ./protobuf_root/protobuf + 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: Checkout ONNX + uses: actions/checkout@v2 + with: + path: ./onnx + + - name: Checkout ONNX submodules + shell: bash + run: | + cd onnx + 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: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.0.2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + + - name: Install python dependencies + run: | + python -m pip install --upgrade pip + # pytest 6.0 made deprecation warnings fail by default, pinning pytest to 5.4.3. + # TODO replace deprecated function with the suggested one. https://docs.pytest.org/en/stable/deprecations.html#id5 + pip install pytest==5.4.3 nbval numpy wheel + + - name: Build ONNX wheel + run: | + $arch = 'x64' + if ('${{ matrix.architecture }}' -eq 'x86') { + $arch = 'Win32' + } + echo "Install protobuf" + cd ./protobuf_root + $protobuf_root_dir = Get-Location + mkdir protobuf_install + cd ./protobuf/cmake + dir + + cmake -G "Visual Studio 16 2019" -A $arch -DCMAKE_INSTALL_PREFIX="../../protobuf_install" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_MSVC_STATIC_RUNTIME=ON -DProtobuf_USE_STATIC_LIBS=ON -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_EXAMPLES=OFF . + msbuild protobuf.sln /m /p:Configuration=Release + msbuild INSTALL.vcxproj /p:Configuration=Release + echo "Protobuf installation complete." + + echo "Set paths" + $protoc_path = Join-Path -Path $protobuf_root_dir -ChildPath "protobuf_install\bin" + $protoc_lib_path = Join-Path -Path $protobuf_root_dir -ChildPath "protobuf_install\lib" + $protobuf_include_path = Join-Path -Path $protobuf_root_dir -ChildPath "protobuf_install\include" + $Env:PATH="$ENV:PATH;$protoc_path;$protoc_lib_path;$protobuf_include_path" + $($Env:PATH).Split(';') + protoc + + cd ../../../onnx + dir + echo "Install ONNX" + $Env:USE_MSVC_STATIC_RUNTIME=1 + $Env:ONNX_ML=1 + $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON" + python setup.py bdist_wheel + Get-ChildItem -Path dist/*.whl | foreach {pip install --upgrade $_.fullname} + pytest + + - uses: actions/upload-artifact@v1 + with: + name: wheels + path: ./onnx/dist