升级NDK版本 #589
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: IOT DEVICE ANDROID DEBUG CI | |
on: | |
push: | |
paths-ignore: | |
- '**/doc*/**' | |
- '**/**/doc*/**' | |
- '**/README.md' | |
- '**/LICENSE' | |
- '*.md' | |
- '**/*.md' | |
tags-ignore: | |
- '*' | |
branches: | |
- '*' | |
pull_request: | |
branches: [ master ] | |
env: | |
IOT_SONATYPE_USERNAME: ${{ secrets.IOT_SONATYPE_USERNAME }} | |
IOT_SONATYPE_PASSWORD: ${{ secrets.IOT_SONATYPE_PASSWORD }} | |
GPG_DECRYPT_PASSPHRASE: ${{ secrets.GPG_DECRYPT_PASSPHRASE }} | |
IOT_WECOM_CID_ROBOT_KEY: ${{ secrets.IOT_WECOM_CID_ROBOT_KEY }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- run: | | |
rm -rf hub/hub-android-demo/src/main/assets/app-config.json explorer/device-android-demo/src/main/assets/app-config.json hub/hub-device-java/src/test/resources/unit_test_config.json explorer/explorer-device-java/src/test/resources/unit_test_config.json | |
gpg -d --passphrase "$GPG_DECRYPT_PASSPHRASE" --batch --quiet .github/hub-device-android/app-config.json.asc > hub/hub-android-demo/src/main/assets/app-config.json | |
gpg -d --passphrase "$GPG_DECRYPT_PASSPHRASE" --batch --quiet .github/explorer-device-android/app-config.json.asc > explorer/device-android-demo/src/main/assets/app-config.json | |
gpg -d --passphrase "$GPG_DECRYPT_PASSPHRASE" --batch --quiet .github/hub-device-java/unit_test_config.json.asc > hub/hub-device-java/src/test/resources/unit_test_config.json | |
gpg -d --passphrase "$GPG_DECRYPT_PASSPHRASE" --batch --quiet .github/explorer-device-java/unit_test_config.json.asc > explorer/explorer-device-java/src/test/resources/unit_test_config.json | |
gpg -d --passphrase "$GPG_DECRYPT_PASSPHRASE" --batch --quiet .github/explorer-device-android/device.json.asc > explorer/device-android-demo/src/main/assets/device.json | |
cp -r explorer/explorer-media-common/src/main/java/* explorer/explorer-device-rtc/src/main/java/ | |
cp -r explorer/explorer-media-common/src/main/java/* explorer/explorer-device-video/src/main/java/ | |
sed -i '/explorer-media-common/, +d' explorer/explorer-device-rtc/build.gradle | |
sed -i '/explorer-media-common/, +d' explorer/explorer-device-video/build.gradle | |
sh .github/scripts/updateValuesForTme.sh | |
env: | |
GIT_ACCESS_TOKEN: ${{ secrets.IOT_GITHUB_ACCESS_TOKEN }} | |
DECRYPT_PASSPHRASE: ${{ secrets.GPG_DECRYPT_PASSPHRASE }} | |
- name: set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/secring.gpg.asc') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: install fir | |
run: | | |
sudo gem uninstall fastlane | |
sudo gem install fir-cli | |
- name: Update SdkDemo Version | |
run: | | |
rb=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
rc=$(git rev-parse --short HEAD) | |
sed -i "s#xxx#$rb+git.$rc#g" config.gradle | |
# - name: NDK Cache | |
# id: ndk-cache | |
# uses: actions/cache@v2 | |
# with: | |
# path: ${ANDROID_HOME}/ndk/22.0.7026061 | |
# key: ndk-cache-22.0.7026061 | |
- name: Setup NDK | |
# if: steps.ndk-cache.outputs.cache-hit != 'true' | |
run: echo "y" | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;22.0.7026061" | |
- name: Update SDK Version | |
run: bash .github/scripts/updateVersionCodeForSnapshot.sh | |
# - name: Test with Gradle | |
# run: ./gradlew test | |
- name: Build with Gradle | |
run: ./gradlew build -x test -x :explorer:device-android-demo:build | |
- name: Publish aar and jar to Maven | |
run: ./gradlew publish | |
- name: Build Demo App | |
run: | | |
rm -rf explorer/explorer-device-video/src/main/java/com/tencent/iot/explorer/device/common/stateflow/* | |
rm -rf explorer/explorer-device-rtc/src/main/java/com/tencent/iot/explorer/device/common/stateflow/* | |
sed -i 's#//xxx##g' explorer/explorer-device-rtc/build.gradle | |
sed -i 's#//xxx##g' explorer/explorer-device-video/build.gradle | |
./gradlew :explorer:device-android-demo:build | |
- name: Archive the apks | |
uses: actions/upload-artifact@v2 | |
with: | |
path: | | |
'explorer/device-android-demo/build/outputs/apk/debug/*.apk' | |
'hub/hub-android-demo/build/outputs/apk/debug/*.apk' | |
- name: Upload apks to fir | |
run: | | |
expApk=$(ls explorer/device-android-demo/build/outputs/apk/debug/*.apk) | |
hubApk=$(ls hub/hub-android-demo/build/outputs/apk/debug/*.apk) | |
rc=$(git rev-parse --short HEAD) | |
rl=$(git log --pretty=format:"%s" $rc -1) | |
fir publish $expApk -T $IOT_FIRIM_API_TOKEN -c "$rl" --oversea_turbo --force_pin_history -V | |
fir publish $hubApk -T $IOT_FIRIM_API_TOKEN -c "$rl" --oversea_turbo --force_pin_history -V | |
env: | |
IOT_FIRIM_API_TOKEN: ${{ secrets.IOT_FIRIM_API_TOKEN }} | |
- name: Report success result to wecom | |
if: ${{ success() }} | |
run: | | |
echo success!!! | |
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} success | |
- name: Report fail result to wecom | |
if: ${{ failure() }} | |
run: | | |
echo fail!!! | |
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} fail |