|
| 1 | +name: CI |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + lint: |
| 6 | + runs-on: ubuntu-latest |
| 7 | + steps: |
| 8 | + - uses: actions/checkout@v2 |
| 9 | + with: |
| 10 | + submodules: recursive |
| 11 | + - uses: actions/setup-python@v1 |
| 12 | + with: |
| 13 | + python-version: 3.8 |
| 14 | + - name: Run lint |
| 15 | + run: | |
| 16 | + python -m pip install tox |
| 17 | + tox -e lint |
| 18 | +
|
| 19 | + test: |
| 20 | + runs-on: ${{ matrix.os }} |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 25 | + steps: |
| 26 | + - name: Set git to use LF on Windows |
| 27 | + if: runner.os == 'Windows' |
| 28 | + run: | |
| 29 | + git config --global core.autocrlf false |
| 30 | + git config --global core.eol lf |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + with: |
| 33 | + submodules: recursive |
| 34 | + - uses: actions/setup-python@v1 |
| 35 | + with: |
| 36 | + python-version: 2.7 |
| 37 | + - uses: actions/setup-python@v1 |
| 38 | + with: |
| 39 | + python-version: 3.5 |
| 40 | + - uses: actions/setup-python@v1 |
| 41 | + with: |
| 42 | + python-version: 3.9 |
| 43 | + - name: Install Visual C++ for Python 2.7 |
| 44 | + if: runner.os == 'Windows' |
| 45 | + run: choco install vcpython27 -f -y |
| 46 | + - name: Run tests |
| 47 | + run: | |
| 48 | + python -m pip install tox |
| 49 | + tox --skip-missing-interpreters |
| 50 | +
|
| 51 | + package-sdist: |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v2 |
| 55 | + with: |
| 56 | + submodules: recursive |
| 57 | + - uses: actions/setup-python@v1 |
| 58 | + with: |
| 59 | + python-version: 3.8 |
| 60 | + - name: Build source package |
| 61 | + run: python setup.py sdist |
| 62 | + - name: Upload source package |
| 63 | + uses: actions/upload-artifact@v1 |
| 64 | + with: |
| 65 | + name: sdist |
| 66 | + path: dist/ |
| 67 | + |
| 68 | + package-wheel: |
| 69 | + runs-on: ${{ matrix.os }} |
| 70 | + strategy: |
| 71 | + matrix: |
| 72 | + include: |
| 73 | + - name: manylinux |
| 74 | + os: ubuntu-latest |
| 75 | + - name: macos |
| 76 | + os: macos-latest |
| 77 | + - name: win |
| 78 | + os: windows-latest |
| 79 | + |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v2 |
| 82 | + with: |
| 83 | + submodules: recursive |
| 84 | + - uses: actions/setup-python@v2 |
| 85 | + |
| 86 | + - name: Install cibuildwheel |
| 87 | + run: python -m pip install cibuildwheel |
| 88 | + - name: Install Visual C++ for Python 2.7 |
| 89 | + if: runner.os == 'Windows' |
| 90 | + run: choco install vcpython27 -f -y |
| 91 | + - name: Build wheels |
| 92 | + run: python -m cibuildwheel --output-dir wheelhouse |
| 93 | + env: |
| 94 | + CIBW_BUILD: cp27-${{ matrix.name }}* cp35-${{ matrix.name }}* pp*-${{ matrix.name }}* |
| 95 | + - uses: actions/upload-artifact@v2 |
| 96 | + with: |
| 97 | + name: wheels-${{ matrix.name }} |
| 98 | + path: ./wheelhouse/*.whl |
| 99 | + |
| 100 | + publish: |
| 101 | + runs-on: ubuntu-latest |
| 102 | + needs: [lint, test, package-sdist, package-wheel] |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v2 |
| 105 | + - uses: actions/download-artifact@v1 |
| 106 | + with: |
| 107 | + name: sdist |
| 108 | + path: dists/ |
| 109 | + - uses: actions/download-artifact@v1 |
| 110 | + with: |
| 111 | + name: wheels-win |
| 112 | + path: dists/ |
| 113 | + - uses: actions/download-artifact@v1 |
| 114 | + with: |
| 115 | + name: wheels-macos |
| 116 | + path: dists/ |
| 117 | + - uses: actions/download-artifact@v1 |
| 118 | + with: |
| 119 | + name: wheels-manylinux |
| 120 | + path: dists/ |
| 121 | + - name: Publish to PyPI |
| 122 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') |
| 123 | + uses: pypa/gh-action-pypi-publish@master |
| 124 | + with: |
| 125 | + user: __token__ |
| 126 | + password: ${{ secrets.PYPI_TOKEN }} |
0 commit comments