Add platform name to artifacts #170
Workflow file for this run
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: CHIP wheels build | |
on: push | |
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@v4 | |
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@v4 | |
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 -p all,linux | |
- 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@v4 | |
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 | |
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 | |
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" | |
steps: | |
- name: Restore Matter SDK from artifacts | |
uses: actions/download-artifact@v4 | |
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,linux | |
- 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@v4 | |
with: | |
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 | |
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 | |
build_macos_python_lib: | |
name: Build Python wheels for macOS (${{ matrix.arch.name }}) | |
needs: build_prepare | |
strategy: | |
matrix: | |
arch: | |
- name: arm64 | |
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: Checkout build repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout CHIP SDK repository | |
uses: actions/checkout@v4 | |
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 darwin | |
- 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 -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=\"default\" \ | |
chip_python_version=\"${{ needs.build_prepare.outputs.version }}\" \ | |
chip_python_package_prefix=\"home-assistant-chip\" \ | |
chip_python_platform_tag=\"macosx_14_0\" \ | |
" | |
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-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)' | |
- name: Upload wheels as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
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 | |
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-macosx_14_0_${{ 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-macosx_14_0_${{ matrix.arch.name }}.whl --skip-existing |