File tree 2 files changed +41
-3
lines changed
2 files changed +41
-3
lines changed Original file line number Diff line number Diff line change 13
13
uses : actions/setup-java@v1
14
14
with :
15
15
java-version : 1.8
16
- - name : Install NDK
17
- run : echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
18
16
- name : Check Snippets
19
17
run : python scripts/checksnippets.py
20
- - name : Build with Gradle
18
+ - name : Install NDK
19
+ run : echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
20
+ - name : Build with Gradle (Pull Request)
21
+ run : ./build_pull_request.sh
22
+ if : github.event_name == 'pull_request'
23
+ - name : Build with Gradle (Push)
21
24
run : ./gradlew clean ktlint build
25
+ if : github.event_name != 'pull_request'
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Exit on error
4
+ set -e
5
+
6
+ # unshallow since GitHub actions does a shallow clone
7
+ git fetch --unshallow
8
+ git fetch origin
9
+
10
+ # Get all the modules that were changed
11
+ while read line; do
12
+ module_name=${line%%/* }
13
+ if [[ ${MODULES} != * " ${module_name} " * ]]; then
14
+ MODULES=" ${MODULES} ${module_name} "
15
+ fi
16
+ done < <( git diff --name-only origin/$GITHUB_BASE_REF )
17
+ changed_modules=$MODULES
18
+
19
+ # Get a list of all available gradle tasks
20
+ AVAILABLE_TASKS=$( ./gradlew tasks --all)
21
+
22
+ # Check if these modules have gradle tasks
23
+ build_commands=" "
24
+ for module in $changed_modules
25
+ do
26
+ if [[ $AVAILABLE_TASKS =~ $module " :app:" ]]; then
27
+ build_commands=${build_commands} " :" ${module} " :app:assembleDebug :" ${module} " :app:check"
28
+ fi
29
+ done
30
+
31
+ # Build
32
+ echo " Building Pull Request with"
33
+ echo $build_commands
34
+ eval " ./gradlew clean ktlint ${build_commands} "
You can’t perform that action at this time.
0 commit comments