aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/checks.yml
blob: e777e18f0579292b76b4d746689601ee55a406de (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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
name: checks

on:
  push:
    paths-ignore:
      - deployment/halt_deployment_marker
    branches:
      - master
      - release-branch-*
  pull_request:
    paths-ignore:
      - deployment/halt_deployment_marker
    branches:
      - '*'

env:
  TERM: dumb
  GRADLE_OPTS: "-Dorg.gradle.daemon=false"
  GRADLE_USER_HOME: ".github_cache_gradle/"
  TMPDIR: "/tmp"

jobs:
  checks:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.14.0
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1.1.2
        with:
          path: .github_cache_gradle/
          key: checks-gradle-v2-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('buildSrc/**/*.java') }}
          restore-keys: checks-gradle-v2-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: check
        run: ./scripts/ci/ci_check.sh
      - uses: ./.github/actions/collect-reports
        if: always()
        with:
          file_pattern: checkstyle*.html
          output_folder: collected_reports/checkstyle
      - uses: ./.github/actions/collect-reports
        if: always()
        with:
          file_pattern: lint-results-*.html
          output_folder: collected_reports/lint
      - uses: actions/upload-artifact@v1.0.0
        if: always()
        with:
          name: checks-reports
          path: collected_reports

  app-tests-shards:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.14.0
    strategy:
      matrix:
        index: [0, 1]
        groups_count: [2]
      fail-fast: false
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1.1.2
        with:
          path: .github_cache_gradle/
          key: tests-shards-gradle-v2-${{ matrix.index }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('buildSrc/**/*.java') }}
          restore-keys: tests-shards-gradle-v2-${{ matrix.index }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: tests
        uses: ./.github/actions/test-shard-run
        with:
          index: ${{ matrix.index }}
          groups_count: ${{ matrix.groups_count }}
          module: ":ime:app:"
          extra_args: "-PexcludeTestClasses=\"**/*AllSdkTest*\""
      - uses: ./.github/actions/codecov
      - uses: ./.github/actions/collect-reports
        if: always()
        with:
          file_pattern: "**/build/reports/tests/**"
      - uses: actions/upload-artifact@v1.0.0
        if: always()
        with:
          name: app-tests-${{ matrix.index }}
          path: collected_reports
      - uses: actions/upload-artifact@v1.0.0
        if: always()
        with:
          name: app-tests-${{ matrix.index }}-build-logging
          path: build-logging

  app-all-sdks-tests:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.14.0
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1.1.2
        with:
          path: .github_cache_gradle/
          key: tests-all-sdks-gradle-v2-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('buildSrc/**/*.java') }}
          restore-keys: tests-all-sdks-gradle-v2-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: tests
        uses: ./.github/actions/test-shard-run
        with:
          index: 0
          groups_count: 1
          module: ":ime:app:"
          extra_args: "--tests=*AllSdkTest*"
      - uses: ./.github/actions/codecov
      - uses: ./.github/actions/collect-reports
        if: always()
        with:
          file_pattern: "**/build/reports/tests/**"
      - uses: actions/upload-artifact@v1.0.0
        if: always()
        with:
          name: app-less-tests
          path: collected_reports
      - uses: actions/upload-artifact@v1.0.0
        if: always()
        with:
          name: app-all-sdks-tests-build-logging
          path: build-logging

  app-less-tests:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.14.0
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1.1.2
        with:
          path: .github_cache_gradle/
          key: tests-app-less-gradle-v2-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('buildSrc/**/*.java') }}
          restore-keys: tests-app-less-gradle-v2-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: tests
        uses: ./.github/actions/test-shard-run
        with:
          index: 0
          groups_count: 1
          module: ""
          extra_args: "-x :ime:app:testDebugUnitTest -x :ime:app:testDebugUnitTestCoverage"
      - uses: ./.github/actions/codecov
      - uses: ./.github/actions/collect-reports
        if: always()
        with:
          file_pattern: "**/build/reports/tests/**"
      - uses: actions/upload-artifact@v1.0.0
        if: always()
        with:
          name: app-less-tests
          path: collected_reports
      - uses: actions/upload-artifact@v1.0.0
        if: always()
        with:
          name: app-less-tests-build-logging
          path: build-logging

  verify-all-addons:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.14.0
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1.1.2
        with:
          path: .github_cache_gradle/
          key: verify-all-addons-gradle-v2-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('buildSrc/**/*.java') }}
          restore-keys: verify-all-addons-gradle-v2-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: verify-add-ons
        run: |
          ./scripts/download_robolectric_jars_to_machine.sh
          ./gradlew :ime:app:testAllAddOnsUnitTestCoverage :ime:app:testAllAddOnsUnitTest --tests="*LoadedKeyboardsVerificationTest*"
          chmod -R a+rwx .
      - uses: ./.github/actions/codecov
      - uses: ./.github/actions/collect-reports
        if: always()
        with:
          file_pattern: "**/build/reports/tests/**"
      - uses: actions/upload-artifact@v1.0.0
        if: always()
        with:
          name: verify-all-addons
          path: collected_reports
      - uses: actions/upload-artifact@v1.0.0
        if: always()
        with:
          name: verify-all-addons-build-logging
          path: build-logging

  deploy-dry-run:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.14.0
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1.1.2
        with:
          path: .github_cache_gradle/
          key: dry-run-deploy-gradle-v2-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('buildSrc/**/*.java') }}
          restore-keys: dry-run-deploy-gradle-v2-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: dry-run-release-build
        run: |
          mkdir -p /root/.android/ || true
          cp ./.github/actions/deploy/debug.keystore /root/.android/ || exit 1
          ./gradlew -PwithAutoVersioning :generateFdroidYamls -DdeployChannel=alpha assembleRelease assembleCanary verifyReleaseResources generateReleasePlayResources generateCanaryPlayResources
          chmod -R a+rwx .
      - uses: actions/upload-artifact@v1.0.0
        with:
          name: fdroid-metadata-dry-run
          path: outputs/fdroid

  master-green-requirement:
    needs: [checks, app-all-sdks-tests, app-tests-shards, app-less-tests, deploy-dry-run, verify-all-addons]
    runs-on: ubuntu-18.04
    steps:
      - name: ready
        run: echo "DONE"

  deploy-request:
    if: github.event_name == 'push'
    needs: [master-green-requirement]
    runs-on: ubuntu-18.04
    container: menny/android_base:1.14.0
    steps:
      - uses: actions/checkout@v2
      - uses: ./.github/actions/deploy-request
        name: request-new-deploys
        with:
          sha: ${{ github.sha }}
          ref: ${{ github.ref }}
          new_deploy: true
          api_username: ${{ secrets.BOT_MASTER_RW_GITHUB_USERNAME }}
          api_token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}

  merge-to-master:
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-branch-')
    needs: [master-green-requirement]
    runs-on: ubuntu-18.04
    container: menny/android_base:1.14.0
    steps:
      - uses: actions/checkout@v2
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
          fetch-depth: 0
          ref: master
      - name: create-merge-commit
        run: ./scripts/ci/ci_merge_to_master.sh ${{ github.ref }}
      - name: Create pull request
        uses: peter-evans/create-pull-request@v2.4.4
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
          commit-message: 'Merge to master from ${{ github.ref }}.'
          title: 'Automated Merge to master from ${{ github.ref }}'
          committer: 'Polyglot <ask@evendanan.net>'
          author: 'Polyglot <ask@evendanan.net>'
          body: 'Generated from commit ${{ github.sha }} on ${{ github.ref }}.'
          team-reviewers: maintainers
          branch: 'bot-pr/merge-to-master-from-${{ github.ref }}'
          base: master
          labels: automerge