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