aboutsummaryrefslogtreecommitdiffstats
path: root/.cirrus/.cirrus.yml
blob: 7ec4d710d3574f2bd8926b74161ef737e739684d (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
only_if: $CIRRUS_TAG == "" && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BUILD_SOURCE == 'api' )
skip: $CIRRUS_BRANCH == "public_master" || $CIRRUS_BRANCH =~ "dogfood/.*"

env:
  CIRRUS_SHELL: bash
  CIRRUS_CLONE_DEPTH: 0
  GRADLE_USER_HOME: ${CIRRUS_WORKING_DIR}/.gradle
  FETCH_DEPTH: --depth=1

default_artifact_template: &DEFAULT_ARTIFACTS_TEMPLATE
  on_failure:
    jest_junit_cleanup_script: >
      find . -type f -wholename "**/build/test-results/test-jest/junit.xml" -exec
      xmlstarlet edit --inplace --delete '//testsuite[@errors=0 and @failures=0]' {} \;
    junit_artifacts:
      path: '**/build/test-results/**/*.xml'
      type: 'text/xml'
      format: junit
    reports_artifacts:
      path: '**/build/reports/**/*'
    screenshots_artifacts:
      path: '**/build/screenshots/**/*'
    log_artifacts:
      path: '**/build/**/*.log'

default_template: &DEFAULT_TEMPLATE
  clone_script: |
    git init
    git remote add origin https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git
    git fetch origin $CIRRUS_CHANGE_IN_REPO $FETCH_DEPTH
    git reset --hard $CIRRUS_CHANGE_IN_REPO

gradle_cache_template: &GRADLE_CACHE_TEMPLATE
  gradle_cache:
    folder: ${GRADLE_USER_HOME}/caches
    fingerprint_script: find -type f \( -name "*.gradle*" -or -name "gradle*.properties" \) | sort | xargs cat
    populate_script: mkdir -p ${GRADLE_USER_HOME}/caches

cleanup_gradle_cache_script_template: &CLEANUP_GRADLE_CACHE_SCRIPT
  cleanup_gradle_script: |
    rm -rf "${GRADLE_USER_HOME}"/caches/7.*/
    rm -rf "${GRADLE_USER_HOME}"/daemon/
    rm -rf "${GRADLE_USER_HOME}"/caches/transforms-*
    rm -rf "${GRADLE_USER_HOME}"/caches/journal-*
    /usr/bin/find "${GRADLE_USER_HOME}"/caches/ -name "*.lock" -type f -delete

jar_cache_template: &JAR_CACHE_TEMPLATE
  jar_cache:
    folder: '**/build/libs/*.jar'
    fingerprint_key: jar-cache_$CIRRUS_BUILD_ID

junit_report_cache_template: &JUNIT_REPORT_CACHE_TEMPLATE
  junit_report_cache:
    folders:
      - '**/reports/jacoco'
      - '**/test-results/test'
    fingerprint_script: echo $CIRRUS_BUILD_ID

build_cache_template: &BUILD_CACHE_TEMPLATE
  build_cache:
    folders:
      - '**/build/**/*'
    fingerprint_script: echo $CIRRUS_BUILD_ID

cache_dependencies_task:
  container:
    dockerfile: .cirrus/Dockerfile
    cpu: 2
    memory: 4Gb
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  script:
    - .cirrus/cirrus-cache-dependencies.sh
  <<: *CLEANUP_GRADLE_CACHE_SCRIPT
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

build_task:
  depends_on: cache_dependencies
  container:
    dockerfile: .cirrus/Dockerfile
    cpu: 8
    memory: 8Gb
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *BUILD_CACHE_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  script: .cirrus/cirrus-build.sh
  <<: *CLEANUP_GRADLE_CACHE_SCRIPT
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

junit_task:
  depends_on: cache_dependencies
  container:
    dockerfile: .cirrus/Dockerfile
    cpu: 8
    memory: 10Gb
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *JUNIT_REPORT_CACHE_TEMPLATE
  script:
    - .cirrus/cirrus-junit.sh
  <<: *CLEANUP_GRADLE_CACHE_SCRIPT
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

sq_analysis_task:
  depends_on:
    - build
    - junit
  container:
    dockerfile: .cirrus/Dockerfile
    cpu: 7.5
    memory: 15Gb
  env:
    SONAR_HOST_URL: https://next.sonarqube.com/sonarqube
    SONAR_TOKEN: ENCRYPTED[!b6fd814826c51e64ee61b0b6f3ae621551f6413383f7170f73580e2e141ac78c4b134b506f6288c74faa0dd564c05a29!]
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *BUILD_CACHE_TEMPLATE
  <<: *JUNIT_REPORT_CACHE_TEMPLATE
  script:
    - .cirrus/cirrus-sq-analysis.sh
  <<: *CLEANUP_GRADLE_CACHE_SCRIPT
  <<: *DEFAULT_ARTIFACTS_TEMPLATE