.gitlab-ci.yml 3.17 KB
Newer Older
Varac's avatar
Varac committed
1
---
2
stages:
Varac's avatar
Varac committed
3 4
  - docker_image_sdk
  - docker_image_other
5
  - build
cyberta's avatar
cyberta committed
6
  - test
7

Varac's avatar
Varac committed
8 9 10 11 12 13 14 15 16 17 18
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
  DOCKER_DRIVER: overlay

.job_template: &build_docker_image
  image: 0xacab.org:4567/leap/docker/debian:stretch_amd64
  tags:
    - docker-in-docker
  services:
    - docker:dind
19

cyberta's avatar
cyberta committed
20
  before_script:
Varac's avatar
Varac committed
21 22 23
    - >
      export LAST_COMMIT=$(curl -s --header "PRIVATE-TOKEN: ${LEAP_CODE_O_MATIC_PRIVATE_TOKEN}" https://0xacab.org/api/v4/projects/578/pipelines |
      python -c "import sys, json; print json.load(sys.stdin)[1]['sha']")
24 25 26 27

  script:
    - docker --version
    - docker info
28 29 30
    - if ! .gitlab/build.sh ${DOCKER_IMAGE} >> dockerbuild.log 2>&1; then echo "Image build failed. Please check dockerbuild.log."; exit 1; fi;
  allow_failure: false
  artifacts:
31
    expire_in: 3d
32 33
    paths:
    - dockerbuild.log
Varac's avatar
Varac committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

docker_image:sdk:
  stage: docker_image_sdk
  variables:
    DOCKER_IMAGE: android-sdk
  <<: *build_docker_image

docker_image:ndk:
  stage: docker_image_other
  variables:
    DOCKER_IMAGE: android-ndk
  <<: *build_docker_image

docker_image:emulator:
  stage: docker_image_other
  variables:
    DOCKER_IMAGE: android-emulator
  <<: *build_docker_image
52

cyberta's avatar
cyberta committed
53
unit_test:
54
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
cyberta's avatar
cyberta committed
55 56 57 58
  stage: test
  script:
    - ./gradlew test

59 60 61 62 63 64 65 66 67 68 69 70 71
#ui_test:
#  image: "0xacab.org:4567/leap/bitmask_android/android-emulator:latest"
#  stage: test
#  script:
#    - emulator -avd testApi27 -no-audio -no-window &
#    - .gitlab/wait-for-emulator.sh
#    - adb devices
#    - adb shell settings put global window_animation_scale 0 &
#    - adb shell settings put global transition_animation_scale 0 &
#    - adb shell settings put global animator_duration_scale 0 &
#    - adb shell input keyevent 82 &
#    - ./gradlew connectedAndroidTest
#    - adb -s testApi27 emu kill
72

73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
#expanded_test:
#  image: "0xacab.org:4567/leap/bitmask_android/android-emulator:latest"
#  stage: test
#  script:
#    - emulator -avd testApi27 -no-audio -no-window &
#    - .gitlab/wait-for-emulator.sh
#    - adb devices
#    - adb shell settings put global window_animation_scale 0 &
#    - adb shell settings put global transition_animation_scale 0 &
#    - adb shell settings put global animator_duration_scale 0 &
#    - adb shell input keyevent 82 &
#    - ./gradlew connectedAndroidTest
#    - ./gradlew createProductionDebugCoverageReport
#    - adb -s testApi27 emu kill
#    - ./gradlew test
#  artifacts:
#    expire_in: 3 days
#    paths:
#      - app/build/reports/androidTests/connected/
#      - app/build/reports/coverage/production/
#      - app/build/tests/
#  when: manual
95

96
build:
97
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
98 99
  stage: build
  script:
100
    - ./cleanProject.sh
cyberta's avatar
cyberta committed
101 102
    - ./build_deps.sh
    - ./gradlew clean assembleDebug --stacktrace
103 104 105
  artifacts:
    paths:
    - app/build/outputs/
106 107 108 109 110

build_release:
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
  stage: build
  script:
111
    - ./cleanProject.sh
cyberta's avatar
cyberta committed
112 113 114
    - ./build_deps.sh
    - ./gradlew assembleProductionRelease --stacktrace
    - ./gradlew assembleProductionBeta --stacktrace
115 116 117 118
  artifacts:
    paths:
    - app/build/outputs/
  when: manual