aboutsummaryrefslogtreecommitdiffstats
path: root/.cirrus/.cirrus.yml
blob: 919d14deeb8991d03e36a03e5ba101d28cec32ce (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
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

yarn_cache_template: &YARN_CACHE_TEMPLATE
  yarn_cache:
    folder: '~/.yarn/berry/cache'
    fingerprint_script: cat server/sonar-web/yarn.lock

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

eslint_report_cache_template: &ESLINT_REPORT_CACHE_TEMPLATE
  eslint_report_cache:
    folders:
      - server/sonar-web/eslint-report/
    fingerprint_script: echo $CIRRUS_BUILD_ID

jest_report_cache_template: &JEST_REPORT_CACHE_TEMPLATE
  jest_report_cache:
    folders:
      - server/sonar-web/coverage/
    fingerprint_script: echo $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
  <<: *YARN_CACHE_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  script: .cirrus/cirrus-build.sh
  <<: *CLEANUP_GRADLE_CACHE_SCRIPT
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

yarn_lint_task:
  depends_on: cache_dependencies
  container:
    dockerfile: .cirrus/Dockerfile
    cpu: 3
    memory: 10Gb
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  <<: *ESLINT_REPORT_CACHE_TEMPLATE
  script:
    - .cirrus/cirrus-yarn-lint-report.sh
  <<: *CLEANUP_GRADLE_CACHE_SCRIPT
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

yarn_check_task:
  depends_on: cache_dependencies
  container:
    dockerfile: .cirrus/Dockerfile
    cpu: 3
    memory: 10Gb
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  script: |
    source .cirrus/cirrus-env
    ./gradlew yarn_check-ci
  <<: *CLEANUP_GRADLE_CACHE_SCRIPT
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

yarn_validate_task:
  depends_on: cache_dependencies
  container:
    dockerfile: .cirrus/Dockerfile
    cpu: 8
    memory: 32Gb
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  <<: *JEST_REPORT_CACHE_TEMPLATE
  script:
    - .cirrus/cirrus-yarn-validate-ci.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
    - yarn_lint
    - yarn_validate
    - 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
  <<: *YARN_CACHE_TEMPLATE
  <<: *JEST_REPORT_CACHE_TEMPLATE
  <<: *ESLINT_REPORT_CACHE_TEMPLATE
  <<: *JUNIT_REPORT_CACHE_TEMPLATE
  script:
    - .cirrus/cirrus-sq-analysis.sh
  <<: *CLEANUP_GRADLE_CACHE_SCRIPT
  <<: *DEFAULT_ARTIFACTS_TEMPLATE