aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: fb25268d022a292f98fc4fd61c79bfe19057e978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Release

on:
  workflow_dispatch:

jobs:
  build_release:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-20.04
            name: linux
          - os: macos-11
            name: macos
          - os: windows-2019
            name: windows

    steps:
      - uses: actions/checkout@v3

      - name: Set up JDK
        uses: actions/setup-java@v3
        with:
          distribution: zulu
          java-version: 8

      - name: Set Build Buddy config
        shell: bash
        run: .github/scripts/echoBuildBuddyConfig.sh ${{ secrets.BUILDBUDDY_API_KEY }} >> $GITHUB_ENV

      - name: Append build settings to .bazelrc
        shell: bash
        run: |
          echo "build --announce_rc" >> .bazelrc
          echo "build:linux --config=toolchain" >> .bazelrc
          echo "build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux" >> .bazelrc

      - name: Build
        shell: bash
        # Double forward slashes are converted to single ones by Git Bash on Windows, so we use working directory
        # relative labels instead.
        run: |
          bazelisk build ${{env.BUILD_BUDDY_CONFIG}} deploy:jazzer :jazzer_release
          cp -L $(bazel cquery --output=files deploy:jazzer) jazzer-${{ matrix.name }}.jar
          cp -L $(bazel cquery --output=files :jazzer_release) jazzer-${{ matrix.name }}.tar.gz

      - name: Upload jazzer.jar
        uses: actions/upload-artifact@v3
        with:
          name: jazzer_tmp
          path: jazzer-${{ matrix.name }}.jar
          if-no-files-found: error

      - name: Upload release archive
        uses: actions/upload-artifact@v3
        with:
          name: jazzer_releases
          path: jazzer-${{ matrix.name }}.tar.gz
          if-no-files-found: error

  merge_jars:
    runs-on: ubuntu-latest
    needs: build_release

    steps:
      - uses: actions/checkout@v3

      - name: Download individual jars
        uses: actions/download-artifact@v3
        with:
          name: jazzer_tmp
          path: _tmp/

      - name: Merge jars
        run: |
          bazel run @rules_jvm_external//private/tools/java/com/github/bazelbuild/rules_jvm_external/jar:MergeJars -- \
            --output "$(pwd)"/_tmp/jazzer.jar \
            $(find "$(pwd)/_tmp/" -name '*.jar' -printf "--sources %h/%f ")

      - name: Upload merged jar
        uses: actions/upload-artifact@v3
        with:
          name: jazzer
          path: _tmp/jazzer.jar
          if-no-files-found: error