# This workflows will upload a Python Package using Twine when a release is created # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries name: Upload Python Package on: release: types: [published] jobs: deploy_with_bdist_wheel: runs-on: ${{ matrix.os }} permissions: id-token: write strategy: matrix: os: [windows-latest, macos-11] # FIXME: macos-latest will raise error now. # not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129 python-version: [3.7, 3.8] steps: - uses: actions/checkout@v2 # This is because on macos systems you can install pyqlib using # `pip install pyqlib` installs, it does not recognize the # `pyqlib--cp38-cp38-macosx_11_0_x86_64.whl` and `pyqlib--cp38-cp37m-macosx_11_0_x86_64.whl`. # So we limit the version of python, in order to generate a version of qlib that is usable for macos: `pyqlib--cp38-cp37m # `pyqlib--cp38-cp38-macosx_10_15_x86_64.whl` and `pyqlib--cp38-cp37m-macosx_10_15_x86_64.whl`. # Python 3.7.16, 3.8.16 can build macosx_10_15. But Python 3.7.17, 3.8.17 can build macosx_11_0 - name: Set up Python ${{ matrix.python-version }} if: matrix.os == 'macos-11' && matrix.python-version == '3.7' uses: actions/setup-python@v2 with: python-version: "3.7.16" - name: Set up Python ${{ matrix.python-version }} if: matrix.os == 'macos-11' && matrix.python-version == '3.8' uses: actions/setup-python@v2 with: python-version: "3.8.16" - name: Set up Python ${{ matrix.python-version }} if: matrix.os != 'macos-11' uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install setuptools wheel twine - name: Build wheel on ${{ matrix.os }} run: | pip install numpy pip install cython python setup.py bdist_wheel - name: Set up publish uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ steps.mint-token.outputs.api-token }} - name: Build and publish run: | twine upload dist/* deploy_with_manylinux: runs-on: ubuntu-latest permissions: id-token: write steps: - uses: actions/checkout@v2 - name: Build wheel on Linux uses: RalfG/python-wheels-manylinux-build@v0.3.1-manylinux2010_x86_64 with: # not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129 python-versions: 'cp37-cp37m cp38-cp38' build-requirements: 'numpy cython' - name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.7 - name: Install dependencies run: | pip install twine - name: Set up publish uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ steps.mint-token.outputs.api-token }} - name: Build and publish run: | twine upload dist/pyqlib-*-manylinux*.whl