Skip to content
Snippets Groups Projects
config.yml 10.52 KiB
version: 2.1
orbs:
  android: circleci/android@0.2.1
  sonarcloud: sonarsource/sonarcloud@1.0.2
commands:
  install-ndk: android/install-ndk
  restore-android-build-cache: android/restore-build-cache
  save-android-build-cache: android/save-build-cache
  scan-sonar: sonarcloud/scan
  restore-gradle-cache:
    description: "Restore gradle caches"
    steps:
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "Corona-Warn-App/build.gradle" }}-{{ checksum  "Server-Protocol-Buffer/build.gradle" }}
  save-gradle-cache:
    description: "Save gradle caches"
    steps:
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "Corona-Warn-App/build.gradle" }}-{{ checksum  "Server-Protocol-Buffer/build.gradle" }}
  require-version-bump:
    description: "Require version bump for binary assembling"
    steps:
      - run:
          name: "Check if assemble required"
          command: |
            last_commit=$(git log -1 --pretty=%B)
            if [[ $last_commit != *"Version bump"* ]]; then
              circleci-agent step halt
              echo "Skipping job"
            fi
  run-gradle-cmd:
    description: "Running gradle command with environment options"
    parameters:
      desc:
        type: string
        default: "Running gradle command"
      cmd:
        type: string
    steps:
      - run:
          name: << parameters.desc >>
          command: ./gradlew << parameters.cmd >>
          environment:
            JVM_OPTS: -Xmx2048m
            GRADLE_OPTS: -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false
  run-gradle-cmd-test-splitting:
    description: "Running gradle command with environment options and test splitting"
    parameters:
      desc:
        type: string
        default: "Running gradle command"
      cmd:
        type: string
    steps:
      - run:
          name: Test splitting output
          command: circleci tests glob "**/test*/**/*.kt" | circleci tests split | xargs -n 1 echo
      - run:
          name: << parameters.desc >>
          command: ./gradlew << parameters.cmd >> -i -PtestFilter="`circleci tests glob "**/test*/**/*.kt" | circleci tests split`"
          environment:
            JVM_OPTS: -Xmx2048m
            GRADLE_OPTS: -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false

jobs:
  quick_build_device_release_no_tests:
    executor: android/android
    resource_class: large