mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-20 02:18:59 +00:00
Use unpublished local wheels during PR builds (#6374)
* Use unpublished local wheels during PR builds Refactor wheel building to use the new `local-wheels-repo-path` and move wheels building into a separate CI job. Wheels are only published on published (i.e. release or merged dev), for PR builds they are passed as artifacts to the build job instead. * Address review comments * Add trailing slash for wheels folder * Always run the changed_files check to ensure build_wheels runs on publish * Use full path for workflow and escape dots in changed files regexp
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
# General files
|
# General files
|
||||||
.git
|
.git
|
||||||
.github
|
.github
|
||||||
|
.gitkeep
|
||||||
.devcontainer
|
.devcontainer
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
|||||||
104
.github/workflows/builder.yml
vendored
104
.github/workflows/builder.yml
vendored
@@ -72,19 +72,85 @@ jobs:
|
|||||||
|
|
||||||
- name: Get changed files
|
- name: Get changed files
|
||||||
id: changed_files
|
id: changed_files
|
||||||
if: steps.version.outputs.publish == 'false'
|
|
||||||
uses: masesgroup/retrieve-changed-files@491e80760c0e28d36ca6240a27b1ccb8e1402c13 # v3.0.0
|
uses: masesgroup/retrieve-changed-files@491e80760c0e28d36ca6240a27b1ccb8e1402c13 # v3.0.0
|
||||||
|
|
||||||
- name: Check if requirements files changed
|
- name: Check if requirements files changed
|
||||||
id: requirements
|
id: requirements
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ steps.changed_files.outputs.all }}" =~ (requirements.txt|build.yaml) ]]; then
|
if [[ "${{ steps.changed_files.outputs.all }}" =~ (requirements\.txt|build\.yaml|\.github/workflows/builder\.yml) ]]; then
|
||||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
build_wheels:
|
||||||
|
name: Build wheels for ${{ matrix.arch }}
|
||||||
|
needs: init
|
||||||
|
if: needs.init.outputs.requirements == 'true'
|
||||||
|
runs-on: ${{ matrix.runs-on }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch: ${{ fromJson(needs.init.outputs.architectures) }}
|
||||||
|
include:
|
||||||
|
- runs-on: ubuntu-24.04
|
||||||
|
- arch: aarch64
|
||||||
|
runs-on: ubuntu-24.04-arm
|
||||||
|
|
||||||
|
env:
|
||||||
|
ABI: cp313
|
||||||
|
TAG: musllinux_1_2
|
||||||
|
APK_DEPS: "libffi-dev;openssl-dev;yaml-dev"
|
||||||
|
SKIP_BINARY: aiohttp
|
||||||
|
steps:
|
||||||
|
- name: Checkout the repository
|
||||||
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||||||
|
|
||||||
|
- name: Write env-file
|
||||||
|
run: |
|
||||||
|
(
|
||||||
|
# Fix out of memory issues with rust
|
||||||
|
echo "CARGO_NET_GIT_FETCH_WITH_CLI=true"
|
||||||
|
) > .env_file
|
||||||
|
|
||||||
|
- name: Build and publish wheels
|
||||||
|
if: needs.init.outputs.publish == 'true'
|
||||||
|
uses: home-assistant/wheels@e5742a69d69f0e274e2689c998900c7d19652c21 # 2025.12.0
|
||||||
|
with:
|
||||||
|
wheels-key: ${{ secrets.WHEELS_KEY }}
|
||||||
|
abi: ${{ env.ABI }}
|
||||||
|
tag: ${{ env.TAG }}
|
||||||
|
arch: ${{ matrix.arch }}
|
||||||
|
apk: ${{ env.APK_DEPS }}
|
||||||
|
skip-binary: ${{ env.SKIP_BINARY }}
|
||||||
|
env-file: true
|
||||||
|
requirements: "requirements.txt"
|
||||||
|
|
||||||
|
- name: Build local wheels
|
||||||
|
uses: home-assistant/wheels@e5742a69d69f0e274e2689c998900c7d19652c21 # 2025.12.0
|
||||||
|
if: needs.init.outputs.publish == 'false'
|
||||||
|
with:
|
||||||
|
wheels-host: ""
|
||||||
|
wheels-user: ""
|
||||||
|
wheels-key: ""
|
||||||
|
local-wheels-repo-path: "wheels/"
|
||||||
|
abi: ${{ env.ABI }}
|
||||||
|
tag: ${{ env.TAG }}
|
||||||
|
arch: ${{ matrix.arch }}
|
||||||
|
apk: ${{ env.APK_DEPS }}
|
||||||
|
skip-binary: ${{ env.SKIP_BINARY }}
|
||||||
|
env-file: true
|
||||||
|
requirements: "requirements.txt"
|
||||||
|
|
||||||
|
- name: Upload local wheels artifact
|
||||||
|
if: needs.init.outputs.publish == 'false'
|
||||||
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
|
with:
|
||||||
|
name: wheels-${{ matrix.arch }}
|
||||||
|
path: wheels
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build ${{ matrix.arch }} supervisor
|
name: Build ${{ matrix.arch }} supervisor
|
||||||
needs: init
|
needs: [init, build_wheels]
|
||||||
|
if: ${{ !cancelled() && !failure() }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -99,27 +165,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Write env-file
|
- name: Download local wheels artifact
|
||||||
if: needs.init.outputs.requirements == 'true'
|
if: needs.init.outputs.requirements == 'true' && needs.init.outputs.publish == 'false'
|
||||||
run: |
|
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
|
||||||
(
|
|
||||||
# Fix out of memory issues with rust
|
|
||||||
echo "CARGO_NET_GIT_FETCH_WITH_CLI=true"
|
|
||||||
) > .env_file
|
|
||||||
|
|
||||||
# home-assistant/wheels doesn't support sha pinning
|
|
||||||
- name: Build wheels
|
|
||||||
if: needs.init.outputs.requirements == 'true'
|
|
||||||
uses: home-assistant/wheels@2025.11.0
|
|
||||||
with:
|
with:
|
||||||
abi: cp313
|
name: wheels-${{ matrix.arch }}
|
||||||
tag: musllinux_1_2
|
path: wheels
|
||||||
arch: ${{ matrix.arch }}
|
|
||||||
wheels-key: ${{ secrets.WHEELS_KEY }}
|
|
||||||
apk: "libffi-dev;openssl-dev;yaml-dev"
|
|
||||||
skip-binary: aiohttp
|
|
||||||
env-file: true
|
|
||||||
requirements: "requirements.txt"
|
|
||||||
|
|
||||||
- name: Set version
|
- name: Set version
|
||||||
if: needs.init.outputs.publish == 'true'
|
if: needs.init.outputs.publish == 'true'
|
||||||
@@ -208,6 +259,13 @@ jobs:
|
|||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||||||
|
|
||||||
|
- name: Download local wheels artifact
|
||||||
|
if: needs.init.outputs.requirements == 'true' && needs.init.outputs.publish == 'false'
|
||||||
|
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
|
||||||
|
with:
|
||||||
|
name: wheels-amd64
|
||||||
|
path: wheels
|
||||||
|
|
||||||
# home-assistant/builder doesn't support sha pinning
|
# home-assistant/builder doesn't support sha pinning
|
||||||
- name: Build the Supervisor
|
- name: Build the Supervisor
|
||||||
if: needs.init.outputs.publish != 'true'
|
if: needs.init.outputs.publish != 'true'
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -24,6 +24,9 @@ var/
|
|||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
|
|
||||||
|
# Local wheels
|
||||||
|
wheels/**/*.whl
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
|||||||
12
Dockerfile
12
Dockerfile
@@ -32,7 +32,17 @@ RUN \
|
|||||||
# Install requirements
|
# Install requirements
|
||||||
RUN \
|
RUN \
|
||||||
--mount=type=bind,source=./requirements.txt,target=/usr/src/requirements.txt \
|
--mount=type=bind,source=./requirements.txt,target=/usr/src/requirements.txt \
|
||||||
uv pip install --compile-bytecode --no-cache --no-build -r requirements.txt
|
--mount=type=bind,source=./wheels,target=/usr/src/wheels \
|
||||||
|
if ls /usr/src/wheels/musllinux/* >/dev/null 2>&1; then \
|
||||||
|
LOCAL_WHEELS=/usr/src/wheels/musllinux; \
|
||||||
|
echo "Using local wheels from: $LOCAL_WHEELS"; \
|
||||||
|
else \
|
||||||
|
LOCAL_WHEELS=; \
|
||||||
|
echo "No local wheels found"; \
|
||||||
|
fi && \
|
||||||
|
uv pip install --compile-bytecode --no-cache --no-build \
|
||||||
|
-r requirements.txt \
|
||||||
|
${LOCAL_WHEELS:+--find-links $LOCAL_WHEELS}
|
||||||
|
|
||||||
# Install Home Assistant Supervisor
|
# Install Home Assistant Supervisor
|
||||||
COPY . supervisor
|
COPY . supervisor
|
||||||
|
|||||||
0
wheels/.gitkeep
Normal file
0
wheels/.gitkeep
Normal file
Reference in New Issue
Block a user