blob: d84f061917a180d52a42ab5e70195b872e56d0fd [file] [log] [blame]
name: 'Bazel test'
description: 'Runs Bazel tests.'
runs:
using: "composite"
steps:
- name: 'Install Java ${{ env.USE_JAVA_VERSION }}'
uses: actions/setup-java@v3
with:
distribution: '${{ env.USE_JAVA_DISTRIBUTION }}'
java-version: '${{ env.USE_JAVA_VERSION }}'
- 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
# Note: we could use the same key as bazel-build, but we separate them
# so that bazel-build's cache is smaller (~200Mb vs ~900Mb) and faster
# to load than this cache since it's the bottleneck of all other steps
key: ${{ runner.os }}-bazel-test-${{ github.sha }}
restore-keys: |
${{ runner.os }}-bazel-test-
- 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: 'Run Bazel tests'
run: bazel test --test_output=errors //...
shell: bash
- name: 'Run Bazel examples'
run: cd examples/bazel; bazel test --test_output=errors //...
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