gitlab-ci: new job to build using Debian packages
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a1c922a..465e69d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,6 +13,49 @@
   - echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" > /dev/null
   - apt-get update && apt-get -y install gnupg
 
+build_on_debian:
+  image: debian:stretch
+  only:
+    - branches
+  variables:
+    ANDROID_HOME: /usr/lib/android-sdk
+  before_script:
+    - echo 'skipping sdkmanager, deps come from apt-get'
+  script:
+    - printf 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";\n'
+        > /etc/apt/apt.conf.d/99no-install-recommends
+    - printf 'APT::Acquire::Retries "20";\n'
+        > /etc/apt/apt.conf.d/99acquire-retries
+    - printf 'APT::Get::Assume-Yes "true";\n'
+        > /etc/apt/apt.conf.d/99assumeyes
+    - apt-get update
+    - apt-get upgrade
+    - apt-get install git wget
+    - apt-get install --install-recommends
+          android-sdk
+          android-sdk-platform-23
+          gradle-debian-helper
+          libgradle-android-plugin-java
+    - wget --no-verbose http://dl.google.com/android/repository/platform-25_r03.zip
+    - unzip -q platform-25_r03.zip
+    - mv android-7.1.1 $ANDROID_HOME/platforms/platform-25
+    - mkdir -p $ANDROID_HOME/licenses/
+    - printf '\n8933bad161af4178b1185d1a37fbf41ea5269c55\n\nd56f5187479451eabf01fb78af6dfcb131a6481e\n'
+       > $ANDROID_HOME/licenses/android-sdk-license
+    - sed -i
+          -e "s,jcenter(),maven { url 'file:///usr/share/maven-repo' },"
+          build.gradle app/build.gradle
+    - mkdir ~/.android
+    - gradle assembleDebug
+  artifacts:
+    name: "${CI_PROJECT_PATH}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_${CI_JOB_NAME}"
+    paths:
+      - app/build/outputs/apk/*-debug.apk
+    expire_in: 1 week
+    when: on_success
+  after_script:
+    - echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs"
+
 test:
   only:
     - branches
@@ -35,7 +78,7 @@
     - sed -i 's,versionCode="[^"]*",versionCode="2070",' app/src/main/AndroidManifest.xml
     - ./create_ota.sh release binaries
   artifacts:
-    name: "${CI_PROJECT_PATH}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
+    name: "${CI_PROJECT_PATH}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_${CI_JOB_NAME}"
     paths:
       - app/build/distributions/*-debug.zip
     expire_in: 2 months