|
| 1 | +# Copyright (c) 2021 Project CHIP Authors |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Release CHIP Tools |
| 16 | + |
| 17 | +on: |
| 18 | + workflow_dispatch: |
| 19 | + inputs: |
| 20 | + commit: |
| 21 | + description: "Release tag name or commit SHA:" |
| 22 | + required: true |
| 23 | + publishRelease: |
| 24 | + description: "Publish release packages (if true, 'commit' must contain a release tag name):" |
| 25 | + required: true |
| 26 | + default: "false" |
| 27 | + |
| 28 | +jobs: |
| 29 | + tools: |
| 30 | + name: Build CHIP Tools |
| 31 | + timeout-minutes: 60 |
| 32 | + |
| 33 | + runs-on: ubuntu-latest |
| 34 | + |
| 35 | + env: |
| 36 | + DEBIAN_FRONTEND: noninteractive |
| 37 | + JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64/ |
| 38 | + |
| 39 | + container: |
| 40 | + image: connectedhomeip/chip-build-android:0.5.91 |
| 41 | + volumes: |
| 42 | + - "/tmp/log_output:/tmp/test_logs" |
| 43 | + - "/tmp/output_binaries:/tmp/output_binaries" |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Checkout |
| 47 | + uses: actions/checkout@v2 |
| 48 | + with: |
| 49 | + ref: "${{ github.event.inputs.commit }}" |
| 50 | + - name: Checkout submodules |
| 51 | + run: scripts/checkout_submodules.py --shallow --platform android linux |
| 52 | + - name: Bootstrap |
| 53 | + timeout-minutes: 10 |
| 54 | + run: scripts/build/gn_bootstrap.sh |
| 55 | + - name: Install CHIP Tool dependencies |
| 56 | + timeout-minutes: 10 |
| 57 | + run: | |
| 58 | + echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -sc) main restricted" > /etc/apt/sources.list.d/arm64.list |
| 59 | + echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -sc)-updates main restricted" >> /etc/apt/sources.list.d/arm64.list |
| 60 | + apt update |
| 61 | + apt install -y --no-install-recommends -o APT::Immediate-Configure=false g++-aarch64-linux-gnu libgirepository1.0-dev |
| 62 | + dpkg --add-architecture arm64 |
| 63 | + apt install -y --no-install-recommends -o APT::Immediate-Configure=false libavahi-client-dev:arm64 libglib2.0-dev:arm64 libssl-dev:arm64 libreadline-dev:arm64 |
| 64 | + - name: Build x64 CHIP Tool with debug logs enabled |
| 65 | + timeout-minutes: 10 |
| 66 | + run: | |
| 67 | + scripts/run_in_build_env.sh "gn gen out/chiptool_x64_debug --args='chip_mdns=\"platform\" symbol_level=0'" |
| 68 | + scripts/run_in_build_env.sh "ninja -C out/chiptool_x64_debug chip-tool" |
| 69 | + mv out/chiptool_x64_debug/chip-tool out/chiptool_x64_debug/chip-tool-debug |
| 70 | + - name: Build x64 CHIP Tool with debug logs disabled |
| 71 | + timeout-minutes: 10 |
| 72 | + run: | |
| 73 | + scripts/run_in_build_env.sh "gn gen out/chiptool_x64_release --args='chip_mdns=\"platform\" chip_detail_logging=false symbol_level=0'" |
| 74 | + scripts/run_in_build_env.sh "ninja -C out/chiptool_x64_release chip-tool" |
| 75 | + mv out/chiptool_x64_release/chip-tool out/chiptool_x64_release/chip-tool-release |
| 76 | + - name: Build arm64 CHIP Tool with debug logs enabled |
| 77 | + timeout-minutes: 10 |
| 78 | + run: | |
| 79 | + scripts/run_in_build_env.sh "gn gen out/chiptool_arm64_debug --args='chip_mdns=\"platform\" |
| 80 | + custom_toolchain=\"//build/toolchain/custom\" |
| 81 | + target_cc=\"aarch64-linux-gnu-gcc\" |
| 82 | + target_cxx=\"aarch64-linux-gnu-g++\" |
| 83 | + target_ar=\"aarch64-linux-gnu-ar\" |
| 84 | + target_cpu=\"arm64\" |
| 85 | + symbol_level=0'" |
| 86 | + scripts/run_in_build_env.sh "ninja -C out/chiptool_arm64_debug chip-tool" |
| 87 | + mv out/chiptool_arm64_debug/chip-tool out/chiptool_arm64_debug/chip-tool-debug |
| 88 | + - name: Build arm64 CHIP Tool with debug logs disabled |
| 89 | + timeout-minutes: 10 |
| 90 | + run: | |
| 91 | + scripts/run_in_build_env.sh "gn gen out/chiptool_arm64_release --args='chip_mdns=\"platform\" |
| 92 | + chip_detail_logging=false |
| 93 | + custom_toolchain=\"//build/toolchain/custom\" |
| 94 | + target_cc=\"aarch64-linux-gnu-gcc\" |
| 95 | + target_cxx=\"aarch64-linux-gnu-g++\" |
| 96 | + target_ar=\"aarch64-linux-gnu-ar\" |
| 97 | + target_cpu=\"arm64\" |
| 98 | + symbol_level=0'" |
| 99 | + scripts/run_in_build_env.sh "ninja -C out/chiptool_arm64_release chip-tool" |
| 100 | + mv out/chiptool_arm64_release/chip-tool out/chiptool_arm64_release/chip-tool-release |
| 101 | + - name: Build x64 OTA Provider |
| 102 | + timeout-minutes: 10 |
| 103 | + run: | |
| 104 | + scripts/run_in_build_env.sh "gn gen out/chipotaprovider_x64 --args='symbol_level=0' --root=examples/ota-provider-app/linux" |
| 105 | + scripts/run_in_build_env.sh "ninja -C out/chipotaprovider_x64 chip-ota-provider-app" |
| 106 | + mv out/chipotaprovider_x64/chip-ota-provider-app /tmp/output_binaries/chip-ota-provider-app-linux_x64 |
| 107 | + - name: Create zip files for CHIP Tool debug and release packages |
| 108 | + timeout-minutes: 10 |
| 109 | + run: | |
| 110 | + python3 -m zipfile -c /tmp/output_binaries/chip-tool-linux_x64.zip out/chiptool_x64_debug/chip-tool-debug out/chiptool_x64_release/chip-tool-release |
| 111 | + python3 -m zipfile -c /tmp/output_binaries/chip-tool-linux_aarch64.zip out/chiptool_arm64_debug/chip-tool-debug out/chiptool_arm64_release/chip-tool-release |
| 112 | + - name: Build arm Android CHIPTool |
| 113 | + timeout-minutes: 30 |
| 114 | + env: |
| 115 | + TARGET_CPU: arm |
| 116 | + run: | |
| 117 | + scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target android-arm-chip-tool build" |
| 118 | + cp out/android-arm-chip-tool/outputs/apk/debug/app-debug.apk /tmp/output_binaries/chip-tool-android_armv7l.apk |
| 119 | + - name: Build arm64 Android CHIPTool |
| 120 | + timeout-minutes: 30 |
| 121 | + env: |
| 122 | + TARGET_CPU: arm64 |
| 123 | + run: | |
| 124 | + git clean -fdx src/android/CHIPTool |
| 125 | + scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target android-arm64-chip-tool build" |
| 126 | + cp out/android-arm64-chip-tool/outputs/apk/debug/app-debug.apk /tmp/output_binaries/chip-tool-android_aarch64.apk |
| 127 | + - name: Upload artifacts |
| 128 | + uses: actions/upload-artifact@v2 |
| 129 | + with: |
| 130 | + name: chip |
| 131 | + path: /tmp/output_binaries/* |
| 132 | + - name: Upload release packages |
| 133 | + uses: softprops/action-gh-release@v1 |
| 134 | + if: github.event.inputs.publishRelease == 'true' |
| 135 | + with: |
| 136 | + files: /tmp/output_binaries/* |
| 137 | + fail_on_unmatched_files: true |
| 138 | + tag_name: "${{ github.event.inputs.commit }}" |
| 139 | + env: |
| 140 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments