gitlab-ci: use before and after script for reused chunks

It also reduces redundancy by using before_script and after_script blocks.
parent a3b61859
......@@ -5,9 +5,11 @@ cache:
- .gradle/wrapper
- .gradle/caches
before_script:
- export GRADLE_USER_HOME=$PWD/.gradle
test:
script:
- export GRADLE_USER_HOME=$PWD/.gradle
- ./gradlew assemble -PdisablePreDex
# always report on lint errors to the build log
- sed -i -e 's,textReport .*,textReport true,' app/build.gradle
......@@ -19,15 +21,11 @@ test:
done;
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:
variables:
AVD_SDK: "10"
script:
- export GRADLE_USER_HOME=$PWD/.gradle
- emulator64-arm -avd fcl-test-$AVD_SDK -no-skin -no-audio -no-window &
- ./tools/wait-for-emulator
- adb shell input keyevent 82 &
......@@ -43,16 +41,12 @@ connected10:
echo "read $log here:";
cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com;
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
connected24:
variables:
AVD_SDK: "24"
script:
- export GRADLE_USER_HOME=$PWD/.gradle
- emulator64-x86 -avd fcl-test-$AVD_SDK -no-skin -no-audio -no-window &
- ./tools/wait-for-emulator
- adb shell input keyevent 82 &
......@@ -68,29 +62,27 @@ connected24:
echo "read $log here:";
cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com;
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
pmd:
script:
- export GRADLE_USER_HOME=$PWD/.gradle
- ./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:
script:
- export GRADLE_USER_HOME=$PWD/.gradle
- ./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:
before_script:
- echo "ignored, no gradle needed"
script:
- cd app
- ./tools/langs-list-check.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/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment