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, 17] 19 include: 20 - os: ubuntu-latest 21 arch: "linux" 22 cache: "/home/runner/.cache/bazel-disk" 23 - os: macos-11 24 arch: "macos-x86_64" 25 # Always use the toolchain as UBSan produces linker errors with Apple LLVM 13. 26 bazel_args: "--config=toolchain --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-darwin --xcode_version_config=//.github:host_xcodes" 27 cache: "/private/var/tmp/bazel-disk" 28 - os: windows-latest 29 arch: "windows" 30 cache: "%HOME%/bazel-disk" 31 32 steps: 33 - uses: actions/checkout@v2 34 35 - name: Set up JDK 36 uses: actions/setup-java@v1 37 with: 38 java-version: ${{ matrix.jdk }} 39 40 - name: Mount Bazel disk cache 41 uses: actions/cache@v2 42 with: 43 path: ${{ matrix.cache }} 44 key: bazel-disk-cache-${{ matrix.arch }}-${{ matrix.jdk }} 45 46 - name: Set Build Buddy config 47 run: .github/scripts/echoBuildBuddyConfig.sh ${{ secrets.BUILDBUDDY_API_KEY }} >> $GITHUB_ENV 48 shell: bash 49 50 - name: Build 51 run: bazelisk build ${{env.BUILD_BUDDY_CONFIG}} --java_runtime_version=local_jdk_${{ matrix.jdk }} --disk_cache=${{ matrix.cache }} ${{ matrix.bazel_args }} //... 52 53 - name: Test 54 run: bazelisk test ${{env.BUILD_BUDDY_CONFIG}} --java_runtime_version=local_jdk_${{ matrix.jdk }} --disk_cache=${{ matrix.cache }} ${{ matrix.bazel_args }} //... 55 56 - name: Upload test logs 57 if: always() 58 uses: actions/upload-artifact@v2 59 with: 60 name: testlogs-${{ matrix.arch }}-${{ matrix.jdk }} 61 # https://github.com/actions/upload-artifact/issues/92#issuecomment-711107236 62 path: bazel-testlogs*/**/test.log 63