65 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			YAML
		
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			YAML
		
	
	
	
| name: Build all targets and run all tests
 | |
| 
 | |
| on:
 | |
|   push:
 | |
|     branches: [ main ]
 | |
|   pull_request:
 | |
|     branches: [ main ]
 | |
| 
 | |
|   workflow_dispatch:
 | |
| 
 | |
| jobs:
 | |
| 
 | |
|   build_and_test:
 | |
|     runs-on: ${{ matrix.os }}
 | |
|     strategy:
 | |
|       matrix:
 | |
|         os: [ubuntu-latest, macos-11, windows-latest]
 | |
|         jdk: [8, 15, 17]
 | |
|         exclude:
 | |
|           # Only test against JDK 15 with Ubuntu since this is what OSS-Fuzz uses.
 | |
|           - os: macos-11
 | |
|             jdk: 15
 | |
|           - os: windows-latest
 | |
|             jdk: 15
 | |
|         include:
 | |
|           - os: ubuntu-latest
 | |
|             arch: "linux"
 | |
|             cache: "/home/runner/.cache/bazel-disk"
 | |
|           - os: macos-11
 | |
|             arch: "macos-x86_64"
 | |
|             # Always use the toolchain as UBSan produces linker errors with Apple LLVM 13.
 | |
|             bazel_args: "--config=toolchain --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-darwin"
 | |
|             cache: "/private/var/tmp/bazel-disk"
 | |
|           - os: windows-latest
 | |
|             arch: "windows"
 | |
|             cache: "%HOME%/bazel-disk"
 | |
| 
 | |
|     steps:
 | |
|       - uses: actions/checkout@v2
 | |
| 
 | |
|       - name: Set up JDK
 | |
|         uses: actions/setup-java@v1
 | |
|         with:
 | |
|           java-version: ${{ matrix.jdk }}
 | |
| 
 | |
|       - name: Mount Bazel disk cache
 | |
|         uses: actions/cache@v2
 | |
|         with:
 | |
|           path: ${{ matrix.cache }}
 | |
|           key: bazel-disk-cache-${{ matrix.arch }}-${{ matrix.jdk }}
 | |
| 
 | |
|       - name: Build
 | |
|         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 }} //...
 | |
| 
 | |
|       - name: Test
 | |
|         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 }} //...
 | |
| 
 | |
|       - name: Upload test logs
 | |
|         if: always()
 | |
|         uses: actions/upload-artifact@v2
 | |
|         with:
 | |
|           name: testlogs-${{ matrix.arch }}-${{ matrix.jdk }}
 | |
|           # https://github.com/actions/upload-artifact/issues/92#issuecomment-711107236
 | |
|           path: bazel-testlogs*/**/test.log
 |