Build wheels #149
This file contains 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: Build wheels | |
# yamllint disable-line rule:truthy | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 4 * * *" | |
push: | |
branches: | |
- dev | |
- rc | |
paths: | |
- ".github/workflows/wheels.yml" | |
- "homeassistant/package_constraints.txt" | |
- "requirements_all.txt" | |
- "requirements.txt" | |
- "script/gen_requirements_all.py" | |
env: | |
DEFAULT_PYTHON: "3.12" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name}} | |
cancel-in-progress: true | |
jobs: | |
init: | |
name: Initialize wheels builder | |
if: github.repository_owner == 'home-assistant' | |
runs-on: ubuntu-latest | |
outputs: | |
architectures: ${{ steps.info.outputs.architectures }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4.1.7 | |
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | |
id: python | |
uses: actions/setup-python@v5.1.1 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
check-latest: true | |
- name: Create Python virtual environment | |
run: | | |
python -m venv venv | |
. venv/bin/activate | |
python --version | |
pip install "$(grep '^uv' < requirements_test.txt)" | |
uv pip install -r requirements.txt | |
- name: Get information | |
id: info | |
uses: home-assistant/actions/helpers/info@master | |
- name: Create requirements_diff file | |
run: | | |
if [[ ${{ github.event_name }} =~ (schedule|workflow_dispatch) ]]; then | |
touch requirements_diff.txt | |
else | |
curl -s -o requirements_diff.txt https://raw.githubusercontent.com/home-assistant/core/master/requirements.txt | |
fi | |
- name: Write env-file | |
run: | | |
( | |
echo "GRPC_BUILD_WITH_BORING_SSL_ASM=false" | |
echo "GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=true" | |
echo "GRPC_PYTHON_BUILD_WITH_CYTHON=true" | |
echo "GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY=true" | |
echo "GRPC_PYTHON_LDFLAGS=-lpthread -Wl,-wrap,memcpy -static-libgcc" | |
# Fix out of memory issues with rust | |
echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" | |
# OpenCV headless installation | |
echo "CI_BUILD=1" | |
echo "ENABLE_HEADLESS=1" | |
# Use C-Extension for SQLAlchemy | |
echo "REQUIRE_SQLALCHEMY_CEXT=1" | |
) > .env_file | |
- name: Upload env_file | |
uses: actions/upload-artifact@v4.3.6 | |
with: | |
name: env_file | |
path: ./.env_file | |
overwrite: true | |
- name: Upload requirements_diff | |
uses: actions/upload-artifact@v4.3.6 | |
with: | |
name: requirements_diff | |
path: ./requirements_diff.txt | |
overwrite: true | |
- name: Generate requirements | |
run: | | |
. venv/bin/activate | |
python -m script.gen_requirements_all ci | |
- name: Upload requirements_all_wheels | |
uses: actions/upload-artifact@v4.3.6 | |
with: | |
name: requirements_all_wheels | |
path: ./requirements_all_wheels_*.txt | |
core: | |
name: Build Core wheels ${{ matrix.abi }} for ${{ matrix.arch }} (musllinux_1_2) | |
if: github.repository_owner == 'home-assistant' | |
needs: init | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
abi: ["cp312"] | |
arch: ${{ fromJson(needs.init.outputs.architectures) }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4.1.7 | |
- name: Download env_file | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: env_file | |
- name: Download requirements_diff | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: requirements_diff | |
- name: Build wheels | |
uses: home-assistant/wheels@2024.07.1 | |
with: | |
abi: ${{ matrix.abi }} | |
tag: musllinux_1_2 | |
arch: ${{ matrix.arch }} | |
wheels-key: ${{ secrets.WHEELS_KEY }} | |
env-file: true | |
apk: "libffi-dev;openssl-dev;yaml-dev;nasm" | |
skip-binary: aiohttp | |
constraints: "homeassistant/package_constraints.txt" | |
requirements-diff: "requirements_diff.txt" | |
requirements: "requirements.txt" | |
integrations: | |
name: Build wheels ${{ matrix.abi }} for ${{ matrix.arch }} | |
if: github.repository_owner == 'home-assistant' | |
needs: init | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
abi: ["cp312"] | |
arch: ${{ fromJson(needs.init.outputs.architectures) }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4.1.7 | |
- name: Download env_file | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: env_file | |
- name: Download requirements_diff | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: requirements_diff | |
- name: Download requirements_all_wheels | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: requirements_all_wheels | |
- name: Split requirements all | |
run: | | |
# We split requirements all into multiple files. | |
# This is to prevent the build from running out of memory when | |
# resolving packages on 32-bits systems (like armhf, armv7). | |
split -l $(expr $(expr $(cat requirements_all.txt | wc -l) + 1) / 3) requirements_all_wheels_${{ matrix.arch }}.txt requirements_all.txt | |
- name: Create requirements for cython<3 | |
run: | | |
# Some dependencies still require 'cython<3' | |
# and don't yet use isolated build environments. | |
# Build these first. | |
# grpcio: https://github.com/grpc/grpc/issues/33918 | |
# pydantic: https://github.com/pydantic/pydantic/issues/7689 | |
touch requirements_old-cython.txt | |
cat homeassistant/package_constraints.txt | grep 'grpcio==' >> requirements_old-cython.txt | |
cat homeassistant/package_constraints.txt | grep 'pydantic==' >> requirements_old-cython.txt | |
- name: Adjust build env | |
run: | | |
if [ "${{ matrix.arch }}" = "i386" ]; then | |
echo "NPY_DISABLE_SVML=1" >> .env_file | |
fi | |
# Do not pin numpy in wheels building | |
sed -i "/numpy/d" homeassistant/package_constraints.txt | |
- name: Build wheels (old cython) | |
uses: home-assistant/wheels@2024.07.1 | |
with: | |
abi: ${{ matrix.abi }} | |
tag: musllinux_1_2 | |
arch: ${{ matrix.arch }} | |
wheels-key: ${{ secrets.WHEELS_KEY }} | |
env-file: true | |
apk: "bluez-dev;libffi-dev;openssl-dev;glib-dev;eudev-dev;libxml2-dev;libxslt-dev;libpng-dev;libjpeg-turbo-dev;tiff-dev;cups-dev;gmp-dev;mpfr-dev;mpc1-dev;ffmpeg-dev;gammu-dev;yaml-dev;openblas-dev;fftw-dev;lapack-dev;gfortran;blas-dev;eigen-dev;freetype-dev;glew-dev;harfbuzz-dev;hdf5-dev;libdc1394-dev;libtbb-dev;mesa-dev;openexr-dev;openjpeg-dev;uchardet-dev" | |
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic;pymicro-vad | |
constraints: "homeassistant/package_constraints.txt" | |
requirements-diff: "requirements_diff.txt" | |
requirements: "requirements_old-cython.txt" | |
pip: "'cython<3'" | |
- name: Build wheels (part 1) | |
uses: home-assistant/wheels@2024.07.1 | |
with: | |
abi: ${{ matrix.abi }} | |
tag: musllinux_1_2 | |
arch: ${{ matrix.arch }} | |
wheels-key: ${{ secrets.WHEELS_KEY }} | |
env-file: true | |
apk: "bluez-dev;libffi-dev;openssl-dev;glib-dev;eudev-dev;libxml2-dev;libxslt-dev;libpng-dev;libjpeg-turbo-dev;tiff-dev;cups-dev;gmp-dev;mpfr-dev;mpc1-dev;ffmpeg-dev;gammu-dev;yaml-dev;openblas-dev;fftw-dev;lapack-dev;gfortran;blas-dev;eigen-dev;freetype-dev;glew-dev;harfbuzz-dev;hdf5-dev;libdc1394-dev;libtbb-dev;mesa-dev;openexr-dev;openjpeg-dev;uchardet-dev;nasm" | |
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic;pymicro-vad | |
constraints: "homeassistant/package_constraints.txt" | |
requirements-diff: "requirements_diff.txt" | |
requirements: "requirements_all.txtaa" | |
- name: Build wheels (part 2) | |
uses: home-assistant/wheels@2024.07.1 | |
with: | |
abi: ${{ matrix.abi }} | |
tag: musllinux_1_2 | |
arch: ${{ matrix.arch }} | |
wheels-key: ${{ secrets.WHEELS_KEY }} | |
env-file: true | |
apk: "bluez-dev;libffi-dev;openssl-dev;glib-dev;eudev-dev;libxml2-dev;libxslt-dev;libpng-dev;libjpeg-turbo-dev;tiff-dev;cups-dev;gmp-dev;mpfr-dev;mpc1-dev;ffmpeg-dev;gammu-dev;yaml-dev;openblas-dev;fftw-dev;lapack-dev;gfortran;blas-dev;eigen-dev;freetype-dev;glew-dev;harfbuzz-dev;hdf5-dev;libdc1394-dev;libtbb-dev;mesa-dev;openexr-dev;openjpeg-dev;uchardet-dev;nasm" | |
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic;pymicro-vad | |
constraints: "homeassistant/package_constraints.txt" | |
requirements-diff: "requirements_diff.txt" | |
requirements: "requirements_all.txtab" | |
- name: Build wheels (part 3) | |
uses: home-assistant/wheels@2024.07.1 | |
with: | |
abi: ${{ matrix.abi }} | |
tag: musllinux_1_2 | |
arch: ${{ matrix.arch }} | |
wheels-key: ${{ secrets.WHEELS_KEY }} | |
env-file: true | |
apk: "bluez-dev;libffi-dev;openssl-dev;glib-dev;eudev-dev;libxml2-dev;libxslt-dev;libpng-dev;libjpeg-turbo-dev;tiff-dev;cups-dev;gmp-dev;mpfr-dev;mpc1-dev;ffmpeg-dev;gammu-dev;yaml-dev;openblas-dev;fftw-dev;lapack-dev;gfortran;blas-dev;eigen-dev;freetype-dev;glew-dev;harfbuzz-dev;hdf5-dev;libdc1394-dev;libtbb-dev;mesa-dev;openexr-dev;openjpeg-dev;uchardet-dev;nasm" | |
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic;pymicro-vad | |
constraints: "homeassistant/package_constraints.txt" | |
requirements-diff: "requirements_diff.txt" | |
requirements: "requirements_all.txtac" |