gitlab-ci: use before and after script for reused chunks
It also reduces redundancy by using before_script and after_script blocks.
This commit is contained in:
parent
a3b6185942
commit
f0d9675b55
@ -5,9 +5,11 @@ cache:
|
|||||||
- .gradle/wrapper
|
- .gradle/wrapper
|
||||||
- .gradle/caches
|
- .gradle/caches
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- export GRADLE_USER_HOME=$PWD/.gradle
|
||||||
|
|
||||||
test:
|
test:
|
||||||
script:
|
script:
|
||||||
- export GRADLE_USER_HOME=$PWD/.gradle
|
|
||||||
- ./gradlew assemble -PdisablePreDex
|
- ./gradlew assemble -PdisablePreDex
|
||||||
# always report on lint errors to the build log
|
# always report on lint errors to the build log
|
||||||
- sed -i -e 's,textReport .*,textReport true,' app/build.gradle
|
- sed -i -e 's,textReport .*,textReport true,' app/build.gradle
|
||||||
@ -19,15 +21,11 @@ test:
|
|||||||
done;
|
done;
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
# this file changes every time but should not be cached
|
|
||||||
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
|
|
||||||
- rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
|
|
||||||
|
|
||||||
connected10:
|
connected10:
|
||||||
variables:
|
variables:
|
||||||
AVD_SDK: "10"
|
AVD_SDK: "10"
|
||||||
script:
|
script:
|
||||||
- export GRADLE_USER_HOME=$PWD/.gradle
|
|
||||||
- emulator64-arm -avd fcl-test-$AVD_SDK -no-skin -no-audio -no-window &
|
- emulator64-arm -avd fcl-test-$AVD_SDK -no-skin -no-audio -no-window &
|
||||||
- ./tools/wait-for-emulator
|
- ./tools/wait-for-emulator
|
||||||
- adb shell input keyevent 82 &
|
- adb shell input keyevent 82 &
|
||||||
@ -43,16 +41,12 @@ connected10:
|
|||||||
echo "read $log here:";
|
echo "read $log here:";
|
||||||
cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com;
|
cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com;
|
||||||
done
|
done
|
||||||
# this file changes every time but should not be cached
|
|
||||||
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
|
|
||||||
- exit $EXITVALUE
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
connected24:
|
connected24:
|
||||||
variables:
|
variables:
|
||||||
AVD_SDK: "24"
|
AVD_SDK: "24"
|
||||||
script:
|
script:
|
||||||
- export GRADLE_USER_HOME=$PWD/.gradle
|
|
||||||
- emulator64-x86 -avd fcl-test-$AVD_SDK -no-skin -no-audio -no-window &
|
- emulator64-x86 -avd fcl-test-$AVD_SDK -no-skin -no-audio -no-window &
|
||||||
- ./tools/wait-for-emulator
|
- ./tools/wait-for-emulator
|
||||||
- adb shell input keyevent 82 &
|
- adb shell input keyevent 82 &
|
||||||
@ -68,29 +62,27 @@ connected24:
|
|||||||
echo "read $log here:";
|
echo "read $log here:";
|
||||||
cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com;
|
cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com;
|
||||||
done
|
done
|
||||||
# this file changes every time but should not be cached
|
|
||||||
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
|
|
||||||
- rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
|
|
||||||
- exit $EXITVALUE
|
- exit $EXITVALUE
|
||||||
|
|
||||||
pmd:
|
pmd:
|
||||||
script:
|
script:
|
||||||
- export GRADLE_USER_HOME=$PWD/.gradle
|
|
||||||
- ./gradlew pmd -PdisablePreDex
|
- ./gradlew pmd -PdisablePreDex
|
||||||
# this file changes every time but should not be cached
|
|
||||||
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
|
|
||||||
- rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
|
|
||||||
|
|
||||||
checkstyle:
|
checkstyle:
|
||||||
script:
|
script:
|
||||||
- export GRADLE_USER_HOME=$PWD/.gradle
|
|
||||||
- ./gradlew checkstyle -PdisablePreDex
|
- ./gradlew checkstyle -PdisablePreDex
|
||||||
# this file changes every time but should not be cached
|
|
||||||
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
|
|
||||||
- rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
|
|
||||||
|
|
||||||
tools:
|
tools:
|
||||||
|
before_script:
|
||||||
|
- echo "ignored, no gradle needed"
|
||||||
script:
|
script:
|
||||||
- cd app
|
- cd app
|
||||||
- ./tools/langs-list-check.py
|
- ./tools/langs-list-check.py
|
||||||
- ./tools/check-string-format.py
|
- ./tools/check-string-format.py
|
||||||
|
after_script:
|
||||||
|
- echo "ignored, no gradle needed"
|
||||||
|
|
||||||
|
after_script:
|
||||||
|
# this file changes every time but should not be cached
|
||||||
|
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
|
||||||
|
- rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user