.gitlab-ci.yml 3.09 KB
Newer Older
1
image: registry.gitlab.com/fdroid/ci-images-client:latest
Daniel Martí's avatar
Daniel Martí committed
2

3 4 5 6 7
cache:
  paths:
    - .gradle/wrapper
    - .gradle/caches

8 9 10 11
stages:
  - test
  - deploy

12 13
before_script:
  - export GRADLE_USER_HOME=$PWD/.gradle
14 15
  - export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle`
  - echo y | android --silent update sdk --no-ui --filter android-${ANDROID_COMPILE_SDK}
16

Daniel Martí's avatar
Daniel Martí committed
17
test:
18
  stage: test
19
  script:
20
    - export EXITVALUE=0
21
    - ./tools/check-format-strings.py
22
    - ./tools/remove-unused-and-blank-translations.py
23 24
    - echo "These are unused or blank translations that should be removed:"
    - git --no-pager diff --exit-code || export EXITVALUE=1
25
    - ./gradlew assemble -PdisablePreDex
26
    # always report on lint errors to the build log
27
    - sed -i -e 's,textReport .*,textReport true,' app/build.gradle
28
    - ./gradlew lint -PdisablePreDex
29 30
    - ./gradlew pmd -PdisablePreDex
    - ./gradlew checkstyle -PdisablePreDex
31
    - ./gradlew test -PdisablePreDex || {
32
          for log in app/build/reports/*ests/*/*ml; do
33
              echo "read $log here:";
34
              (cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com) || true;
35
          done;
36
          export EXITVALUE=1;
37
      }
38
    - exit $EXITVALUE
39

40
connected10:
41
  stage: test
42 43 44
  variables:
    AVD_SDK: "10"
  script:
45
    - ./gradlew assembleDebug -PdisablePreDex
46 47 48 49 50 51 52
    - emulator64-arm -avd fcl-test-$AVD_SDK -no-skin -no-audio -no-window &
    - ./tools/wait-for-emulator
    - adb shell input keyevent 82 &
    - export EXITVALUE=0
    - ./gradlew connectedCheck -PdisablePreDex || {
        adb -e logcat -d '*:E';
        echo "get the full logcat here:";
53
        (adb -e logcat -d | curl --silent -F 'clbin=<-' https://clbin.com) || true;
54 55 56 57 58
        export EXITVALUE=1;
      }
    - for log in app/build/reports/*ests/*/*ml
                 app/build/outputs/*results*/connected/*.xml; do
        echo "read $log here:";
59
        (cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com) || true;
60 61
      done

62
connected24:
63
  stage: test
64
  variables:
65
    AVD_SDK: "24"
66
  script:
67
    - ./gradlew assembleDebug -PdisablePreDex
68
    - android list avd
69
    - emulator64-arm -avd fcl-test-$AVD_SDK -no-audio -no-window &
70
    - ./tools/wait-for-emulator
71
    - adb shell input keyevent 82 &
72
    - adb devices
73
    - export EXITVALUE=0
74
    - ./gradlew connectedCheck -PdisablePreDex || {
75 76
        adb -e logcat -d '*:E';
        echo "get the full logcat here:";
77
        (adb -e logcat -d | curl --silent -F 'clbin=<-' https://clbin.com) || true;
78 79 80 81 82
        export EXITVALUE=1;
      }
    - for log in app/build/reports/*ests/*/*ml
                 app/build/outputs/*results*/connected/*.xml; do
        echo "read $log here:";
83
        (cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com) || true;
84 85
      done
    - exit $EXITVALUE
86

87 88 89 90 91 92 93
deploy_nightly:
  stage: deploy
  only:
    - master
  script:
    - "[ -z \"$DEBUG_KEYSTORE\" ] || ./config/nightly-repo/deploy"

94 95 96 97
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/