• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: 'Test Hilt Gradle plugin'
2description: 'Tests the Hilt Gradle plugin.'
3
4runs:
5  using: "composite"
6  steps:
7    - name: 'Install Java ${{ env.USE_JAVA_VERSION_FOR_GRADLE_PLUGIN }}'
8      uses: actions/setup-java@v4
9      with:
10        distribution: '${{ env.USE_JAVA_DISTRIBUTION }}'
11        java-version: '${{ env.USE_JAVA_VERSION_FOR_GRADLE_PLUGIN }}'
12    - name: 'Check out repository'
13      uses: actions/checkout@v4
14    - name: 'Cache local Maven repository'
15      uses: actions/cache@v4
16      with:
17        path: |
18          ~/.m2/repository
19          !~/.m2/repository/com/google/dagger
20        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
21        restore-keys: |
22          ${{ runner.os }}-maven-
23    - name: 'Cache Bazel files'
24      uses: actions/cache@v4
25      with:
26        path: ~/.cache/bazel
27        key: ${{ runner.os }}-bazel-build-${{ github.sha }}
28        restore-keys: |
29          ${{ runner.os }}-bazel-build-
30    - name: 'Cache Gradle files'
31      uses: actions/cache@v4
32      with:
33        path: |
34          ~/.gradle/caches
35          ~/.gradle/wrapper
36        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
37        restore-keys: |
38          ${{ runner.os }}-gradle-
39    - name: 'Download local snapshot for tests'
40      uses: actions/download-artifact@v4
41      with:
42        name: local-snapshot
43        path: ~/.m2/repository/com/google/dagger
44    - name: 'Build and test Hilt Gradle plugin'
45      run: ./java/dagger/hilt/android/plugin/gradlew -p java/dagger/hilt/android/plugin clean test  --continue --no-daemon --stacktrace
46      shell: bash
47    - name: 'Clean bazel cache'
48      # According to the documentation, we should be able to exclude these via
49      # the actions/cache path, e.g. "!~/.cache/bazel/*/*/external/" but that
50      # doesn't seem to work.
51      run: |
52        rm -rf $(bazel info repository_cache)
53        rm -rf ~/.cache/bazel/*/*/external/
54      shell: bash
55