|
| 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 Android packages |
| 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 | + android: |
| 30 | + name: Build Android |
| 31 | + timeout-minutes: 60 |
| 32 | + |
| 33 | + runs-on: ubuntu-latest |
| 34 | + |
| 35 | + env: |
| 36 | + JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64/ |
| 37 | + |
| 38 | + container: |
| 39 | + image: connectedhomeip/chip-build-android:latest |
| 40 | + volumes: |
| 41 | + - "/tmp/log_output:/tmp/test_logs" |
| 42 | + - "/tmp/output_binaries:/tmp/output_binaries" |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout |
| 46 | + uses: actions/checkout@v2 |
| 47 | + with: |
| 48 | + ref: "${{ github.event.inputs.commit }}" |
| 49 | + submodules: true |
| 50 | + - name: Bootstrap |
| 51 | + timeout-minutes: 10 |
| 52 | + run: scripts/build/gn_bootstrap.sh |
| 53 | + - name: Build arm CHIPTool |
| 54 | + timeout-minutes: 10 |
| 55 | + env: |
| 56 | + BUILD_TYPE: android_arm |
| 57 | + TARGET_CPU: arm |
| 58 | + run: | |
| 59 | + ./scripts/examples/android_app.sh |
| 60 | + yes | "$ANDROID_HOME"/tools/bin/sdkmanager --licenses |
| 61 | + cd src/android/CHIPTool |
| 62 | + ./gradlew build |
| 63 | + cp app/build/outputs/apk/debug/app-debug.apk /tmp/output_binaries/chiptool-arm.apk |
| 64 | + - name: Build arm64 CHIPTool |
| 65 | + timeout-minutes: 10 |
| 66 | + env: |
| 67 | + BUILD_TYPE: android_arm64 |
| 68 | + TARGET_CPU: arm64 |
| 69 | + run: | |
| 70 | + ./scripts/examples/android_app.sh |
| 71 | + yes | "$ANDROID_HOME"/tools/bin/sdkmanager --licenses |
| 72 | + cd src/android/CHIPTool |
| 73 | + ./gradlew build |
| 74 | + cp app/build/outputs/apk/debug/app-debug.apk /tmp/output_binaries/chiptool-arm64.apk |
| 75 | + - name: Build x64 CHIPTool |
| 76 | + timeout-minutes: 10 |
| 77 | + env: |
| 78 | + BUILD_TYPE: android_x64 |
| 79 | + TARGET_CPU: x64 |
| 80 | + run: | |
| 81 | + ./scripts/examples/android_app.sh |
| 82 | + yes | "$ANDROID_HOME"/tools/bin/sdkmanager --licenses |
| 83 | + cd src/android/CHIPTool |
| 84 | + ./gradlew build |
| 85 | + cp app/build/outputs/apk/debug/app-debug.apk /tmp/output_binaries/chiptool-x64.apk |
| 86 | + - name: Upload artifacts |
| 87 | + uses: actions/upload-artifact@v2 |
| 88 | + with: |
| 89 | + name: chiptool |
| 90 | + path: /tmp/output_binaries/chiptool-*.apk |
| 91 | + - name: Upload release packages |
| 92 | + uses: softprops/action-gh-release@v1 |
| 93 | + if: github.event.inputs.publishRelease == 'true' |
| 94 | + with: |
| 95 | + files: /tmp/output_binaries/chiptool-*.apk |
| 96 | + fail_on_unmatched_files: true |
| 97 | + tag_name: "${{ github.event.inputs.commit }}" |
| 98 | + env: |
| 99 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments