Skip to content

Commit

Permalink
dropme: prerelease -> release
Browse files Browse the repository at this point in the history
  • Loading branch information
zgtm committed Sep 14, 2023
1 parent 9ca5153 commit 0757b60
Showing 1 changed file with 109 additions and 72 deletions.
181 changes: 109 additions & 72 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,108 +2,145 @@ name: Release

on:
workflow_dispatch:
release:
types: [released]

jobs:
docker_push:
runs-on: ubuntu-latest

environment:
name: Deploy
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: Docker login
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login --username ${{ secrets.DOCKER_USER }} --password-stdin
- 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: Push docker containers
run: docker/push_all.sh
- name: Upload release archive
uses: actions/upload-artifact@v3
with:
name: jazzer_releases
path: jazzer-${{ matrix.name }}.tar.gz
if-no-files-found: error

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

steps:
- name: checkout
uses: actions/checkout@v3

- name: Build Jazzer API docs
run: |
bazel build //deploy:jazzer-api-docs
cp bazel-bin/deploy/jazzer-api-docs.jar .
- uses: actions/checkout@v3

- name: Build Jazzer docs
run: |
bazel build //deploy:jazzer-docs
cp bazel-bin/src/main/java/com/code_intelligence/jazzer/jazzer-docs.jar .
- name: Download individual jars
uses: actions/download-artifact@v3
with:
name: jazzer_tmp
path: _tmp/

- name: Build Jazzer API docs
- name: Merge jars
run: |
bazel build //deploy:jazzer-junit-docs
cp bazel-bin/deploy/jazzer-junit-docs.jar .
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 jars
- name: Upload merged jar
uses: actions/upload-artifact@v3
with:
name: jazzer_docs_jars
path: |
jazzer-api-docs.jar
jazzer-junit-docs.jar
jazzer-docs.jar
name: jazzer
path: _tmp/jazzer.jar
if-no-files-found: error

update_docs:
maven_predeploy:
runs-on: ubuntu-latest
needs: generate_docs
needs: merge_jars

environment:
name: Deploy

steps:
- name: checkout docs
uses: actions/checkout@v3
with:
repository: 'CodeIntelligenceTesting/jazzer-docs'
ssh-key: "${{ secrets.JAZZER_DOCS_SSH_KEY_PRIVATE }}"
- uses: actions/checkout@v3

- name: Download jar
- name: Download merged jar
uses: actions/download-artifact@v3
with:
name: jazzer_docs_jars
path: .
name: jazzer
path: _tmp/

- name: Run Deployment
env:
RELEASE_SIGNING_KEY_ID: ${{ secrets.RELEASE_SIGNING_KEY_ID }}
RELEASE_SIGNING_KEY_PRIVATE: ${{ secrets.RELEASE_SIGNING_KEY_PRIVATE }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
run: JAZZER_JAR_PATH="$(pwd)/_tmp/jazzer.jar" bazel run deploy

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

- name: Setup git
run: |
git config user.email "info@code-intelligence.com"
git config user.name "Jazzer release pipeline"
permissions:
contents: write # for creating releases

- name: Extract API docs jar
run: |
git rm -rf jazzer-api
mkdir jazzer-api
unzip jazzer-api-docs.jar -d jazzer-api
git add jazzer-api
# Do not fail if no changes to commit
# https://stackoverflow.com/questions/8123674/how-to-git-commit-nothing-without-an-error
git diff-index --quiet HEAD || git commit -m "Automated update: jazzer-api docs"
- name: Extract Jazzer docs jar
run: |
git rm -rf jazzer
mkdir jazzer
unzip jazzer-docs.jar -d jazzer
git add jazzer
git diff-index --quiet HEAD || git commit -m "Automated update: jazzer docs"
steps:
- name: checkout
uses: actions/checkout@v3

- name: Extract JUnit docs jar
run: |
git rm -rf jazzer-junit
mkdir jazzer-junit
unzip jazzer-junit-docs.jar -d jazzer-junit
git add jazzer-junit
git diff-index --quiet HEAD || git commit -m "Automated update: jazzer-junit docs"
- name: Download individual tar.gzs
uses: actions/download-artifact@v3
with:
name: jazzer_releases
path: _releases/

- name: Push changes
- name: read version
id: read-version
run: |
git push
echo ::set-output name=version::\
$(sed -nr 's/JAZZER_VERSION = "(.*)"/\1/p' maven.bzl)
shell: bash

- name: create release
uses: softprops/action-gh-release@v1
with:
name: v${{ steps.read-version.outputs.version }}
tag_name: v${{ steps.read-version.outputs.version }}
generate_release_notes: true
draft: true
files: |
_releases/jazzer-linux.tar.gz
_releases/jazzer-macos.tar.gz
_releases/jazzer-windows.tar.gz

0 comments on commit 0757b60

Please sign in to comment.