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

#always run on the default branch: master
on:
  schedule:
    - cron: '29 04 * * *'
  push:
    branches:
      - auto-tools-update

env:
  TERM: dumb
  TMPDIR: "/tmp"
  BOT_USERNAME: ${{ secrets.BOT_MASTER_RW_GITHUB_USERNAME }}
  BOT_TOKEN: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}

jobs:
  gradle-update:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.13.6
    steps:
      - name: Install deps for create-pull-request
        run: |
          touch /etc/alpine-release
          ln -sf python3 /usr/bin/python
          ln -sf pip3 /usr/bin/pip
      - uses: actions/checkout@v2
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: update-to-latets-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' | 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 .
          git add -f gradle/wrapper/gradle-wrapper.jar
      - name: Create pull request
        uses: peter-evans/create-pull-request@v2.4.0
        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: ''
          assignees: menny
          branch: 'bot-pr/gradle-update'
  robolectric-update:
    runs-on: ubuntu-18.04
    container: menny/ndk_ask:1.13.6
    steps:
      - name: Install deps for create-pull-request
        run: |
          touch /etc/alpine-release
          ln -sf python3 /usr/bin/python
          ln -sf pip3 /usr/bin/pip
      - uses: actions/checkout@v2
      - name: setup
        run: ./scripts/ci/ci_setup.sh
      - name: update-to-latets-gradle
        run: |
          LATEST_VERSION=$(curl --silent -u "${BOT_USERNAME}:${BOT_TOKEN}" https://api.github.com/repos/robolectric/robolectric/releases | jq -c -r '.[] | .name' | head -n 1 | grep -o "\\(\\d\\+..\\+\\)")
          echo "Found version '${LATEST_VERSION}'."
          sed "s/robolectricVersion[[:space:]]=[[:space:]]'[[:digit:]].[[:digit:]].[[:digit:]]'/robolectricVersion = '${LATEST_VERSION}'/g" gradle/root_all_projects_ext.gradle > /tmp/output.file
          cp /tmp/output.file 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.0
        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: ''
          assignees: menny
          branch: 'bot-pr/robolectric-update'