aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/third_party_update.yml
blob: ac427ccd2f4147798a6ce94d5450f32402657697 (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
name: third-party-update

#always run on the default branch: master
on:
  schedule:
    - cron: '29 04 * * *'

env:
  TERM: dumb
  TMPDIR: "/tmp"
  BOT_USERNAME: ${{ secrets.BOT_MASTER_RW_GITHUB_USERNAME }}
  BOT_TOKEN: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
  #should support 1.2.3 and 2.3 and 1.2.3-r3 and 1.2beta2
  GREP_VERSION_CLASSES: "[[:digit:]]\\{1,\\}[.][[:digit:]]\\{1,\\}[[:punct:][:alnum:]]*"

jobs:
  sanity-test:
    runs-on: ubuntu-18.04
    container: menny/android_base:1.14.0
    steps:
      - uses: actions/checkout@v2
      - name: verify-greps
        run: ./scripts/verify-third-party-update-greps.sh "${GREP_VERSION_CLASSES}"
  gradle-update:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.14.0
    steps:
      - uses: actions/checkout@v2
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: update-to-latest-gradle
        run: |
          LATEST_VERSION=$(curl --silent -u "${BOT_USERNAME}:${BOT_TOKEN}" https://api.github.com/repos/gradle/gradle/releases | jq -c -r '.[] | select(.prerelease == false) | .name' | grep -o "${GREP_VERSION_CLASSES}" | uniq | head -n 1)
          echo "Found version '${LATEST_VERSION}'."
          ./gradlew wrapper --gradle-version="${LATEST_VERSION}"
      - name: Sanity verification
        run: ./gradlew :api:assembleDebug :api:lintDebug
      - name: Add changed gradle files
        run: |
          git add -f gradlew*
          git add -f gradle/wrapper
          git add -f gradle/wrapper/gradle-wrapper.jar
      - name: Create pull request
        uses: peter-evans/create-pull-request@v2.4.4
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
          commit-message: 'Automated Gradle Update'
          title: 'Automated Gradle Update'
          committer: 'Polyglot <ask@evendanan.net>'
          author: 'Polyglot <ask@evendanan.net>'
          body: 'Latest version found at https://github.com/gradle/gradle/releases'
          team-reviewers: infra, maintainers
          branch: 'bot-pr/gradle-update'
          labels: automerge
  robolectric-update:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.14.0
    steps:
      - uses: actions/checkout@v2
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: update-to-latest-robolectric
        run: |
          LATEST_VERSION=$(curl --silent -u "${BOT_USERNAME}:${BOT_TOKEN}" https://api.github.com/repos/robolectric/robolectric/releases | jq -c -r '.[] | .tag_name' | grep -o "${GREP_VERSION_CLASSES}" | uniq | head -n 1)
          echo "Found version '${LATEST_VERSION}'."
          sed "s/robolectricVersion[[:space:]]=[[:space:]]'${GREP_VERSION_CLASSES}'/robolectricVersion = '${LATEST_VERSION}'/g" gradle/root_all_projects_ext.gradle > /tmp/output.file
          cp /tmp/output.file gradle/root_all_projects_ext.gradle
          cat gradle/root_all_projects_ext.gradle
      - name: Sanity verification
        run: |
          ./scripts/download_robolectric_jars_to_machine.sh
          ./gradlew :api:testDebugUnitTest :ime:nextword:testDebugUnitTest
      - name: Add changed gradle files
        run: |
          git add gradle/root_all_projects_ext.gradle
      - name: Create pull request
        uses: peter-evans/create-pull-request@v2.4.4
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
          commit-message: 'Automated Robolectric Update'
          title: 'Automated Robolectric Update'
          committer: 'Polyglot <ask@evendanan.net>'
          author: 'Polyglot <ask@evendanan.net>'
          body: 'Latest version found at https://github.com/robolectric/robolectric/releases'
          team-reviewers: infra, maintainers
          branch: 'bot-pr/robolectric-update'
          labels: automerge
  build-tools-update:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.14.0
    steps:
      - uses: actions/checkout@v2
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: update-to-latest-build-tools
        run: |
          LATEST_VERSION=$("${ANDROID_HOME}/tools/bin/sdkmanager" --list | grep -o "build-tools;${GREP_VERSION_CLASSES}" | grep -o "${GREP_VERSION_CLASSES}" | uniq | tail -n 1)
          echo "Found version '${LATEST_VERSION}'."
          sed "s/androidBuildTools[[:space:]]=[[:space:]]'${GREP_VERSION_CLASSES}'/androidBuildTools = '${LATEST_VERSION}'/g" gradle/root_all_projects_ext.gradle > /tmp/output.file
          cp /tmp/output.file gradle/root_all_projects_ext.gradle
          cat gradle/root_all_projects_ext.gradle
          yes | "${ANDROID_HOME}/tools/bin/sdkmanager" "build-tools;${LATEST_VERSION}"
      - name: Sanity verification
        run: ./gradlew :api:assembleDebug :api:lintDebug
      - name: Add changed gradle files
        run: |
          git add gradle/root_all_projects_ext.gradle
      - name: Create pull request
        uses: peter-evans/create-pull-request@v2.4.4
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
          commit-message: 'Automated Build-Tools Update'
          title: 'Automated Build-Tools Update'
          committer: 'Polyglot <ask@evendanan.net>'
          author: 'Polyglot <ask@evendanan.net>'
          body: 'Latest version found in `sdkmanager --list` call.'
          team-reviewers: infra, maintainers
          branch: 'bot-pr/build-tools-update'
          labels: automerge
  error-prone-update:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.14.0
    steps:
      - uses: actions/checkout@v2
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: update-to-latest-error-prone-plugin
        run: |
          LATEST_VERSION=$(curl --silent -u "${BOT_USERNAME}:${BOT_TOKEN}" https://api.github.com/repos/tbroyer/gradle-errorprone-plugin/releases | jq -c -r '.[] | .tag_name' | grep -o "${GREP_VERSION_CLASSES}" | uniq | head -n 1)
          echo "Found version '${LATEST_VERSION}'."
          sed "s/'net.ltgt.gradle:gradle-errorprone-plugin:${GREP_VERSION_CLASSES}'/'net.ltgt.gradle:gradle-errorprone-plugin:${LATEST_VERSION}'/g" build.gradle > /tmp/output.file
          cp /tmp/output.file build.gradle
          cat build.gradle
          sed "s/'net.ltgt.gradle:gradle-errorprone-plugin:${GREP_VERSION_CLASSES}'/'net.ltgt.gradle:gradle-errorprone-plugin:${LATEST_VERSION}'/g" gradle/errorprone.gradle > /tmp/output.file
          cp /tmp/output.file gradle/errorprone.gradle
          cat gradle/errorprone.gradle
      - name: update-to-latest-error-prone-tool
        run: |
          LATEST_VERSION=$(curl --silent -u "${BOT_USERNAME}:${BOT_TOKEN}" https://api.github.com/repos/google/error-prone/releases | jq -c -r '.[] | .tag_name' | grep -o "${GREP_VERSION_CLASSES}" | uniq | head -n 1)
          echo "Found version '${LATEST_VERSION}'."
          sed "s/'com.google.errorprone:error_prone_core:${GREP_VERSION_CLASSES}'/'com.google.errorprone:error_prone_core:${LATEST_VERSION}'/g" gradle/errorprone.gradle > /tmp/output.file
          cp /tmp/output.file gradle/errorprone.gradle
          cat gradle/errorprone.gradle
      - name: Sanity verification
        run: ./gradlew :api:assembleDebug :api:lintDebug
      - name: Add changed gradle files
        run: git add gradle/errorprone.gradle
      - name: Create pull request
        uses: peter-evans/create-pull-request@v2.4.4
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
          commit-message: 'Automated Error-Prone Update'
          title: 'Automated Error-Prone Update'
          committer: 'Polyglot <ask@evendanan.net>'
          author: 'Polyglot <ask@evendanan.net>'
          body: 'Latest version found at https://github.com/tbroyer/gradle-errorprone-plugin/releases and https://github.com/google/error-prone/releases.'
          team-reviewers: infra, maintainers
          branch: 'bot-pr/error-prone-update'
          labels: automerge
  google-format-update:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.14.0
    steps:
      - uses: actions/checkout@v2
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: update-to-latest-google-format-plugin
        run: |
          LATEST_VERSION=$(curl --silent -u "${BOT_USERNAME}:${BOT_TOKEN}" https://api.github.com/repos/sherter/google-java-format-gradle-plugin/releases | jq -c -r '.[] | .tag_name' | grep -o "${GREP_VERSION_CLASSES}" | uniq | head -n 1)
          echo "Found version '${LATEST_VERSION}'."
          sed "s/'gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:${GREP_VERSION_CLASSES}'/'gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:${LATEST_VERSION}'/g" build.gradle > /tmp/output.file
          cp /tmp/output.file build.gradle
          cat build.gradle
      - name: update-to-latest-google-format-tool
        run: |
          LATEST_VERSION=$(curl --silent -u "${BOT_USERNAME}:${BOT_TOKEN}" https://api.github.com/repos/google/google-java-format/releases | jq -c -r '.[] | .tag_name' | grep -o "${GREP_VERSION_CLASSES}" | uniq | head -n 1)
          echo "Found version '${LATEST_VERSION}'."
          sed "s/toolVersion[[:space:]]=[[:space:]]'${GREP_VERSION_CLASSES}'/toolVersion = '${LATEST_VERSION}'/g" build.gradle > /tmp/output.file
          cp /tmp/output.file build.gradle
          cat build.gradle
      - name: Sanity verification
        run: ./gradlew googleJavaFormat
      - name: Add changed formated files
        run: git add .
      - name: Create pull request
        uses: peter-evans/create-pull-request@v2.4.4
        with:
          token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
          commit-message: 'Automated Google-Format Update'
          title: 'Automated Google-Format Update'
          committer: 'Polyglot <ask@evendanan.net>'
          author: 'Polyglot <ask@evendanan.net>'
          body: 'Latest version found at https://github.com/sherter/google-java-format-gradle-plugin/releases and https://github.com/google/google-java-format/releases.'
          team-reviewers: infra, maintainers
          branch: 'bot-pr/google-format-update'
          labels: automerge