|
| 1 | +name: Wheel |
| 2 | + |
| 3 | +on: [push] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + include: |
| 11 | + - python-version: 2.7 |
| 12 | + pep-425-tag: cp27-cp27mu |
| 13 | + # we build for "wide-unicode" CPython 2.7, which is prevalent among |
| 14 | + # most Linux distributions. See https://github.com/pypa/manylinux |
| 15 | + |
| 16 | + - python-version: 3.5 |
| 17 | + pep-425-tag: cp35-cp35m |
| 18 | + |
| 19 | + - python-version: 3.6 |
| 20 | + pep-425-tag: cp36-cp36m |
| 21 | + |
| 22 | + - python-version: 3.7 |
| 23 | + pep-425-tag: cp37-cp37m |
| 24 | + |
| 25 | + - python-version: 3.8 |
| 26 | + pep-425-tag: cp38-cp38 |
| 27 | + |
| 28 | + - python-version: 3.9 |
| 29 | + pep-425-tag: cp39-cp39 |
| 30 | + |
| 31 | + name: Python ${{ matrix.python-version }} |
| 32 | + |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v2 |
| 35 | + |
| 36 | + - name: Setup Python |
| 37 | + uses: actions/setup-python@v2 |
| 38 | + with: |
| 39 | + python-version: ${{ matrix.python-version }} |
| 40 | + architecture: x64 |
| 41 | + |
| 42 | + - name: Install test dependencies |
| 43 | + run: pip install pytest twine |
| 44 | + |
| 45 | + # Flake8 is already run in Source Distribution (sdist) workflow, so we don't run it here. |
| 46 | + |
| 47 | + - name: Build python-snappy manylinux wheels |
| 48 | + uses: RalfG/python-wheels-manylinux-build@v0.3.3-manylinux2010_x86_64 |
| 49 | + with: |
| 50 | + python-versions: ${{ matrix.pep-425-tag }} |
| 51 | + system-packages: "snappy-devel" |
| 52 | + |
| 53 | + - name: Install python-snappy wheel |
| 54 | + # manylinux1 offers broader compatibility than manylinux2010 or manylinux2014 |
| 55 | + run: | |
| 56 | + pip install dist/python_snappy*-manylinux1*.whl |
| 57 | +
|
| 58 | + - name: Clean up sources |
| 59 | + # this cleans up the sources to make sure `import snappy` uses the wheel |
| 60 | + # an alternative would be to run pytest in a different working directory |
| 61 | + run: rm -rf setup.py ./snappy |
| 62 | + |
| 63 | + - name: Pytest |
| 64 | + run: pytest --verbose test_snappy.py |
| 65 | + |
| 66 | + - name: Archive wheels |
| 67 | + if: startsWith(github.ref, 'refs/tags/0.') |
| 68 | + uses: actions/upload-artifact@v2 |
| 69 | + with: |
| 70 | + name: python_snappy-${{ matrix.pep-425-tag }}-manylinux |
| 71 | + path: dist/python_snappy*-manylinux1*.whl |
| 72 | + |
| 73 | + - name: Publish wheels to PyPI |
| 74 | + if: startsWith(github.ref, 'refs/tags/0.') |
| 75 | + env: |
| 76 | + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
| 77 | + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
| 78 | + run: | |
| 79 | + twine upload dist/python_snappy*-manylinux1*.whl |
0 commit comments