aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/checks.yml
blob: f9e1e1aa0d849b3c39dcb9dff6f120f118df469c (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
name: checks

on:
  push:
    branches:
      - master
      - release-branch-v*
  pull_request:
    branches:
      - '*'

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

jobs:
  checks:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.13.6
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1
        with:
          path: .github_cache_gradle/
          key: checks-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('buildSrc/**/*.java') }}
          restore-keys: |
            checks-gradle-
      - 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.13.6
    strategy:
      matrix:
        index: [0, 1]
        groups_count: [2]
      fail-fast: false
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1
        with:
          path: .github_cache_gradle/
          key: tests-shards-gradle-${{ matrix.index }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('buildSrc/**/*.java') }}
          restore-keys: |
            tests-shards-gradle-
      - 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.13.6
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1
        with:
          path: .github_cache_gradle/
          key: tests-all-sdks-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('buildSrc/**/*.java') }}
          restore-keys: |
            tests-all-sdks-gradle-
      - 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.13.6
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1
        with:
          path: .github_cache_gradle/
          key: tests-app-less-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('buildSrc/**/*.java') }}
          restore-keys: |
            tests-app-less-gradle-
      - 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

  deploy-dry-run:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.13.6
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1
        with:
          path: .github_cache_gradle/
          key: dry-run-deploy-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('buildSrc/**/*.java') }}
          restore-keys: |
            dry-run-deploy-gradle-
      - 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]
    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.13.6
    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 }}