1name: PyPI Distribution 2 3on: [push] 4 5jobs: 6 build: 7 runs-on: ${{ matrix.os }} 8 strategy: 9 fail-fast: false 10 matrix: 11 os: [macos-latest, ubuntu-latest, windows-latest] 12 platform: [x32, x64] 13 steps: 14 - uses: actions/checkout@v2 15 16 - name: Set up Python 17 uses: actions/setup-python@v2 18 with: 19 python-version: '3.x' 20 21 - name: Set up MSVC x86 22 if: matrix.os == 'windows-latest' && matrix.platform == 'x32' 23 uses: ilammy/msvc-dev-cmd@v1 24 with: 25 arch: x86 26 27 - name: Set up MSVC x64 28 if: matrix.os == 'windows-latest' && matrix.platform == 'x64' 29 uses: ilammy/msvc-dev-cmd@v1 30 31 - name: Install dependencies 32 run: | 33 pip install setuptools wheel 34 35 - name: Build distribution 36 shell: bash 37 run: | 38 if [ ${{ matrix.platform }} == 'x32' ] && [ ${{ matrix.os }} == 'windows-latest' ]; then 39 cd bindings/python && python setup.py build -p win32 bdist_wheel -p win32 40 elif [ ${{ matrix.platform }} == 'x32' ] && [ ${{ matrix.os }} == 'ubuntu-latest' ]; then 41 docker run --rm -v `pwd`/:/work dockcross/manylinux1-x86 > ./dockcross 42 chmod +x ./dockcross 43 ./dockcross bindings/python/build_wheel.sh 44 elif [ ${{ matrix.platform }} == 'x64' ] && [ ${{ matrix.os }} == 'ubuntu-latest' ]; then 45 docker run --rm -v `pwd`/:/work dockcross/manylinux1-x64 > ./dockcross 46 chmod +x ./dockcross 47 ./dockcross bindings/python/build_wheel.sh 48 elif [ ${{ matrix.platform }} == 'x32' ] && [ ${{ matrix.os }} == 'macos-latest' ]; then 49 cd bindings/python && python setup.py sdist 50 else 51 cd bindings/python && python setup.py bdist_wheel 52 fi 53 54 - uses: actions/upload-artifact@v2 55 with: 56 path: ${{ github.workspace }}/bindings/python/dist/* 57 58 publish: 59 needs: [build] 60 runs-on: ubuntu-latest 61 if: startsWith(github.ref, 'refs/tags') 62 steps: 63 - uses: actions/download-artifact@v2 64 with: 65 name: artifact 66 path: dist 67 68 - name: Publish distribution to test PyPI 69 uses: pypa/gh-action-pypi-publish@master 70 with: 71 user: __token__ 72 password: ${{ secrets.testpypi_pass }} 73 repository_url: https://test.pypi.org/legacy/ 74 75 - name: Publish distribution to PyPI 76 if: ${{ success() }} 77 uses: pypa/gh-action-pypi-publish@master 78 with: 79 user: __token__ 80 password: ${{ secrets.pypi_pass }} 81