aboutsummaryrefslogtreecommitdiff
path: root/.github/actions/test-gradle-plugin/action.yml
blob: bd5747294e9aa4424345102bed15fd8f9427e1c7 (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
name: 'Test Hilt Gradle plugin'
description: 'Tests the Hilt Gradle plugin.'

runs:
  using: "composite"
  steps:
    - name: 'Install Java ${{ env.USE_JAVA_VERSION_FOR_PLUGIN }}'
      uses: actions/setup-java@v3
      with:
        distribution: '${{ env.USE_JAVA_DISTRIBUTION }}'
        java-version: '${{ env.USE_JAVA_VERSION_FOR_PLUGIN }}'
    - name: 'Check out repository'
      uses: actions/checkout@v3
    - name: 'Cache local Maven repository'
      uses: actions/cache@v3
      with:
        path: |
          ~/.m2/repository
          !~/.m2/repository/com/google/dagger
        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
        restore-keys: |
          ${{ runner.os }}-maven-
    - name: 'Cache Bazel files'
      uses: actions/cache@v3
      with:
        path: ~/.cache/bazel
        key: ${{ runner.os }}-bazel-build-${{ github.sha }}
        restore-keys: |
          ${{ runner.os }}-bazel-build-
    - name: 'Cache Gradle files'
      uses: actions/cache@v2
      with:
        path: |
          ~/.gradle/caches
          ~/.gradle/wrapper
        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
        restore-keys: |
          ${{ runner.os }}-gradle-
    - name: 'Download local snapshot for tests'
      uses: actions/download-artifact@v3
      with:
        name: local-snapshot
        path: ~/.m2/repository/com/google/dagger
    - name: 'Build and test Hilt Gradle plugin'
      run: ./java/dagger/hilt/android/plugin/gradlew -p java/dagger/hilt/android/plugin clean test  --continue --no-daemon --stacktrace
      shell: bash
    - name: 'Clean bazel cache'
      # According to the documentation, we should be able to exclude these via
      # the actions/cache path, e.g. "!~/.cache/bazel/*/*/external/" but that
      # doesn't seem to work.
      run: |
        rm -rf $(bazel info repository_cache)
        rm -rf ~/.cache/bazel/*/*/external/
      shell: bash