|
1 | | -name: Wheel |
| 1 | +name: PyPi wheel and sdist |
2 | 2 |
|
3 | | -on: [push] |
| 3 | +on: [push, pull_request] |
4 | 4 |
|
5 | 5 | jobs: |
6 | | - build: |
| 6 | + sdist: |
7 | 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 | 8 |
|
31 | | - name: Python ${{ matrix.python-version }} |
| 9 | + name: Python 3.9 |
32 | 10 |
|
33 | 11 | steps: |
34 | 12 | - uses: actions/checkout@v2 |
35 | 13 |
|
36 | 14 | - name: Setup Python |
37 | 15 | uses: actions/setup-python@v2 |
38 | 16 | with: |
39 | | - python-version: ${{ matrix.python-version }} |
| 17 | + python-version: 3.9 |
40 | 18 | architecture: x64 |
41 | 19 |
|
42 | 20 | - name: Install test dependencies |
43 | | - run: pip install pytest twine |
| 21 | + run: pip install wheel flake8 pytest |
44 | 22 |
|
45 | | - # Flake8 is already run in Source Distribution (sdist) workflow, so we don't run it here. |
| 23 | + - name: Flake8 |
| 24 | + # stop the build if there are Python syntax errors or undefined names |
| 25 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 26 | + run: | |
| 27 | + flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics |
| 28 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
46 | 29 |
|
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" |
| 30 | + - name: Install libsnappy-dev |
| 31 | + run: sudo apt-get install libsnappy-dev |
52 | 32 |
|
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 |
| 33 | + - name: Generate source distribution |
| 34 | + run: python setup.py sdist |
57 | 35 |
|
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 |
| 36 | + - name: Install python-snappy sdist |
| 37 | + run: pip install dist/python-snappy*.tar.gz |
62 | 38 |
|
63 | 39 | - name: Pytest |
64 | 40 | run: pytest --verbose test_snappy.py |
65 | 41 |
|
66 | | - - name: Archive wheels |
67 | | - if: startsWith(github.ref, 'refs/tags/0.') |
| 42 | + - name: Archive sdist |
68 | 43 | uses: actions/upload-artifact@v2 |
69 | 44 | with: |
70 | | - name: python_snappy-${{ matrix.pep-425-tag }}-manylinux |
71 | | - path: dist/python_snappy*-manylinux1*.whl |
| 45 | + name: wheels |
| 46 | + path: dist/python-snappy*.tar.gz |
| 47 | + |
| 48 | + build: |
| 49 | + runs-on: ${{ matrix.os }} |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + os: [ubuntu-20.04, macos-10.15, windows-2019] |
| 54 | + architecture: ['x64'] |
| 55 | + linux_archs: ["auto s390x"] |
| 56 | + include: |
| 57 | + - os: windows-2019 |
| 58 | + architecture: 'x86' |
| 59 | + skip: "*2*win* *win_amd64" |
| 60 | + environment_windows: INCLUDE="C:/Program Files (x86)/Snappy/include" LIB="C:/Program Files (x86)/Snappy/lib" |
| 61 | + - os: windows-2019 |
| 62 | + architecture: 'x64' |
| 63 | + skip: "*2*win* *win32" |
| 64 | + environment_windows: INCLUDE="C:/Program Files/Snappy/include" LIB="C:/Program Files/Snappy/lib" |
| 65 | + - os: ubuntu-20.04 |
| 66 | + architecture: 'x64' |
| 67 | + linux_archs: aarch64 ppc64le |
| 68 | + |
| 69 | + name: Python ${{ matrix.os }} |
| 70 | + env: |
| 71 | + CIBW_TEST_REQUIRES: pytest |
| 72 | + CIBW_TEST_COMMAND: "python -m pytest --verbose {project}/test_snappy.py" |
| 73 | + CIBW_BEFORE_ALL_LINUX: yum install -y snappy-devel |
| 74 | + MACOSX_DEPLOYMENT_TARGET: "10.9" |
| 75 | + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}" |
| 76 | + CIBW_BEFORE_ALL: "bash {project}/build_snappy.sh" |
| 77 | + CIBW_SKIP: ${{ matrix.skip }} |
| 78 | + CIBW_ENVIRONMENT_WINDOWS: ${{ matrix.environment_windows }} |
| 79 | + CIBW_ARCHS_LINUX: ${{ matrix.linux_archs }} |
| 80 | + CIBW_ARCHS_MACOS: x86_64 universal2 |
| 81 | + CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64" |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v2 |
| 84 | + |
| 85 | + - name: Setup Python |
| 86 | + uses: actions/setup-python@v2 |
| 87 | + with: |
| 88 | + python-version: "3.8" |
| 89 | + architecture: ${{ matrix.architecture }} |
| 90 | + |
| 91 | +# - name: Install Visual C++ for Python 2.7 |
| 92 | +# if: runner.os == 'Windows' |
| 93 | +# run: | |
| 94 | +# choco install vcpython27 -f -y |
72 | 95 |
|
| 96 | + |
| 97 | + - name: Set up QEMU |
| 98 | + if: runner.os == 'Linux' |
| 99 | + uses: docker/setup-qemu-action@v1 |
| 100 | + with: |
| 101 | + platforms: all |
| 102 | + |
| 103 | + - name: Add msbuild to PATH |
| 104 | + if: runner.os == 'Windows' |
| 105 | + uses: microsoft/setup-msbuild@v1.0.2 |
| 106 | + |
| 107 | + - name: delvewheel install |
| 108 | + if: runner.os == 'Windows' |
| 109 | + run: | |
| 110 | + python -m pip install delvewheel==0.0.9 |
| 111 | +
|
| 112 | + - name: Build wheels |
| 113 | + uses: joerick/cibuildwheel@v1.9.0 |
| 114 | + |
| 115 | + - uses: actions/upload-artifact@v2 |
| 116 | + with: |
| 117 | + path: ./wheelhouse/*.whl |
| 118 | + name: wheels |
| 119 | + |
| 120 | + upload: |
| 121 | + runs-on: ubuntu-latest |
| 122 | + name: upload wheels |
| 123 | + needs: ['sdist', 'build'] |
| 124 | + if: startsWith(github.ref, 'refs/tags/0.') |
| 125 | + steps: |
| 126 | + - name: Download test data |
| 127 | + uses: actions/download-artifact@v1 |
| 128 | + with: |
| 129 | + name: wheels |
73 | 130 | - name: Publish wheels to PyPI |
74 | | - if: startsWith(github.ref, 'refs/tags/0.') |
75 | 131 | env: |
76 | 132 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
77 | 133 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
78 | 134 | run: | |
79 | | - twine upload dist/python_snappy*-manylinux1*.whl |
| 135 | + twine upload dist/*.whl |
0 commit comments