-
Notifications
You must be signed in to change notification settings - Fork 39
123 lines (119 loc) · 5.69 KB
/
debug.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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 clean
./gradlew :explorer:device-android-demo:build :hub:hub-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