summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: de2572bfd674de48f0151b0615f5f3510857785c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
stages:
  - docker_image_sdk
  - docker_image_other
  - build
  - test

# 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

  before_script:
    - >
      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']")

  script:
    - docker --version
    - docker info
    - 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:
    when: on_failure
    expire_in: 31d
    paths:
    - dockerbuild.log

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

unit_test:
  stage: test
  script:
    - ./gradlew test

build:
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
  stage: build
  script:
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - ./gradlew clean assembleDebug
  artifacts:
    paths:
    - app/build/outputs/

build_release:
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
  stage: build
  script:
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - ./gradlew clean
    - ./gradlew assembleProductionRelease
    - ./gradlew assembleProductionBeta
  artifacts:
    paths:
    - app/build/outputs/
  when: manual