|
| 1 | +name: Python package |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "master" ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Build wheels on ${{ matrix.os }} |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + os: [ubuntu-latest] |
| 17 | + python-version: [ "3.11" ] |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - name: Set up Python ${{ matrix.python-version }} |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + - name: Install dependencies |
| 26 | + run: | |
| 27 | + python -m pip install --upgrade pip |
| 28 | + python -m pip install flake8 pytest build |
| 29 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 30 | + - name: Lint with flake8 |
| 31 | + run: | |
| 32 | + # stop the build if there are Python syntax errors or undefined names |
| 33 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 34 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 35 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 36 | + - name: Build wheels |
| 37 | + run: python -m build --wheel --outdir build |
| 38 | + - uses: actions/upload-artifact@v4 |
| 39 | + with: |
| 40 | + name: ${{ matrix.os }}-${{ matrix.python-version }} |
| 41 | + path: build/*.whl |
| 42 | + |
| 43 | + build-sdist: |
| 44 | + name: Build sdist on ${{ matrix.os }} |
| 45 | + runs-on: ${{ matrix.os }} |
| 46 | + strategy: |
| 47 | + fail-fast: false |
| 48 | + matrix: |
| 49 | + os: [ubuntu-latest] |
| 50 | + |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + - name: Set up Python |
| 54 | + uses: actions/setup-python@v5 |
| 55 | + - name: Install dependencies |
| 56 | + run: | |
| 57 | + python -m pip install --upgrade pip |
| 58 | + python -m pip install build |
| 59 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 60 | + - name: Build sdist |
| 61 | + run: python -m build --sdist --outdir build |
| 62 | + - uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: sdist |
| 65 | + path: ./sbuild/*.tar.gz |
| 66 | + |
0 commit comments