@@ -25,23 +25,46 @@ jobs:
2525 name : actions ${{ matrix.java }}
2626 bazel :
2727 runs-on : ubuntu-latest
28+ container : gcr.io/gapic-images/googleapis-bazel:20210105
2829 steps :
2930 - uses : actions/checkout@v2
3031 - uses : actions/setup-java@v1
3132 with :
3233 java-version : 8
3334 - run : java -version
34- - name : Install Bazel
35+
36+ - name : Bazel File Cache Setup
37+ id : cache-bazel
38+ uses : actions/cache@v2
39+ with :
40+ path : ~/.cache/bazel
41+ key : ${{ runner.os }}-bazel-20210105-${{ secrets.CACHE_VERSION }}
42+
43+ - name : Bazel Cache Not Found
44+ if : steps.cache-bazel.outputs.cache-hit != 'true'
3545 run : |
36- wget -q "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/$BAZEL_BINARY"
37- wget -q "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/$BAZEL_BINARY.sha256"
38- sha256sum -c "$BAZEL_BINARY.sha256"
39- sudo dpkg -i "$BAZEL_BINARY"
40- env :
41- BAZEL_VERSION : 3.5.0
42- BAZEL_BINARY : bazel_3.5.0-linux-x86_64.deb
46+ echo "No cache found."
47+ - name : Bazel Cache Found
48+ if : steps.cache-bazel.outputs.cache-hit == 'true'
49+ run : |
50+ echo -n "Cache found. Cache size: "
51+ du -sh ~/.cache/bazel
52+ echo "If the cache seems broken, update the CACHE_VERSION secret in"
53+ echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions"
54+ echo "(use any random string, any GUID will work)"
55+ echo "and it will start over with a clean cache."
56+ echo "The old one will disappear after 7 days."
57+
4358 - name : Run bazel tests
4459 run : bazel --batch test //... --noshow_progress --test_output=errors
60+
61+ - uses : actions/upload-artifact@v2
62+ if : ${{ failure() }}
63+ with :
64+ name : test-artifacts
65+ path : ~/.cache/bazel/*/*/*/gax-java/bazel-out/*/testlogs/*
66+ retention-days : 5
67+
4568 - name : coverage
4669 uses : codecov/codecov-action@v1
4770 with :
0 commit comments