|
1 | 1 | # This workflow will build a Java project with Maven
|
2 | 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
3 | 3 | name: continuous-integration
|
| 4 | +env: |
| 5 | + USE_BAZEL_VERSION: '4.2.2' |
4 | 6 |
|
5 | 7 | on:
|
6 | 8 | push:
|
@@ -42,10 +44,41 @@ jobs:
|
42 | 44 | - name: Verify with Maven
|
43 | 45 | run: mvn -B -P!standard-with-extra-repos verify --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true
|
44 | 46 |
|
| 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 | + |
| 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 | + |
45 | 78 | publish:
|
46 | 79 | 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' |
49 | 82 | name: Publish Javadoc and Snapshot
|
50 | 83 |
|
51 | 84 | steps:
|
|
0 commit comments