• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Build all targets and run all tests
2
3on:
4  push:
5    branches: [ main ]
6  pull_request:
7    branches: [ main ]
8  merge_group:
9
10  workflow_dispatch:
11
12jobs:
13
14  test_junit_springboot:
15    runs-on: ubuntu-20.04
16    steps:
17      - uses: actions/checkout@v3
18      - name: Set up JDK
19        uses: actions/setup-java@v3
20        with:
21          distribution: zulu
22          java-version: 17
23      - name: Build and run tests
24        # The Spring Boot example project is built with Maven. The shell script builds the project
25        # against the local version of Jazzer and runs its unit and fuzz tests.
26        # Spring version 6 requires JDK 17.
27        run: |
28          cd examples/junit-spring-web
29          ./build-and-run-tests.sh
30        shell: bash
31
32  build_and_test:
33    runs-on: ${{ matrix.os }}
34    strategy:
35      matrix:
36        os: [ubuntu-20.04, macos-12, windows-2019]
37        jdk: [8, 17]
38        include:
39          - os: ubuntu-20.04
40            arch: "linux"
41            cache: "/home/runner/.cache/bazel-disk"
42            bazel_args: "//launcher/android:jazzer_android"
43          - os: ubuntu-20.04
44            jdk: 20
45            # Workaround for https://github.com/bazelbuild/bazel/issues/14502
46            bazel_args: "--jvmopt=-Djava.security.manager=allow"
47            arch: "linux"
48            cache: "/home/runner/.cache/bazel-disk"
49          - os: macos-12
50            bazel_args: "--xcode_version_config=//.github:host_xcodes"
51            arch: "macos-x86_64"
52            cache: "/private/var/tmp/bazel-disk"
53          - os: windows-2019
54            arch: "windows"
55            cache: "%HOME%/bazel-disk"
56
57    steps:
58      - uses: actions/checkout@v3
59
60      - name: Set up JDK
61        uses: actions/setup-java@v3
62        with:
63          distribution: zulu
64          java-version: ${{ matrix.jdk }}
65
66      # The java binary has the necessary entitlements to allow tests to pass, but that requires
67      # user interaction (clicking through Gatekeeper warnings) that we can't simulate in CI.
68      - name: Remove codesign signature on java binary
69        if: contains(matrix.os, 'mac')
70        run: codesign --remove-signature "$JAVA_HOME"/bin/java
71
72      - name: Mount Bazel disk cache
73        uses: actions/cache@v3
74        with:
75          path: ${{ matrix.cache }}
76          key: bazel-disk-cache-${{ matrix.arch }}-${{ matrix.jdk }}
77
78      - name: Set Build Buddy config
79        run: .github/scripts/echoBuildBuddyConfig.sh ${{ secrets.BUILDBUDDY_API_KEY }} >> $GITHUB_ENV
80        shell: bash
81
82      - name: Build & Test
83        run: bazelisk test ${{env.BUILD_BUDDY_CONFIG}} --java_runtime_version=local_jdk_${{ matrix.jdk }} --disk_cache=${{ matrix.cache }} ${{ matrix.bazel_args }} --build_tag_filters="-no-${{ matrix.arch }}-jdk${{ matrix.jdk }},-no-jdk${{ matrix.jdk }}" --test_tag_filters="-no-${{ matrix.arch }}-jdk${{ matrix.jdk }},-no-jdk${{ matrix.jdk }}" //...
84
85      - name: Copy Bazel log
86        if: always()
87        shell: bash
88        run: cp "$(readlink bazel-out)"/../../../java.log* .
89
90      - name: Upload test logs
91        if: always()
92        uses: actions/upload-artifact@v3
93        with:
94          name: testlogs-${{ matrix.arch }}-${{ matrix.jdk }}
95          # https://github.com/actions/upload-artifact/issues/92#issuecomment-711107236
96          path: |
97            bazel-testlogs*/**/test.log
98            java.log*
99