Skip to content

Commit 1acb91c

Browse files
java-team-github-botGuice Team
authored and
Guice Team
committed
Run bazel test in ci workflow.
Also update gitignore file to ingore bazel generated output and skip the deploy doc/snapshot job if not the main repo. PiperOrigin-RevId: 422908745
1 parent 1c57d16 commit 1acb91c

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

.github/workflows/ci.yml

+35-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# This workflow will build a Java project with Maven
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
33
name: continuous-integration
4+
env:
5+
USE_BAZEL_VERSION: '4.2.2'
46

57
on:
68
push:
@@ -42,10 +44,41 @@ jobs:
4244
- name: Verify with Maven
4345
run: mvn -B -P!standard-with-extra-repos verify --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true
4446

47+
bazel-test:
48+
runs-on: ${{ matrix.os }}
49+
strategy:
50+
matrix:
51+
os: [ubuntu-latest]
52+
java: [8, 11, 15]
53+
fail-fast: false
54+
max-parallel: 4
55+
name: Bazel Test JDK ${{ matrix.java }}, ${{ matrix.os }}
56+
57+
steps:
58+
- name: Cancel previous runs
59+
uses: styfle/[email protected]
60+
with:
61+
access_token: ${{ github.token }}
62+
- uses: actions/checkout@v2
63+
- name: Set up JDK
64+
uses: actions/setup-java@v2
65+
with:
66+
java-version: ${{ matrix.java }}
67+
distribution: 'zulu'
68+
- name: 'Cache bazel external dependencies'
69+
uses: actions/cache@v2
70+
with:
71+
path: ~/.cache/bazel/*/*/external
72+
key: ${{ runner.os }}-bazel-test-${{ hashFiles('**/WORKSPACE') }}
73+
restore-keys: |
74+
${{ runner.os }}-bazel-test-
75+
- name: Bazel test
76+
run: bazel test //... --test_output=errors
77+
4578
publish:
4679
runs-on: ubuntu-latest
47-
needs: test
48-
if: ${{ github.event_name == 'push' }}
80+
needs: [test, bazel-test]
81+
if: github.event_name == 'push' && github.repository == 'google/guice' && github.ref == 'refs/heads/master'
4982
name: Publish Javadoc and Snapshot
5083

5184
steps:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/build/
2+
bazel-*
23
target/
34
bin/
45
.project

0 commit comments

Comments
 (0)