Run drone only if source file changed

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2019-07-12 13:59:50 +02:00
parent 9fa458e55b
commit d9d9ad51ce
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
2 changed files with 12 additions and 4 deletions

View file

@ -3,8 +3,9 @@ name: generic
steps:
- name: generic
image: nextcloudci/android:android-48
image: nextcloudci/android:android-49
commands:
- scripts/checkIfRunDrone.sh || exit 0
- ./gradlew assembleGeneric
- name: notify
@ -42,7 +43,7 @@ name: gplay
steps:
- name: gplay
image: nextcloudci/android:android-48
image: nextcloudci/android:android-49
privileged: true
environment:
LOG_USERNAME:
@ -55,6 +56,7 @@ steps:
from_secret: GIT_TOKEN
ORG_GRADLE_PROJECT_coverage: ''
commands:
- scripts/checkIfRunDrone.sh || exit 0
- ./gradlew assembleGplay
- emulator -avd android-27 -no-window -no-audio &
- ./wait_for_emulator.sh
@ -103,7 +105,7 @@ name: analysis
steps:
- name: analysis
image: nextcloudci/android:android-48
image: nextcloudci/android:android-49
environment:
GIT_USERNAME:
from_secret: GIT_USERNAME
@ -114,6 +116,7 @@ steps:
LOG_PASSWORD:
from_secret: LOG_PASSWORD
commands:
- scripts/checkIfRunDrone.sh || exit 0
- export BRANCH=$(scripts/analysis/getBranchName.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST)
- scripts/analysis/analysis-wrapper.sh $GIT_USERNAME $GIT_TOKEN $BRANCH $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER $DRONE_PULL_REQUEST
@ -151,7 +154,7 @@ name: qa
steps:
- name: qa
image: nextcloudci/android:android-48
image: nextcloudci/android:android-49
privileged: true
environment:
LOG_USERNAME:
@ -167,6 +170,7 @@ steps:
KEY_PASS:
from_secret: KEY_PASS
commands:
- scripts/checkIfRunDrone.sh || exit 0
- sed -i "/qa/,/\}/ s/versionCode .*/versionCode $DRONE_BUILD_NUMBER/" build.gradle
- sed -i "/qa/,/\}/ s/versionName .*/versionName \"$DRONE_BUILD_NUMBER\"/" build.gradle
- ./gradlew assembleQaDebug

4
scripts/checkIfRunDrone.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
export BRANCH=$(scripts/analysis/getBranchName.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST)
[ $(git diff --name-only origin/$BRANCH | grep -c "^src") -eq 0 ] && echo "No source files changed" && exit 1