.github/workflows/buildwheels.yml
author robin
Thu, 30 Dec 2021 09:16:31 +0000
changeset 114 bf2e9a81f2a9
parent 112 79b0997a73b8
permissions -rw-r--r--
change buildwheels action

# this is YAML check at http://www.yamllint.com/
name: BuildWheels

on:
  push:
    branches:
      - master

jobs:
  clear-cache:
    name: clear-cache
    runs-on: ubuntu-latest
    steps:
      - name: Dump github context
        run:  echo "$GITHUB_CONTEXT"
        shell: bash
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
      - name: setup python for clear-cache
        if: github.event.repository.name == 'pyRXP-mirror'
        uses: actions/setup-python@v2
        with:
          python-version: 3.9
      - name: clear
        if: github.event.repository.name == 'pyRXP-mirror'
        env:
          CITOOLS_USER: "${{secrets.CITOOLS_USER}}"
          CITOOLS_PASSWORD: "${{secrets.CITOOLS_PASSWORD}}"
        run: |
            python -mpip install --no-cache https://hg.reportlab.com/hg-public/rl-ci-tools/archive/tip.tar.gz -U
            python -mrl_ci_tools clear-cache "pyRXP"
            echo "cleared remote cache for pyRXP"
  build-wheels-linux-mac-windows:
    needs: [clear-cache]
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    env:
      CIBW_SKIP: pp* *-musllinux_* cp37-macosx_arm64 *-macosx_universal2 cp36-macosx_arm64 cp36-macosx_universal2
      #CIBW_BEFORE_BUILD_LINUX: yum install cairo-devel -y
      CIBW_BEFORE_TEST: pip install --no-cache-dir psutil
      CIBW_MANYLINUX_I686_IMAGE: manylinux2014
      # Will avoid testing on emulated architectures
      # Skip trying to test arm64 builds on Intel Macs
      CIBW_TEST_SKIP: "*-manylinux_{aarch64,ppc64le,s390x} *-musllinux_* *-macosx_arm64 *-macosx_universal2:arm64"
      CIBW_TEST_COMMAND: python "{project}/test/runAll.py"
      CIBW_TEST_COMMAND_WINDOWS: python "{project}\test\runAll.py"
      CIBW_BUILD_VERBOSITY: 3
    strategy:
      fail-fast: true
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    steps:
      - uses: actions/checkout@v2

      # Used to host cibuildwheel
      - uses: actions/setup-python@v2

      - name: Set up QEMU
        if: runner.os == 'Linux'
        uses: docker/setup-qemu-action@v1
        with:
          platforms: all

      - name: Install cibuildwheel
        run: |
          python -m pip install 'cibuildwheel==2.2.0a1'
          python -c "import os;print('+++++ cwd=%r;dir=%r' % (os.getcwd(),os.listdir('.')))"

      - name: Build wheels
        run: python -m cibuildwheel --output-dir wheelhouse
        env:
          CIBW_ARCHS_LINUX: all #auto aarch64 #needs quemu setup
          CIBW_ARCHS_MACOS: x86_64 arm64 universal2

      - name: upload wheels
        env:
          CITOOLS_USER: "${{secrets.CITOOLS_USER}}"
          CITOOLS_PASSWORD: "${{secrets.CITOOLS_PASSWORD}}"
        run: |
          python -mpip install --no-cache https://hg.reportlab.com/hg-public/rl-ci-tools/archive/tip.tar.gz -U
          python -mrl_ci_tools upload-caches --subdir="pyRXP" --verbosity=1 ./wheelhouse/*.whl
          python -mrl_ci_tools env-upload

      - uses: actions/upload-artifact@v2
        with:
          name: pyrxp-lin-win-mac
          path: ./wheelhouse/*.whl
  email:
    if: github.event.repository.name == 'pyRXP-mirror'
    name: email
    needs: [build-wheels-linux-mac-windows]
    runs-on: ubuntu-latest
    steps:
      - name: setup python for upload
        uses: actions/setup-python@v2
        with:
          python-version: 3.9
      - name: email confirmation
        env:
          CITOOLS_USER: "${{secrets.CITOOLS_USER}}"
          CITOOLS_PASSWORD: "${{secrets.CITOOLS_PASSWORD}}"
        run: |
            python -mpip install --no-cache https://hg.reportlab.com/hg-public/rl-ci-tools/archive/tip.tar.gz -U
            BODY="$(python -mrl_ci_tools cache-info --subdir="pyRXP" '*.whl')"
            NUPLOADS=$(expr $(echo "$BODY" | wc -l) - 1)
            SUBJECT="$NUPLOADS pyRXP wheels uploaded to pypi/caches/pyRXP folder by github"
            python -mrl_ci_tools email --subject="$SUBJECT" --body="$BODY"
            echo "$SUBJECT"
            echo "$BODY"