|
1 | | -name: Python package |
2 | | -on: [push] |
| 1 | +name: Python wheels |
| 2 | +on: |
| 3 | + # Trigger the workflow on push or pull request, |
| 4 | + # but only for the main branch |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - main |
3 | 11 | jobs: |
4 | | - build: |
| 12 | +# build_wheels: |
| 13 | +# name: Build wheels on ${{ matrix.os }} |
| 14 | +# runs-on: ${{ matrix.os }} |
| 15 | +# strategy: |
| 16 | +# matrix: |
| 17 | +# os: [ubuntu-latest, windows-latest, macos-latest] |
| 18 | +# |
| 19 | +# steps: |
| 20 | +# - name: Checkout repo |
| 21 | +# uses: actions/checkout@v2 |
| 22 | +# with: |
| 23 | +# submodules: 'recursive' |
| 24 | +# |
| 25 | +# - name: Set up Python |
| 26 | +# uses: actions/setup-python@v2 |
| 27 | +# with: |
| 28 | +# python-version: '3.7' |
| 29 | +# |
| 30 | +# - name: Install Ninja |
| 31 | +# uses: seanmiddleditch/gha-setup-ninja@master |
| 32 | +# |
| 33 | +# - name: Install MSVC x86 |
| 34 | +# uses: ilammy/msvc-dev-cmd@v1 |
| 35 | +# with: |
| 36 | +# arch: x86 |
| 37 | +# |
| 38 | +# - name: Install dependencies |
| 39 | +# run: | |
| 40 | +# python -m pip install --upgrade pip |
| 41 | +# python -m pip install pytest |
| 42 | +# python -m pip install -r requirements.txt |
| 43 | +# |
| 44 | +# - name: Build wheels (Windows x86) |
| 45 | +# if: runner.os == 'Windows' |
| 46 | +# run: | |
| 47 | +# python -m pip install cibuildwheel |
| 48 | +# python -m cibuildwheel --output-dir wheelhouse |
| 49 | +# env: |
| 50 | +# CIBW_BUILD: 'cp37-win32 cp38-win32 cp39-win32' |
| 51 | +# CIBW_BEFORE_BUILD: python -m pip install -r requirements.txt |
| 52 | +# CIBW_BEFORE_TEST: python -m pip install pytest numpy |
| 53 | +# CIBW_TEST_COMMAND: pytest {project} |
| 54 | +# CIBW_BUILD_VERBOSITY: 1 |
| 55 | +# |
| 56 | +# - name: Install MSVC amd64 |
| 57 | +# uses: ilammy/msvc-dev-cmd@v1 |
| 58 | +# with: |
| 59 | +# arch: amd64 |
| 60 | +# |
| 61 | +# - name: Build wheels (Windows / amd64) |
| 62 | +# if: runner.os == 'Windows' |
| 63 | +# run: | |
| 64 | +# python -m pip install cibuildwheel |
| 65 | +# python -m cibuildwheel --output-dir wheelhouse |
| 66 | +# env: |
| 67 | +# CIBW_BUILD: 'cp37-win_amd64 cp38-win_amd64 cp39-win_amd64' |
| 68 | +# CIBW_BEFORE_BUILD: python -m pip install -r requirements.txt |
| 69 | +# CIBW_BEFORE_TEST: python -m pip install pytest numpy |
| 70 | +# CIBW_TEST_COMMAND: pytest {project} |
| 71 | +# CIBW_BUILD_VERBOSITY: 1 |
| 72 | +# |
| 73 | +# - name: Build wheels (Linux / macOS) |
| 74 | +# if: runner.os != 'Windows' |
| 75 | +# run: | |
| 76 | +# python -m pip install cibuildwheel |
| 77 | +# python -m cibuildwheel --output-dir wheelhouse |
| 78 | +# env: |
| 79 | +# CIBW_BUILD: 'cp37-* cp38-* cp39-*' |
| 80 | +# CIBW_BEFORE_BUILD: python -m pip install -r requirements.txt |
| 81 | +# CIBW_BEFORE_TEST: | |
| 82 | +# pip install pytest |
| 83 | +# pip install -r requirements.txt |
| 84 | +# CIBW_TEST_COMMAND: pytest {project} |
| 85 | +# CIBW_BUILD_VERBOSITY: 1 |
| 86 | +# |
| 87 | +# - name: Upload wheels |
| 88 | +# uses: actions/upload-artifact@v2 |
| 89 | +# with: |
| 90 | +# path: ./wheelhouse/*.whl |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + build_sdist: |
| 96 | + name: Build SDist |
5 | 97 | runs-on: ubuntu-latest |
6 | | - strategy: |
7 | | - matrix: |
8 | | - python-version: [3.7, 3.8] |
9 | 98 | steps: |
10 | | - - uses: actions/checkout@v2 |
11 | | - with: |
12 | | - submodules: 'recursive' |
13 | | - - name: Set up Python ${{ matrix.python-version }} |
14 | | - uses: actions/setup-python@v2 |
15 | | - with: |
16 | | - python-version: ${{ matrix.python-version }} |
17 | | - - name: Install dependencies |
18 | | - run: | |
19 | | - python -m pip install --upgrade pip |
20 | | - pip install flake8 pytest |
21 | | - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
22 | | - - name: Build |
23 | | - run: | |
24 | | - python setup.py build_ext --inplace |
25 | | -
|
26 | | - - name: Lint with flake8 |
27 | | - run: | |
28 | | - # stop the build if there are Python syntax errors or undefined names |
29 | | - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
30 | | - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
31 | | - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
32 | | - - name: Test with pytest |
33 | | - run: | |
34 | | - PYTHONPATH=. pytest |
| 99 | + - uses: actions/checkout@v2 |
| 100 | + with: |
| 101 | + submodules: 'recursive' |
| 102 | + |
| 103 | + - uses: actions/setup-python@v2 |
| 104 | + name: Setup Python ${{ matrix.python-version }} |
| 105 | + with: |
| 106 | + python-version: ${{ matrix.python-version }} |
| 107 | + |
| 108 | + - name: Install dependencies |
| 109 | + run: | |
| 110 | + python -m pip install --upgrade pip |
| 111 | + pip install pytest |
| 112 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 113 | +
|
| 114 | + - name: Build SDist |
| 115 | + run: | |
| 116 | + python setup.py sdist |
| 117 | +
|
| 118 | + - uses: actions/upload-artifact@v2 |
| 119 | + with: |
| 120 | + path: dist/*.tar.gz |
| 121 | + |
| 122 | + - name: Build extension from SDist package |
| 123 | + run: | |
| 124 | + cd ./dist |
| 125 | + tar -xzf blosc2-*.tar.gz |
| 126 | + cd ./blosc2-*/ |
| 127 | + python setup.py build_ext --inplace |
| 128 | +
|
| 129 | + - name: Test with pytest |
| 130 | + run: | |
| 131 | + cd ./dist/blosc2-*/ |
| 132 | + PYTHONPATH=. pytest |
| 133 | +
|
| 134 | +
|
| 135 | +
|
| 136 | +
|
| 137 | + upload_pypi: |
| 138 | + needs: [ build_sdist ] # last but not least |
| 139 | + runs-on: ubuntu-latest |
| 140 | + if: startsWith(github.event.ref, 'refs/tags') |
| 141 | + steps: |
| 142 | + - uses: actions/download-artifact@v2 |
| 143 | + with: |
| 144 | + name: artifact |
| 145 | + path: dist |
| 146 | + |
| 147 | + - uses: pypa/gh-action-pypi-publish@master |
| 148 | + with: |
| 149 | + user: __token__ |
| 150 | + password: ${{ secrets.blosc_pypi_secret }} |
0 commit comments