• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Release
2
3on:
4  workflow_dispatch:
5
6jobs:
7  build_release:
8    runs-on: ${{ matrix.os }}
9    strategy:
10      matrix:
11        include:
12          - os: ubuntu-20.04
13            name: linux
14          - os: macos-11
15            name: macos
16          - os: windows-2019
17            name: windows
18
19    steps:
20      - uses: actions/checkout@v3
21
22      - name: Set up JDK
23        uses: actions/setup-java@v3
24        with:
25          distribution: zulu
26          java-version: 8
27
28      - name: Set Build Buddy config
29        shell: bash
30        run: .github/scripts/echoBuildBuddyConfig.sh ${{ secrets.BUILDBUDDY_API_KEY }} >> $GITHUB_ENV
31
32      - name: Append build settings to .bazelrc
33        shell: bash
34        run: |
35          echo "build --announce_rc" >> .bazelrc
36          echo "build:linux --config=toolchain" >> .bazelrc
37          echo "build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux" >> .bazelrc
38
39      - name: Build
40        shell: bash
41        # Double forward slashes are converted to single ones by Git Bash on Windows, so we use working directory
42        # relative labels instead.
43        run: |
44          bazelisk build ${{env.BUILD_BUDDY_CONFIG}} deploy:jazzer :jazzer_release
45          cp -L $(bazel cquery --output=files deploy:jazzer) jazzer-${{ matrix.name }}.jar
46          cp -L $(bazel cquery --output=files :jazzer_release) jazzer-${{ matrix.name }}.tar.gz
47
48      - name: Upload jazzer.jar
49        uses: actions/upload-artifact@v3
50        with:
51          name: jazzer_tmp
52          path: jazzer-${{ matrix.name }}.jar
53          if-no-files-found: error
54
55      - name: Upload release archive
56        uses: actions/upload-artifact@v3
57        with:
58          name: jazzer_releases
59          path: jazzer-${{ matrix.name }}.tar.gz
60          if-no-files-found: error
61
62  merge_jars:
63    runs-on: ubuntu-latest
64    needs: build_release
65
66    steps:
67      - uses: actions/checkout@v3
68
69      - name: Download individual jars
70        uses: actions/download-artifact@v3
71        with:
72          name: jazzer_tmp
73          path: _tmp/
74
75      - name: Merge jars
76        run: |
77          bazel run @rules_jvm_external//private/tools/java/com/github/bazelbuild/rules_jvm_external/jar:MergeJars -- \
78            --output "$(pwd)"/_tmp/jazzer.jar \
79            $(find "$(pwd)/_tmp/" -name '*.jar' -printf "--sources %h/%f ")
80
81      - name: Upload merged jar
82        uses: actions/upload-artifact@v3
83        with:
84          name: jazzer
85          path: _tmp/jazzer.jar
86          if-no-files-found: error
87