platforms-dispatches #589
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: platforms-dispatches | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 0,3' | |
| workflow_dispatch: | |
| env: | |
| GH_TOKEN : ${{ secrets.GITHUB_TOKEN }} | |
| jobs: | |
| get-supported-versions: | |
| name: Get Supported Versions | |
| uses: ./.github/workflows/get-supported-versions.yml | |
| secrets: inherit | |
| build-wheels: | |
| needs: get-supported-versions | |
| name: Build for ${{ matrix.os }} (Python ${{matrix.python-version}}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: # Platform names for identification | |
| - Windows | |
| - Linux x86_64 | |
| - macOS Intel | |
| - macOS ARM | |
| - Linux ARM64 | |
| - Linux ARMv7 | |
| - Linux ARMv7 Legacy | |
| include: | |
| - os: Windows | |
| runner: windows-latest | |
| arch: windows-x86_64 | |
| - os: Linux x86_64 | |
| runner: ubuntu-latest | |
| arch: linux-x86_64 | |
| - os: macOS Intel | |
| runner: macos-15-intel | |
| arch: macos-x86_64 | |
| - os: macOS ARM | |
| runner: macos-latest | |
| arch: macos-arm64 | |
| - os: Linux ARM64 | |
| runner: ubuntu-24.04-arm | |
| arch: linux-arm64 | |
| - os: Linux ARMv7 | |
| runner: ubuntu-latest | |
| arch: linux-armv7 | |
| - os: Linux ARMv7 Legacy | |
| runner: ubuntu-latest | |
| arch: linux-armv7legacy | |
| python-version: ['${{ needs.get-supported-versions.outputs.oldest_supported_python }}'] | |
| steps: | |
| - name: Set up QEMU for ARMv7 | |
| if: matrix.os == 'Linux ARMv7' || matrix.os == 'Linux ARMv7 Legacy' | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: linux/arm/v7 | |
| - name: OS info | |
| if: matrix.os != 'Windows' | |
| run: | | |
| echo "Operating System: ${{ runner.os }}" | |
| echo "Architecture: $(uname -m)" | |
| - name: OS info | |
| if: matrix.os == 'Windows' | |
| run: | | |
| echo "Operating System: ${{ runner.os }}" | |
| echo "Architecture: $env:PROCESSOR_ARCHITECTURE" | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set IDF version environment variables | |
| run: | | |
| echo "MIN_IDF_MAJOR_VERSION=${{ needs.get-supported-versions.outputs.min_idf_major_version }}" >> $GITHUB_ENV | |
| echo "MIN_IDF_MINOR_VERSION=${{ needs.get-supported-versions.outputs.min_idf_minor_version }}" >> $GITHUB_ENV | |
| echo "Setting MIN_IDF_MAJOR_VERSION=${{ needs.get-supported-versions.outputs.min_idf_major_version }}, MIN_IDF_MINOR_VERSION=${{ needs.get-supported-versions.outputs.min_idf_minor_version }}" | |
| - name: Setup Python | |
| # Skip setting python on ARM because of missing compatibility: https://github.com/actions/setup-python/issues/108 | |
| if: matrix.os != 'Linux ARMv7' && matrix.os != 'Linux ARMv7 Legacy' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install build dependencies | |
| if: matrix.os != 'Linux ARMv7' && matrix.os != 'Linux ARMv7 Legacy' | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -r build_requirements.txt | |
| - name: Get Tools versions | |
| if: matrix.os != 'Linux ARMv7' && matrix.os != 'Linux ARMv7 Legacy' | |
| run: | | |
| python --version | |
| pip show pip setuptools | |
| - name: Install additional OS dependencies - Ubuntu | |
| if: matrix.os == 'Linux x86_64' | |
| run: os_dependencies/ubuntu.sh | |
| - name: Install additional OS dependencies - MacOS | |
| if: matrix.os == 'macOS ARM' || matrix.os == 'macOS Intel' | |
| run: os_dependencies/macos.sh | |
| - name: Install additional OS dependencies - Linux ARM64 | |
| if: matrix.os == 'Linux ARM64' | |
| run: sudo bash os_dependencies/linux_arm.sh | |
| - name: Install additional OS dependencies - Windows | |
| if: matrix.os == 'Windows' | |
| run: powershell -ExecutionPolicy Bypass -File os_dependencies/windows.ps1 | |
| - name: Build wheels for IDF - ARMv7 (in Docker) | |
| if: matrix.os == 'Linux ARMv7' | |
| run: | | |
| docker run --rm --platform linux/arm/v7 \ | |
| -v $(pwd):/work \ | |
| -w /work \ | |
| -e MIN_IDF_MAJOR_VERSION=${{ needs.get-supported-versions.outputs.min_idf_major_version }} \ | |
| -e MIN_IDF_MINOR_VERSION=${{ needs.get-supported-versions.outputs.min_idf_minor_version }} \ | |
| -e GH_TOKEN="${GH_TOKEN}" \ | |
| -e PIP_NO_CACHE_DIR=1 \ | |
| python:${{ matrix.python-version }}-bookworm \ | |
| bash -c " | |
| set -e | |
| python --version | |
| # Install pip packages without cache to reduce memory usage | |
| python -m pip install --no-cache-dir --upgrade pip | |
| python -m pip install --no-cache-dir -r build_requirements.txt | |
| bash os_dependencies/linux_arm.sh | |
| # Source Rust environment after installation | |
| . \$HOME/.cargo/env | |
| python build_wheels.py | |
| " | |
| - name: Build wheels for IDF - ARMv7 Legacy (in Docker) | |
| # Build on Bullseye (glibc 2.31) for compatibility with older systems | |
| # Note: Buster has Python 3.7 which is too old for our dependencies | |
| if: matrix.os == 'Linux ARMv7 Legacy' | |
| run: | | |
| docker run --rm --platform linux/arm/v7 \ | |
| -v $(pwd):/work \ | |
| -w /work \ | |
| -e MIN_IDF_MAJOR_VERSION=${{ needs.get-supported-versions.outputs.min_idf_major_version }} \ | |
| -e MIN_IDF_MINOR_VERSION=${{ needs.get-supported-versions.outputs.min_idf_minor_version }} \ | |
| -e GH_TOKEN="${GH_TOKEN}" \ | |
| -e PIP_NO_CACHE_DIR=1 \ | |
| python:${{ matrix.python-version }}-bullseye \ | |
| bash -c " | |
| set -e | |
| python --version | |
| # Install pip packages without cache to reduce memory usage | |
| python -m pip install --no-cache-dir --upgrade pip | |
| python -m pip install --no-cache-dir -r build_requirements.txt | |
| bash os_dependencies/linux_arm.sh | |
| # Source Rust environment after installation | |
| . \$HOME/.cargo/env | |
| python build_wheels.py | |
| " | |
| - name: Build wheels for IDF - Linux/macOS | |
| if: matrix.os != 'Windows' && matrix.os != 'Linux ARMv7' && matrix.os != 'Linux ARMv7 Legacy' | |
| run: | | |
| # Set ARCHFLAGS for macOS to prevent universal2 wheels | |
| if [ "${{ matrix.os }}" = "macOS ARM" ]; then | |
| export ARCHFLAGS="-arch arm64" | |
| elif [ "${{ matrix.os }}" = "macOS Intel" ]; then | |
| export ARCHFLAGS="-arch x86_64" | |
| fi | |
| python build_wheels.py | |
| - name: Build wheels for IDF - Windows | |
| if: matrix.os == 'Windows' | |
| run: python build_wheels.py | |
| - name: Upload artifacts of downloaded_wheels directory | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-download-directory-${{ matrix.arch }}-${{ matrix.python-version }} | |
| path: ./downloaded_wheels | |
| retention-days: 1 | |
| - name: Upload artifacts of Python version dependent wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dependent_requirements_${{ matrix.arch }} | |
| path: ./dependent_requirements.txt | |
| retention-days: 1 | |
| build-python-version-dependent-wheels: | |
| needs: [get-supported-versions, build-wheels] | |
| name: Build Python version dependendent wheels for IDF | |
| uses: ./.github/workflows/build-wheels-python-dependent.yml | |
| with: | |
| supported_python_versions: ${{ needs.get-supported-versions.outputs.supported_python }} | |
| oldest_supported_python: ${{ needs.get-supported-versions.outputs.oldest_supported_python }} | |
| # Repair wheels for dynamically linked libraries on all platforms | |
| # https://github.com/espressif/idf-python-wheels/blob/main/README.md#universal-wheel-tag---linking-of-dynamic-libraries | |
| repair-wheels: | |
| needs: [build-wheels, build-python-version-dependent-wheels] | |
| name: Repair wheels | |
| uses: ./.github/workflows/wheels-repair.yml | |
| upload-python-wheels: | |
| needs: [get-supported-versions, repair-wheels] | |
| name: Upload Python wheels | |
| uses: ./.github/workflows/upload-python-wheels.yml | |
| with: | |
| supported_python_versions: ${{ needs.get-supported-versions.outputs.supported_python }} | |
| secrets: inherit | |
| verify-s3-wheels: | |
| needs: [get-supported-versions, upload-python-wheels] | |
| name: Verify S3 wheels against exclude list | |
| runs-on: ubuntu-latest | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Get latest Python version | |
| id: python-version | |
| run: | | |
| VERSIONS='${{ needs.get-supported-versions.outputs.supported_python }}' | |
| LATEST=$(echo "$VERSIONS" | jq -r '.[0]') | |
| echo "version=$LATEST" >> $GITHUB_OUTPUT | |
| - name: Setup Python ${{ steps.python-version.outputs.version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ steps.python-version.outputs.version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r build_requirements.txt | |
| - name: Verify S3 wheels | |
| run: python verify_s3_wheels.py ${{ secrets.DL_BUCKET }} ${{ needs.get-supported-versions.outputs.oldest_supported_python }} '${{ needs.get-supported-versions.outputs.supported_python }}' |