1name: Build all targets and run all tests 2 3on: 4 push: 5 branches: [ main ] 6 pull_request: 7 branches: [ main ] 8 9 workflow_dispatch: 10 11jobs: 12 13 build_and_test: 14 runs-on: ${{ matrix.os }} 15 strategy: 16 matrix: 17 os: [ubuntu-latest, macos-11, windows-latest] 18 jdk: [8, 15, 17] 19 exclude: 20 # Only test against JDK 15 with Ubuntu since this is what OSS-Fuzz uses. 21 - os: macos-11 22 jdk: 15 23 - os: windows-latest 24 jdk: 15 25 include: 26 - os: ubuntu-latest 27 arch: "linux" 28 cache: "/home/runner/.cache/bazel-disk" 29 - os: macos-11 30 arch: "macos-x86_64" 31 # Always use the toolchain as UBSan produces linker errors with Apple LLVM 13. 32 bazel_args: "--config=toolchain --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-darwin" 33 cache: "/private/var/tmp/bazel-disk" 34 - os: windows-latest 35 arch: "windows" 36 cache: "%HOME%/bazel-disk" 37 38 steps: 39 - uses: actions/checkout@v2 40 41 - name: Set up JDK 42 uses: actions/setup-java@v1 43 with: 44 java-version: ${{ matrix.jdk }} 45 46 - name: Mount Bazel disk cache 47 uses: actions/cache@v2 48 with: 49 path: ${{ matrix.cache }} 50 key: bazel-disk-cache-${{ matrix.arch }}-${{ matrix.jdk }} 51 52 - name: Build 53 run: bazelisk build --config=ci --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }} --disk_cache=${{ matrix.cache }} --java_runtime_version=localjdk_${{ matrix.jdk }} ${{ matrix.bazel_args }} //... 54 55 - name: Test 56 run: bazelisk test --config=ci --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }} --disk_cache=${{ matrix.cache }} --java_runtime_version=localjdk_${{ matrix.jdk }} ${{ matrix.bazel_args }} //... 57 58 - name: Upload test logs 59 if: always() 60 uses: actions/upload-artifact@v2 61 with: 62 name: testlogs-${{ matrix.arch }}-${{ matrix.jdk }} 63 # https://github.com/actions/upload-artifact/issues/92#issuecomment-711107236 64 path: bazel-testlogs*/**/test.log 65