|
6 | 6 | matter_sdk_ref: v1.2.0.1
|
7 | 7 |
|
8 | 8 | jobs:
|
9 |
| - build_prepare: |
10 |
| - name: Prepare build |
11 |
| - runs-on: ubuntu-22.04 |
12 |
| - outputs: |
13 |
| - version: ${{ steps.version.outputs.version }} |
14 |
| - channel: ${{ steps.version.outputs.channel }} |
15 |
| - steps: |
16 |
| - - name: Checkout build repository |
17 |
| - uses: actions/checkout@v3 |
18 |
| - with: |
19 |
| - fetch-depth: 0 |
20 |
| - - name: Get version |
21 |
| - id: version |
22 |
| - shell: bash |
23 |
| - run: | |
24 |
| - version=$(echo "${{ github.ref }}" | awk -F"/" '{print $NF}') |
25 |
| - if [[ ! -z "${{ github.event.inputs.version }}" ]]; then |
26 |
| - version="${{ github.event.inputs.version }}" |
27 |
| - elif [[ "${version}" =~ (main|dev) ]]; then |
28 |
| - today="$(date --utc '+%Y-%m-%d')" |
29 |
| - midnight_timestamp="$(date --utc +%s --date=$today)" |
30 |
| - calver_date="$(date --utc --date=$today '+%Y.%-m.dev%-d')" |
31 |
| - commit_count="$(git rev-list --count --since=$midnight_timestamp HEAD)" |
32 |
| - commit_count="$(printf "%02d" ${commit_count})" |
33 |
| - version="${calver_date}${commit_count}" |
34 |
| - elif [[ "${{ github.ref }}" =~ ^refs/heads/ ]]; then |
35 |
| - today="$(date --utc '+%Y-%m-%d')" |
36 |
| - midnight_timestamp="$(date --utc +%s --date=$today)" |
37 |
| - calver_date="$(date --utc --date=$today '+%Y.%-m.dev%-d')" |
38 |
| - # Remove invalid chars |
39 |
| - localversion="${version}" |
40 |
| - localversion="${localversion//-/}" |
41 |
| - localversion="${localversion//_/}" |
42 |
| - version="${calver_date}+${localversion}" |
43 |
| - fi |
44 |
| - echo "Building version $version" |
45 |
| - echo "version=$version" >> "$GITHUB_OUTPUT" |
46 |
| - - name: Checkout CHIP SDK repository |
47 |
| - uses: actions/checkout@v3 |
48 |
| - with: |
49 |
| - repository: project-chip/connectedhomeip |
50 |
| - ref: ${{ env.matter_sdk_ref }} |
51 |
| - path: ./project-chip |
52 |
| - - name: Checkout submodules |
53 |
| - working-directory: ./project-chip |
54 |
| - run: scripts/checkout_submodules.py --shallow --platform linux |
55 |
| - - name: Apply patches |
56 |
| - working-directory: ./project-chip |
57 |
| - run: | |
58 |
| - for patch in ../*.patch |
59 |
| - do |
60 |
| - echo "Applying ${patch}" |
61 |
| - patch -p1 < $patch |
62 |
| - done |
63 |
| - - name: Bootstrap |
64 |
| - working-directory: ./project-chip |
65 |
| - run: bash scripts/bootstrap.sh |
66 |
| - - name: ZAP Code pre-generation |
67 |
| - working-directory: ./project-chip |
68 |
| - run: scripts/run_in_build_env.sh "scripts/codepregen.py ./zzz_pregenerated/" |
69 |
| - - name: Create Matter SDK tar |
70 |
| - working-directory: ./project-chip |
71 |
| - run: tar -caf ../project-chip.tar.zst --exclude .environment --use-compress-program=zstdmt . |
72 |
| - - name: Store Matter SDK as artifact |
73 |
| - uses: actions/upload-artifact@v3 |
74 |
| - with: |
75 |
| - name: matter-sdk-${{ github.run_id }} |
76 |
| - path: ./project-chip.tar.zst |
| 9 | + build_prepare: |
| 10 | + name: Prepare build |
| 11 | + runs-on: ubuntu-22.04 |
| 12 | + outputs: |
| 13 | + version: ${{ steps.version.outputs.version }} |
| 14 | + channel: ${{ steps.version.outputs.channel }} |
| 15 | + steps: |
| 16 | + - name: Checkout build repository |
| 17 | + uses: actions/checkout@v3 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + - name: Get version |
| 21 | + id: version |
| 22 | + shell: bash |
| 23 | + run: | |
| 24 | + version=$(echo "${{ github.ref }}" | awk -F"/" '{print $NF}') |
| 25 | + if [[ ! -z "${{ github.event.inputs.version }}" ]]; then |
| 26 | + version="${{ github.event.inputs.version }}" |
| 27 | + elif [[ "${version}" =~ (main|dev) ]]; then |
| 28 | + today="$(date --utc '+%Y-%m-%d')" |
| 29 | + midnight_timestamp="$(date --utc +%s --date=$today)" |
| 30 | + calver_date="$(date --utc --date=$today '+%Y.%-m.dev%-d')" |
| 31 | + commit_count="$(git rev-list --count --since=$midnight_timestamp HEAD)" |
| 32 | + commit_count="$(printf "%02d" ${commit_count})" |
| 33 | + version="${calver_date}${commit_count}" |
| 34 | + elif [[ "${{ github.ref }}" =~ ^refs/heads/ ]]; then |
| 35 | + today="$(date --utc '+%Y-%m-%d')" |
| 36 | + midnight_timestamp="$(date --utc +%s --date=$today)" |
| 37 | + calver_date="$(date --utc --date=$today '+%Y.%-m.dev%-d')" |
| 38 | + # Remove invalid chars |
| 39 | + localversion="${version}" |
| 40 | + localversion="${localversion//-/}" |
| 41 | + localversion="${localversion//_/}" |
| 42 | + version="${calver_date}+${localversion}" |
| 43 | + fi |
| 44 | + echo "Building version $version" |
| 45 | + echo "version=$version" >> "$GITHUB_OUTPUT" |
| 46 | + - name: Checkout CHIP SDK repository |
| 47 | + uses: actions/checkout@v3 |
| 48 | + with: |
| 49 | + repository: project-chip/connectedhomeip |
| 50 | + ref: ${{ env.matter_sdk_ref }} |
| 51 | + path: ./project-chip |
| 52 | + - name: Checkout submodules |
| 53 | + working-directory: ./project-chip |
| 54 | + run: scripts/checkout_submodules.py --shallow --platform linux |
| 55 | + - name: Apply patches |
| 56 | + working-directory: ./project-chip |
| 57 | + run: | |
| 58 | + for patch in ../*.patch |
| 59 | + do |
| 60 | + echo "Applying ${patch}" |
| 61 | + patch -p1 < $patch |
| 62 | + done |
| 63 | + - name: Bootstrap |
| 64 | + working-directory: ./project-chip |
| 65 | + run: bash scripts/bootstrap.sh |
| 66 | + - name: ZAP Code pre-generation |
| 67 | + working-directory: ./project-chip |
| 68 | + run: scripts/run_in_build_env.sh "scripts/codepregen.py ./zzz_pregenerated/" |
| 69 | + - name: Create Matter SDK tar |
| 70 | + working-directory: ./project-chip |
| 71 | + run: tar -caf ../project-chip.tar.zst --exclude .environment --use-compress-program=zstdmt . |
| 72 | + - name: Store Matter SDK as artifact |
| 73 | + uses: actions/upload-artifact@v3 |
| 74 | + with: |
| 75 | + name: matter-sdk-${{ github.run_id }} |
| 76 | + path: ./project-chip.tar.zst |
77 | 77 |
|
78 |
| - build_linux_python_lib: |
79 |
| - name: Build Python wheels for Linux (${{ matrix.arch.name }}) |
80 |
| - needs: build_prepare |
| 78 | + build_linux_python_lib: |
| 79 | + name: Build Python wheels for Linux (${{ matrix.arch.name }}) |
| 80 | + needs: build_prepare |
81 | 81 |
|
82 |
| - strategy: |
83 |
| - matrix: |
84 |
| - arch: |
85 |
| - - name: x86_64 |
86 |
| - container: ghcr.io/project-chip/chip-build:1 |
87 |
| - runner: ubuntu-22.04 |
88 |
| - - name: aarch64 |
89 |
| - container: docker.io/agners/aarch64-chip-build:1 |
90 |
| - runner: ARM64 |
| 82 | + strategy: |
| 83 | + matrix: |
| 84 | + arch: |
| 85 | + - name: x86_64 |
| 86 | + container: ghcr.io/project-chip/chip-build:1 |
| 87 | + runner: ubuntu-22.04 |
| 88 | + - name: aarch64 |
| 89 | + container: docker.io/agners/aarch64-chip-build:1 |
| 90 | + runner: ARM64 |
91 | 91 |
|
92 |
| - runs-on: ${{ matrix.arch.runner }} |
93 |
| - permissions: |
94 |
| - contents: write # for actions/upload-release-asset to upload release asset |
| 92 | + runs-on: ${{ matrix.arch.runner }} |
| 93 | + permissions: |
| 94 | + contents: write # for actions/upload-release-asset to upload release asset |
95 | 95 |
|
96 |
| - defaults: |
97 |
| - run: |
98 |
| - working-directory: ./project-chip |
| 96 | + defaults: |
| 97 | + run: |
| 98 | + working-directory: ./project-chip |
99 | 99 |
|
100 |
| - container: |
101 |
| - image: ${{ matrix.arch.container }} |
102 |
| - volumes: |
103 |
| - - "/tmp/log_output:/tmp/test_logs" |
104 |
| - options: --sysctl "net.ipv6.conf.all.disable_ipv6=0 |
105 |
| - net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" |
| 100 | + container: |
| 101 | + image: ${{ matrix.arch.container }} |
| 102 | + volumes: |
| 103 | + - "/tmp/log_output:/tmp/test_logs" |
| 104 | + options: --sysctl "net.ipv6.conf.all.disable_ipv6=0 |
| 105 | + net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" |
106 | 106 |
|
107 |
| - steps: |
108 |
| - - name: Restore Matter SDK from artifacts |
109 |
| - uses: actions/download-artifact@v3 |
110 |
| - with: |
111 |
| - name: matter-sdk-${{ github.run_id }} |
112 |
| - - name: Extract Matter SDK from tar |
113 |
| - working-directory: ./ |
114 |
| - run: | |
115 |
| - rm -rf project-chip |
116 |
| - mkdir -p project-chip |
117 |
| - cd project-chip |
118 |
| - apt update && apt install zstd |
119 |
| - tar -xaf ../project-chip.tar.zst --use-compress-program=zstdmt . |
120 |
| - git config --global --add safe.directory "*" |
121 |
| - rm -rf out/ |
122 |
| - - name: Bootstrap |
123 |
| - run: bash scripts/bootstrap.sh |
124 |
| - - name: Setup Build, Run Build and Run Tests |
125 |
| - run: | |
126 |
| - scripts/build/gn_gen.sh --args=" \ |
127 |
| - enable_rtti=true \ |
128 |
| - enable_pylib=true \ |
129 |
| - chip_config_memory_debug_checks=false \ |
130 |
| - chip_config_memory_debug_dmalloc=false \ |
131 |
| - chip_mdns=\"minimal\" \ |
132 |
| - chip_minmdns_default_policy=\"libnl\" \ |
133 |
| - chip_python_version=\"${{ needs.build_prepare.outputs.version }}\" \ |
134 |
| - chip_python_package_prefix=\"home-assistant-chip\" \ |
135 |
| - chip_python_platform_tag=\"manylinux_2_31\" \ |
136 |
| - chip_code_pre_generated_directory=\"$(pwd)/zzz_pregenerated\" \ |
137 |
| - " |
138 |
| - scripts/run_in_build_env.sh "ninja -C ./out chip-repl" |
139 |
| - - name: Run Python library specific unit tests |
140 |
| - run: | |
141 |
| - 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' |
142 |
| - scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' |
143 |
| - scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' |
144 |
| - scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' |
145 |
| - - name: Upload wheels as artifacts |
146 |
| - uses: actions/upload-artifact@v3 |
147 |
| - with: |
148 |
| - name: chip-wheels-${{ matrix.arch.name }} |
149 |
| - path: project-chip/out/controller/python/*.whl |
150 |
| - - name: Upload wheels as release assets |
151 |
| - uses: softprops/action-gh-release@v1 |
152 |
| - if: startsWith(github.ref, 'refs/tags/') |
153 |
| - with: |
154 |
| - files: project-chip/out/controller/python/*.whl |
155 |
| - - name: Upload wheels to PyPI |
156 |
| - if: startsWith(github.ref, 'refs/tags/') |
157 |
| - env: |
158 |
| - TWINE_USERNAME: "__token__" |
159 |
| - TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_PYPI }} |
160 |
| - TWINE_REPOSITORY: "pypi" |
161 |
| - run: | |
162 |
| - python3 -m pip install twine build |
163 |
| - python3 -m twine upload out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing |
164 |
| - 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 |
165 |
| - python3 -m twine upload out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing |
166 |
| - - name: Upload wheels to Test PyPI |
167 |
| - if: ${{ github.ref == 'refs/heads/main' }} |
168 |
| - env: |
169 |
| - TWINE_USERNAME: "__token__" |
170 |
| - TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_TESTPYPI }} |
171 |
| - TWINE_REPOSITORY: "testpypi" |
172 |
| - run: | |
173 |
| - python3 -m pip install twine build |
174 |
| - python3 -m twine upload out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing |
175 |
| - 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 |
176 |
| - python3 -m twine upload out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing |
| 107 | + steps: |
| 108 | + - name: Restore Matter SDK from artifacts |
| 109 | + uses: actions/download-artifact@v3 |
| 110 | + with: |
| 111 | + name: matter-sdk-${{ github.run_id }} |
| 112 | + - name: Extract Matter SDK from tar |
| 113 | + working-directory: ./ |
| 114 | + run: | |
| 115 | + rm -rf project-chip |
| 116 | + mkdir -p project-chip |
| 117 | + cd project-chip |
| 118 | + apt update && apt install zstd |
| 119 | + tar -xaf ../project-chip.tar.zst --use-compress-program=zstdmt . |
| 120 | + git config --global --add safe.directory "*" |
| 121 | + rm -rf out/ |
| 122 | + - name: Bootstrap |
| 123 | + run: bash scripts/bootstrap.sh |
| 124 | + - name: Setup Build, Run Build and Run Tests |
| 125 | + run: | |
| 126 | + scripts/build/gn_gen.sh --args=" \ |
| 127 | + enable_rtti=true \ |
| 128 | + enable_pylib=true \ |
| 129 | + chip_config_memory_debug_checks=false \ |
| 130 | + chip_config_memory_debug_dmalloc=false \ |
| 131 | + chip_mdns=\"minimal\" \ |
| 132 | + chip_minmdns_default_policy=\"libnl\" \ |
| 133 | + chip_python_version=\"${{ needs.build_prepare.outputs.version }}\" \ |
| 134 | + chip_python_package_prefix=\"home-assistant-chip\" \ |
| 135 | + chip_python_platform_tag=\"manylinux_2_31\" \ |
| 136 | + chip_code_pre_generated_directory=\"$(pwd)/zzz_pregenerated\" \ |
| 137 | + " |
| 138 | + scripts/run_in_build_env.sh "ninja -C ./out chip-repl" |
| 139 | + - name: Run Python library specific unit tests |
| 140 | + run: | |
| 141 | + 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' |
| 142 | + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' |
| 143 | + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl' |
| 144 | + scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' |
| 145 | + - name: Upload wheels as artifacts |
| 146 | + uses: actions/upload-artifact@v3 |
| 147 | + with: |
| 148 | + name: chip-wheels-${{ matrix.arch.name }} |
| 149 | + path: project-chip/out/controller/python/*.whl |
| 150 | + - name: Upload wheels as release assets |
| 151 | + uses: softprops/action-gh-release@v1 |
| 152 | + if: startsWith(github.ref, 'refs/tags/') |
| 153 | + with: |
| 154 | + files: project-chip/out/controller/python/*.whl |
| 155 | + - name: Upload wheels to PyPI |
| 156 | + if: startsWith(github.ref, 'refs/tags/') |
| 157 | + env: |
| 158 | + TWINE_USERNAME: "__token__" |
| 159 | + TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_PYPI }} |
| 160 | + TWINE_REPOSITORY: "pypi" |
| 161 | + run: | |
| 162 | + python3 -m pip install twine build |
| 163 | + python3 -m twine upload out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing |
| 164 | + 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 |
| 165 | + python3 -m twine upload out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing |
| 166 | + - name: Upload wheels to Test PyPI |
| 167 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 168 | + env: |
| 169 | + TWINE_USERNAME: "__token__" |
| 170 | + TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_TESTPYPI }} |
| 171 | + TWINE_REPOSITORY: "testpypi" |
| 172 | + run: | |
| 173 | + python3 -m pip install twine build |
| 174 | + python3 -m twine upload out/controller/python/home_assistant_chip_clusters-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing |
| 175 | + 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 |
| 176 | + python3 -m twine upload out/controller/python/home_assistant_chip_repl-${{ needs.build_prepare.outputs.version }}-py3-none-any.whl --skip-existing |
0 commit comments