From a9d859bcc78b87a0ba7fa45cdb64a76a95cacad3 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 11:38:34 +0100 Subject: [PATCH 01/14] Reformat build.yaml --- .github/workflows/build.yaml | 324 +++++++++++++++++------------------ 1 file changed, 162 insertions(+), 162 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 56fca09..a9d481c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -6,171 +6,171 @@ env: matter_sdk_ref: v1.2.0.1 jobs: - build_prepare: - name: Prepare build - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version.outputs.version }} - channel: ${{ steps.version.outputs.channel }} - steps: - - name: Checkout build repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Get version - id: version - shell: bash - run: | - version=$(echo "${{ github.ref }}" | awk -F"/" '{print $NF}') - if [[ ! -z "${{ github.event.inputs.version }}" ]]; then - version="${{ github.event.inputs.version }}" - elif [[ "${version}" =~ (main|dev) ]]; then - today="$(date --utc '+%Y-%m-%d')" - midnight_timestamp="$(date --utc +%s --date=$today)" - calver_date="$(date --utc --date=$today '+%Y.%-m.dev%-d')" - commit_count="$(git rev-list --count --since=$midnight_timestamp HEAD)" - commit_count="$(printf "%02d" ${commit_count})" - version="${calver_date}${commit_count}" - elif [[ "${{ github.ref }}" =~ ^refs/heads/ ]]; then - today="$(date --utc '+%Y-%m-%d')" - midnight_timestamp="$(date --utc +%s --date=$today)" - calver_date="$(date --utc --date=$today '+%Y.%-m.dev%-d')" - # Remove invalid chars - localversion="${version}" - localversion="${localversion//-/}" - localversion="${localversion//_/}" - version="${calver_date}+${localversion}" - fi - echo "Building version $version" - echo "version=$version" >> "$GITHUB_OUTPUT" - - name: Checkout CHIP SDK repository - uses: actions/checkout@v3 - with: - repository: project-chip/connectedhomeip - ref: ${{ env.matter_sdk_ref }} - path: ./project-chip - - name: Checkout submodules - working-directory: ./project-chip - run: scripts/checkout_submodules.py --shallow --platform linux - - name: Apply patches - working-directory: ./project-chip - run: | - for patch in ../*.patch - do - echo "Applying ${patch}" - patch -p1 < $patch - done - - name: Bootstrap - working-directory: ./project-chip - run: bash scripts/bootstrap.sh - - name: ZAP Code pre-generation - working-directory: ./project-chip - run: scripts/run_in_build_env.sh "scripts/codepregen.py ./zzz_pregenerated/" - - name: Create Matter SDK tar - working-directory: ./project-chip - run: tar -caf ../project-chip.tar.zst --exclude .environment --use-compress-program=zstdmt . - - name: Store Matter SDK as artifact - uses: actions/upload-artifact@v3 - with: - name: matter-sdk-${{ github.run_id }} - path: ./project-chip.tar.zst + build_prepare: + name: Prepare build + runs-on: ubuntu-22.04 + outputs: + version: ${{ steps.version.outputs.version }} + channel: ${{ steps.version.outputs.channel }} + steps: + - name: Checkout build repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Get version + id: version + shell: bash + run: | + version=$(echo "${{ github.ref }}" | awk -F"/" '{print $NF}') + if [[ ! -z "${{ github.event.inputs.version }}" ]]; then + version="${{ github.event.inputs.version }}" + elif [[ "${version}" =~ (main|dev) ]]; then + today="$(date --utc '+%Y-%m-%d')" + midnight_timestamp="$(date --utc +%s --date=$today)" + calver_date="$(date --utc --date=$today '+%Y.%-m.dev%-d')" + commit_count="$(git rev-list --count --since=$midnight_timestamp HEAD)" + commit_count="$(printf "%02d" ${commit_count})" + version="${calver_date}${commit_count}" + elif [[ "${{ github.ref }}" =~ ^refs/heads/ ]]; then + today="$(date --utc '+%Y-%m-%d')" + midnight_timestamp="$(date --utc +%s --date=$today)" + calver_date="$(date --utc --date=$today '+%Y.%-m.dev%-d')" + # Remove invalid chars + localversion="${version}" + localversion="${localversion//-/}" + localversion="${localversion//_/}" + version="${calver_date}+${localversion}" + fi + echo "Building version $version" + echo "version=$version" >> "$GITHUB_OUTPUT" + - name: Checkout CHIP SDK repository + uses: actions/checkout@v3 + with: + repository: project-chip/connectedhomeip + ref: ${{ env.matter_sdk_ref }} + path: ./project-chip + - name: Checkout submodules + working-directory: ./project-chip + run: scripts/checkout_submodules.py --shallow --platform linux + - name: Apply patches + working-directory: ./project-chip + run: | + for patch in ../*.patch + do + echo "Applying ${patch}" + patch -p1 < $patch + done + - name: Bootstrap + working-directory: ./project-chip + run: bash scripts/bootstrap.sh + - name: ZAP Code pre-generation + working-directory: ./project-chip + run: scripts/run_in_build_env.sh "scripts/codepregen.py ./zzz_pregenerated/" + - name: Create Matter SDK tar + working-directory: ./project-chip + run: tar -caf ../project-chip.tar.zst --exclude .environment --use-compress-program=zstdmt . + - name: Store Matter SDK as artifact + uses: actions/upload-artifact@v3 + with: + name: matter-sdk-${{ github.run_id }} + path: ./project-chip.tar.zst - build_linux_python_lib: - name: Build Python wheels for Linux (${{ matrix.arch.name }}) - needs: build_prepare + build_linux_python_lib: + name: Build Python wheels for Linux (${{ matrix.arch.name }}) + needs: build_prepare - strategy: - matrix: - arch: - - name: x86_64 - container: ghcr.io/project-chip/chip-build:1 - runner: ubuntu-22.04 - - name: aarch64 - container: docker.io/agners/aarch64-chip-build:1 - runner: ARM64 + strategy: + matrix: + arch: + - name: x86_64 + container: ghcr.io/project-chip/chip-build:1 + runner: ubuntu-22.04 + - name: aarch64 + container: docker.io/agners/aarch64-chip-build:1 + runner: ARM64 - runs-on: ${{ matrix.arch.runner }} - permissions: - contents: write # for actions/upload-release-asset to upload release asset + runs-on: ${{ matrix.arch.runner }} + permissions: + contents: write # for actions/upload-release-asset to upload release asset - defaults: - run: - working-directory: ./project-chip + defaults: + run: + working-directory: ./project-chip - container: - image: ${{ matrix.arch.container }} - volumes: - - "/tmp/log_output:/tmp/test_logs" - options: --sysctl "net.ipv6.conf.all.disable_ipv6=0 - net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" + container: + image: ${{ matrix.arch.container }} + volumes: + - "/tmp/log_output:/tmp/test_logs" + options: --sysctl "net.ipv6.conf.all.disable_ipv6=0 + net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" - steps: - - name: Restore Matter SDK from artifacts - uses: actions/download-artifact@v3 - with: - name: matter-sdk-${{ github.run_id }} - - name: Extract Matter SDK from tar - working-directory: ./ - run: | - rm -rf project-chip - mkdir -p project-chip - cd project-chip - apt update && apt install zstd - tar -xaf ../project-chip.tar.zst --use-compress-program=zstdmt . - git config --global --add safe.directory "*" - rm -rf out/ - - name: Bootstrap - run: bash scripts/bootstrap.sh - - name: Setup Build, Run Build and Run Tests - run: | - scripts/build/gn_gen.sh --args=" \ - enable_rtti=true \ - enable_pylib=true \ - chip_config_memory_debug_checks=false \ - chip_config_memory_debug_dmalloc=false \ - chip_mdns=\"minimal\" \ - chip_minmdns_default_policy=\"libnl\" \ - chip_python_version=\"${{ needs.build_prepare.outputs.version }}\" \ - chip_python_package_prefix=\"home-assistant-chip\" \ - chip_python_platform_tag=\"manylinux_2_31\" \ - chip_code_pre_generated_directory=\"$(pwd)/zzz_pregenerated\" \ - " - scripts/run_in_build_env.sh "ninja -C ./out chip-repl" - - name: Run Python library specific unit tests - run: | - scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl' - scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' - scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' - scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' - - name: Upload wheels as artifacts - uses: actions/upload-artifact@v3 - with: - name: chip-wheels-${{ matrix.arch.name }} - path: project-chip/out/controller/python/*.whl - - name: Upload wheels as release assets - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: project-chip/out/controller/python/*.whl - - name: Upload wheels to PyPI - if: startsWith(github.ref, 'refs/tags/') - env: - TWINE_USERNAME: "__token__" - TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_PYPI }} - TWINE_REPOSITORY: "pypi" - run: | - python3 -m pip install twine build - python3 -m twine upload out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing - python3 -m twine upload out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl --skip-existing - python3 -m twine upload out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing - - name: Upload wheels to Test PyPI - if: ${{ github.ref == 'refs/heads/main' }} - env: - TWINE_USERNAME: "__token__" - TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_TESTPYPI }} - TWINE_REPOSITORY: "testpypi" - run: | - python3 -m pip install twine build - python3 -m twine upload out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing - python3 -m twine upload out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl --skip-existing - python3 -m twine upload out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing + steps: + - name: Restore Matter SDK from artifacts + uses: actions/download-artifact@v3 + with: + name: matter-sdk-${{ github.run_id }} + - name: Extract Matter SDK from tar + working-directory: ./ + run: | + rm -rf project-chip + mkdir -p project-chip + cd project-chip + apt update && apt install zstd + tar -xaf ../project-chip.tar.zst --use-compress-program=zstdmt . + git config --global --add safe.directory "*" + rm -rf out/ + - name: Bootstrap + run: bash scripts/bootstrap.sh + - name: Setup Build, Run Build and Run Tests + run: | + scripts/build/gn_gen.sh --args=" \ + enable_rtti=true \ + enable_pylib=true \ + chip_config_memory_debug_checks=false \ + chip_config_memory_debug_dmalloc=false \ + chip_mdns=\"minimal\" \ + chip_minmdns_default_policy=\"libnl\" \ + chip_python_version=\"${{ needs.build_prepare.outputs.version }}\" \ + chip_python_package_prefix=\"home-assistant-chip\" \ + chip_python_platform_tag=\"manylinux_2_31\" \ + chip_code_pre_generated_directory=\"$(pwd)/zzz_pregenerated\" \ + " + scripts/run_in_build_env.sh "ninja -C ./out chip-repl" + - name: Run Python library specific unit tests + run: | + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl' + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' + scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' + - name: Upload wheels as artifacts + uses: actions/upload-artifact@v3 + with: + name: chip-wheels-${{ matrix.arch.name }} + path: project-chip/out/controller/python/*.whl + - name: Upload wheels as release assets + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: project-chip/out/controller/python/*.whl + - name: Upload wheels to PyPI + if: startsWith(github.ref, 'refs/tags/') + env: + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_PYPI }} + TWINE_REPOSITORY: "pypi" + run: | + python3 -m pip install twine build + python3 -m twine upload out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing + python3 -m twine upload out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl --skip-existing + python3 -m twine upload out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing + - name: Upload wheels to Test PyPI + if: ${{ github.ref == 'refs/heads/main' }} + env: + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_TESTPYPI }} + TWINE_REPOSITORY: "testpypi" + run: | + python3 -m pip install twine build + python3 -m twine upload out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing + python3 -m twine upload out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl --skip-existing + python3 -m twine upload out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing From 792c4123983f67f530f3595a87999b5216a129b0 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 11:39:54 +0100 Subject: [PATCH 02/14] Enable macOS aarch64 builds --- .github/workflows/build.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a9d481c..343135d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,7 +8,10 @@ env: jobs: build_prepare: name: Prepare build - runs-on: ubuntu-22.04 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04, macos-14] outputs: version: ${{ steps.version.outputs.version }} channel: ${{ steps.version.outputs.channel }} From 86c157efb709288cb89e00a0b65695fafba674ba Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 11:48:24 +0100 Subject: [PATCH 03/14] Only run build on macOS --- .github/workflows/build.yaml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 343135d..ac94afd 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,10 +8,6 @@ env: jobs: build_prepare: name: Prepare build - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-22.04, macos-14] outputs: version: ${{ steps.version.outputs.version }} channel: ${{ steps.version.outputs.channel }} @@ -54,7 +50,7 @@ jobs: path: ./project-chip - name: Checkout submodules working-directory: ./project-chip - run: scripts/checkout_submodules.py --shallow --platform linux + run: scripts/checkout_submodules.py --shallow --platform linux --platform darwin - name: Apply patches working-directory: ./project-chip run: | @@ -85,12 +81,15 @@ jobs: strategy: matrix: arch: - - name: x86_64 + - name: linux-x86_64 container: ghcr.io/project-chip/chip-build:1 runner: ubuntu-22.04 - - name: aarch64 + - name: linux-aarch64 container: docker.io/agners/aarch64-chip-build:1 runner: ARM64 + - name: macos-aarch64 + container: ghcr.io/project-chip/chip-build:1 + runner: macos-14 runs-on: ${{ matrix.arch.runner }} permissions: From e86ce03c6cb5dc8413c42b8a63f3f5ddc1eb5229 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 11:51:53 +0100 Subject: [PATCH 04/14] Fix prepare --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ac94afd..23203bb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,6 +8,7 @@ env: jobs: build_prepare: name: Prepare build + runs-on: ubuntu-22.04 outputs: version: ${{ steps.version.outputs.version }} channel: ${{ steps.version.outputs.channel }} From 6385e6834ddcca3d2b300079bebfc7e887a1f6f3 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 12:16:39 +0100 Subject: [PATCH 05/14] Use separate job for macOS --- .github/workflows/build.yaml | 88 ++++++++++++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 23203bb..36add3d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -88,9 +88,6 @@ jobs: - name: linux-aarch64 container: docker.io/agners/aarch64-chip-build:1 runner: ARM64 - - name: macos-aarch64 - container: ghcr.io/project-chip/chip-build:1 - runner: macos-14 runs-on: ${{ matrix.arch.runner }} permissions: @@ -177,3 +174,88 @@ jobs: python3 -m twine upload out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing python3 -m twine upload out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl --skip-existing python3 -m twine upload out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing + + build_macos_python_lib: + name: Build Python wheels for macOS (${{ matrix.arch.name }}) + needs: build_prepare + + strategy: + matrix: + arch: + - name: aarch64 + runner: macos-14 + + runs-on: ${{ matrix.arch.runner }} + permissions: + contents: write # for actions/upload-release-asset to upload release asset + + defaults: + run: + working-directory: ./project-chip + + steps: + - name: Restore Matter SDK from artifacts + uses: actions/download-artifact@v3 + with: + name: matter-sdk-${{ github.run_id }} + - name: Extract Matter SDK from tar + working-directory: ./ + run: | + rm -rf project-chip + mkdir -p project-chip + cd project-chip + apt update && apt install zstd + tar -xaf ../project-chip.tar.zst --use-compress-program=zstdmt . + git config --global --add safe.directory "*" + rm -rf out/ + - name: Bootstrap + run: bash scripts/bootstrap.sh -p all,darwin + - name: Setup Build, Run Build and Run Tests + run: | + scripts/build/gn_gen.sh --args=" \ + enable_rtti=true \ + enable_pylib=true \ + chip_config_memory_debug_checks=false \ + chip_config_memory_debug_dmalloc=false \ + chip_mdns=\"minimal\" \ + chip_minmdns_default_policy=\"libnl\" \ + chip_python_version=\"${{ needs.build_prepare.outputs.version }}\" \ + chip_python_package_prefix=\"home-assistant-chip\" \ + chip_python_platform_tag=\"manylinux_2_31\" \ + chip_code_pre_generated_directory=\"$(pwd)/zzz_pregenerated\" \ + " + scripts/run_in_build_env.sh "ninja -C ./out chip-repl" + - name: Run Python library specific unit tests + run: | + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl' + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' + scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' + - name: Upload wheels as artifacts + uses: actions/upload-artifact@v3 + with: + name: chip-wheels-${{ matrix.arch.name }} + path: project-chip/out/controller/python/*.whl + - name: Upload wheels as release assets + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: project-chip/out/controller/python/*.whl + - name: Upload wheels to PyPI + if: startsWith(github.ref, 'refs/tags/') + env: + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_PYPI }} + TWINE_REPOSITORY: "pypi" + run: | + python3 -m pip install twine build + python3 -m twine upload out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl --skip-existing + - name: Upload wheels to Test PyPI + if: ${{ github.ref == 'refs/heads/main' }} + env: + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_TESTPYPI }} + TWINE_REPOSITORY: "testpypi" + run: | + python3 -m pip install twine build + python3 -m twine upload out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl --skip-existing From 5671ef2f21a6cf344e13a11a41126700d86bef21 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 12:26:12 +0100 Subject: [PATCH 06/14] Do not reuse pregenerated output on macOS This would need zstd and other tools which are not available by default. Also the main reason we did this was for our aarch64 runner, which is resource constraint. This should not be a problem on the M1. --- .github/workflows/build.yaml | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 36add3d..1f564f1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -51,7 +51,7 @@ jobs: path: ./project-chip - name: Checkout submodules working-directory: ./project-chip - run: scripts/checkout_submodules.py --shallow --platform linux --platform darwin + run: scripts/checkout_submodules.py --shallow --platform linux - name: Apply patches working-directory: ./project-chip run: | @@ -62,7 +62,7 @@ jobs: done - name: Bootstrap working-directory: ./project-chip - run: bash scripts/bootstrap.sh + run: bash scripts/bootstrap.sh -p all,linux - name: ZAP Code pre-generation working-directory: ./project-chip run: scripts/run_in_build_env.sh "scripts/codepregen.py ./zzz_pregenerated/" @@ -120,7 +120,7 @@ jobs: git config --global --add safe.directory "*" rm -rf out/ - name: Bootstrap - run: bash scripts/bootstrap.sh + run: bash scripts/bootstrap.sh -p all,linux - name: Setup Build, Run Build and Run Tests run: | scripts/build/gn_gen.sh --args=" \ @@ -194,22 +194,29 @@ jobs: working-directory: ./project-chip steps: - - name: Restore Matter SDK from artifacts - uses: actions/download-artifact@v3 + - name: Checkout CHIP SDK repository + uses: actions/checkout@v3 with: - name: matter-sdk-${{ github.run_id }} - - name: Extract Matter SDK from tar - working-directory: ./ + repository: project-chip/connectedhomeip + ref: ${{ env.matter_sdk_ref }} + path: ./project-chip + - name: Checkout submodules + working-directory: ./project-chip + run: scripts/checkout_submodules.py --shallow --platform darwin + - name: Apply patches + working-directory: ./project-chip run: | - rm -rf project-chip - mkdir -p project-chip - cd project-chip - apt update && apt install zstd - tar -xaf ../project-chip.tar.zst --use-compress-program=zstdmt . - git config --global --add safe.directory "*" - rm -rf out/ + for patch in ../*.patch + do + echo "Applying ${patch}" + patch -p1 < $patch + done - name: Bootstrap + working-directory: ./project-chip run: bash scripts/bootstrap.sh -p all,darwin + - name: ZAP Code pre-generation + working-directory: ./project-chip + run: scripts/run_in_build_env.sh "scripts/codepregen.py ./zzz_pregenerated/" - name: Setup Build, Run Build and Run Tests run: | scripts/build/gn_gen.sh --args=" \ From fcf77e0b3a5b26039e21f0fca664ea069f19a7b9 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 12:31:17 +0100 Subject: [PATCH 07/14] Adjust platform tags --- .github/workflows/build.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1f564f1..f012657 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -182,7 +182,7 @@ jobs: strategy: matrix: arch: - - name: aarch64 + - name: arm64 runner: macos-14 runs-on: ${{ matrix.arch.runner }} @@ -228,13 +228,13 @@ jobs: chip_minmdns_default_policy=\"libnl\" \ chip_python_version=\"${{ needs.build_prepare.outputs.version }}\" \ chip_python_package_prefix=\"home-assistant-chip\" \ - chip_python_platform_tag=\"manylinux_2_31\" \ + chip_python_platform_tag=\"macosx_14_0\" \ chip_code_pre_generated_directory=\"$(pwd)/zzz_pregenerated\" \ " scripts/run_in_build_env.sh "ninja -C ./out chip-repl" - name: Run Python library specific unit tests run: | - scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl' + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-macosx_14_0_${{ matrix.arch.name }}.whl' scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' @@ -256,7 +256,7 @@ jobs: TWINE_REPOSITORY: "pypi" run: | python3 -m pip install twine build - python3 -m twine upload out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl --skip-existing + python3 -m twine upload out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-macosx_14_0_${{ matrix.arch.name }}.whl --skip-existing - name: Upload wheels to Test PyPI if: ${{ github.ref == 'refs/heads/main' }} env: @@ -265,4 +265,4 @@ jobs: TWINE_REPOSITORY: "testpypi" run: | python3 -m pip install twine build - python3 -m twine upload out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-manylinux_2_31_${{ matrix.arch.name }}.whl --skip-existing + python3 -m twine upload out/controller/python/home_assistant_chip_core-${{ needs.build_prepare.outputs.version }}-cp37-abi3-macosx_14_0_${{ matrix.arch.name }}.whl --skip-existing From bbb66f7d306471b55944f283ec4d8355ccb54e96 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 12:35:26 +0100 Subject: [PATCH 08/14] Checkout this source repo on macOS --- .github/workflows/build.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f012657..3543d46 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -194,6 +194,10 @@ jobs: working-directory: ./project-chip steps: + - name: Checkout build repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Checkout CHIP SDK repository uses: actions/checkout@v3 with: From 4111e366236db4f9bbfa326c893e0589f9505540 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 13:19:11 +0100 Subject: [PATCH 09/14] Attempt without pre-gen --- .github/workflows/build.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3543d46..7f211c8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -218,9 +218,6 @@ jobs: - name: Bootstrap working-directory: ./project-chip run: bash scripts/bootstrap.sh -p all,darwin - - name: ZAP Code pre-generation - working-directory: ./project-chip - run: scripts/run_in_build_env.sh "scripts/codepregen.py ./zzz_pregenerated/" - name: Setup Build, Run Build and Run Tests run: | scripts/build/gn_gen.sh --args=" \ @@ -233,7 +230,6 @@ jobs: chip_python_version=\"${{ needs.build_prepare.outputs.version }}\" \ chip_python_package_prefix=\"home-assistant-chip\" \ chip_python_platform_tag=\"macosx_14_0\" \ - chip_code_pre_generated_directory=\"$(pwd)/zzz_pregenerated\" \ " scripts/run_in_build_env.sh "ninja -C ./out chip-repl" - name: Run Python library specific unit tests From 75e11c741ae0e3aea32b03992a72429b02a0c4e1 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 13:30:43 +0100 Subject: [PATCH 10/14] Use default address policy for minimal DNS --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7f211c8..15b0920 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -226,7 +226,7 @@ jobs: chip_config_memory_debug_checks=false \ chip_config_memory_debug_dmalloc=false \ chip_mdns=\"minimal\" \ - chip_minmdns_default_policy=\"libnl\" \ + chip_minmdns_default_policy=\"default\" \ chip_python_version=\"${{ needs.build_prepare.outputs.version }}\" \ chip_python_package_prefix=\"home-assistant-chip\" \ chip_python_platform_tag=\"macosx_14_0\" \ From 27f0480d94a0cbda6d727806b5a6ecebc1edf943 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 13:44:51 +0100 Subject: [PATCH 11/14] Bump checkout version --- .github/workflows/build.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 15b0920..de46378 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,7 +14,7 @@ jobs: channel: ${{ steps.version.outputs.channel }} steps: - name: Checkout build repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get version @@ -44,7 +44,7 @@ jobs: echo "Building version $version" echo "version=$version" >> "$GITHUB_OUTPUT" - name: Checkout CHIP SDK repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: project-chip/connectedhomeip ref: ${{ env.matter_sdk_ref }} @@ -195,11 +195,11 @@ jobs: steps: - name: Checkout build repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Checkout CHIP SDK repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: project-chip/connectedhomeip ref: ${{ env.matter_sdk_ref }} From 85659bcad15aba3ffb64ec91fb122ba442f18e83 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 13:44:59 +0100 Subject: [PATCH 12/14] Fix architecture name --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index de46378..980122f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -82,10 +82,10 @@ jobs: strategy: matrix: arch: - - name: linux-x86_64 + - name: x86_64 container: ghcr.io/project-chip/chip-build:1 runner: ubuntu-22.04 - - name: linux-aarch64 + - name: aarch64 container: docker.io/agners/aarch64-chip-build:1 runner: ARM64 From 72dfeab8a824467febc6d241525447c4398da649 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 14:32:45 +0100 Subject: [PATCH 13/14] Bump remaining actions --- .github/workflows/build.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 980122f..abf2fb7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -70,7 +70,7 @@ jobs: working-directory: ./project-chip run: tar -caf ../project-chip.tar.zst --exclude .environment --use-compress-program=zstdmt . - name: Store Matter SDK as artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: matter-sdk-${{ github.run_id }} path: ./project-chip.tar.zst @@ -106,7 +106,7 @@ jobs: steps: - name: Restore Matter SDK from artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: matter-sdk-${{ github.run_id }} - name: Extract Matter SDK from tar @@ -143,7 +143,7 @@ jobs: scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' - name: Upload wheels as artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: chip-wheels-${{ matrix.arch.name }} path: project-chip/out/controller/python/*.whl @@ -239,7 +239,7 @@ jobs: scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' - name: Upload wheels as artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: chip-wheels-${{ matrix.arch.name }} path: project-chip/out/controller/python/*.whl From 0bcdf00068c68563404fa9be7f5074f8db1fa317 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 Feb 2024 14:32:55 +0100 Subject: [PATCH 14/14] Add platform name to artifacts --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index abf2fb7..2d06d49 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -145,7 +145,7 @@ jobs: - name: Upload wheels as artifacts uses: actions/upload-artifact@v4 with: - name: chip-wheels-${{ matrix.arch.name }} + name: chip-wheels-linux-${{ matrix.arch.name }} path: project-chip/out/controller/python/*.whl - name: Upload wheels as release assets uses: softprops/action-gh-release@v1 @@ -241,7 +241,7 @@ jobs: - name: Upload wheels as artifacts uses: actions/upload-artifact@v4 with: - name: chip-wheels-${{ matrix.arch.name }} + name: chip-wheels-macosx-${{ matrix.arch.name }} path: project-chip/out/controller/python/*.whl - name: Upload wheels as release assets uses: softprops/action-gh-release@v1