.github/workflows/dist.yaml

Summary

Maintainability
Test Coverage
name: Build Packages

on: [push]

jobs:
  wheels-macos:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [macos-10.15]
        python-version: [3.6]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }} (64-bit)
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
        architecture: 'x64'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
    - name: Build abi3 wheel (64-bit)
      run: |
        python setup.py bdist_wheel --py-limited-api cp35
    - name: Upload
      uses: actions/upload-artifact@v2
      with:
        path: dist/*

  wheels-windows:
    runs-on: windows-2019

    strategy:
      matrix:
        python-version: [3.6]

    steps:
      - uses: actions/checkout@v2
      - name: Set up Python ${{ matrix.python-version }} (64-bit)
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
          architecture: 'x64'
      - name: Install dependencies (x64)
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
      - name: Build abi3 wheel (64-bit)
        run: |
          python setup.py bdist_wheel --py-limited-api cp35
      - name: Set up Python ${{ matrix.python-version }} (32-bit)
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
          architecture: 'x86'
      - name: Install dependencies (x86)
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
      - name: Build abi3 wheel (32-bit)
        run: |
          python setup.py bdist_wheel --py-limited-api cp35
      - name: Upload
        uses: actions/upload-artifact@v2
        with:
          path: dist/*

  sdist-and-pure-wheel:
    runs-on: ubuntu-20.04

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: '3.x'
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
      - name: sdist
        run: python setup.py sdist --formats zip,gztar,xztar,bztar
      - name: bdist_wheel
        run: python setup.py bdist_wheel --exclude-extension --universal
      - name: "Rename wheel"
        shell: pwsh
        run: |
          $version = (python setup.py --fullname)
          $tagPyPyAnd2 = "py2.pp35.pp36.pp37.pp38.pp39-none-any"
          $tagUniversal = "py2.py3-none-any"
          Move-Item ./dist/$version-$tagUniversal.whl ./dist/$version-$tagPyPyAnd2.whl
      - name: Upload
        uses: actions/upload-artifact@v2
        with:
          path: dist/*

  wheels-for-manylinux:
    runs-on: ubuntu-20.04

    steps:
    - uses: actions/checkout@v2
    - name: Setup qemu-user-static for docker
      run: |
        docker pull multiarch/qemu-user-static
        docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
    - name: Build abi3 wheel
      run: |
        for P in manylinux1_x86_64 manylinux1_i686 manylinux2014_aarch64; do
          if [ "$P" = manylinux1_i686 ]; then
            PRE="linux32"
          else
            PRE=""
          fi
          docker pull quay.io/pypa/$P
          docker run --rm -e PLAT=$P -v $(pwd):/io quay.io/pypa/$P $PRE sh -c "
            cd /io
            /opt/python/cp36-cp36m/bin/pip install -r requirements.txt
            /opt/python/cp36-cp36m/bin/python3 setup.py bdist_wheel --py-limited-api cp35
            auditwheel repair dist/*.whl
            rm dist/*.whl
          "
        done
    - name: Upload
      uses: actions/upload-artifact@v2
      with:
        path: wheelhouse/*.whl

  wheels-for-musllinux:
    runs-on: ubuntu-20.04

    steps:
    - uses: actions/checkout@v2
    - name: Setup qemu-user-static for docker
      run: |
        docker pull multiarch/qemu-user-static
        docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
    - name: Build abi3 wheel
      run: |
        ALPINE_VERSION=3.14
        for P in amd64; do
          docker pull "alpine:${ALPINE_VERSION}"
          docker run --rm -e PLAT=$P -e "ALPINE_VERSION=${ALPINE_VERSION}" -v $(pwd):/io "alpine:${ALPINE_VERSION}" $PRE sh -c "
            cd /io
            echo "http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community" >> /etc/apk/repositories
            
            set -x
            apk add python3 python3-dev gcc py3-pip gcc musl-dev patchelf
            pip3 install -r requirements.txt
            pip3 install auditwheel
            python3 setup.py bdist_wheel --py-limited-api cp35
            auditwheel repair dist/*.whl
            rm dist/*.whl
          "
        done
    - name: Upload
      uses: actions/upload-artifact@v2
      with:
        path: wheelhouse/*.whl