Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added GCP JMH Benchmark Workflow #770

Merged
merged 177 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from 170 commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
1fe54cc
Add files via upload
armughan11 May 4, 2023
63d30d7
Add files via upload
armughan11 May 4, 2023
3afb61f
Add files via upload
armughan11 May 4, 2023
a613e2a
Delete Dockerfile
armughan11 May 4, 2023
e406cb6
Delete cloudbuild.yaml
armughan11 May 4, 2023
a222600
Delete benchmark.yml
armughan11 May 4, 2023
26b8048
Create jmh-benchmark.yml
armughan11 May 4, 2023
e5372ef
Update jmh-benchmark.yml
armughan11 May 4, 2023
0736aaf
Update jmh-benchmark.yml
armughan11 May 4, 2023
ba562c0
Update jmh-benchmark.yml
armughan11 May 4, 2023
9a43532
Update jmh-benchmark.yml
armughan11 May 5, 2023
e48a6e4
Update jmh-benchmark.yml
armughan11 May 5, 2023
7b3aa41
Update jmh-benchmark.yml
armughan11 May 5, 2023
a35945b
Add files via upload
armughan11 May 5, 2023
d4524a0
Delete test.py
armughan11 May 5, 2023
53c4b81
Update jmh-benchmark.yml
armughan11 May 5, 2023
6bfdfac
Update jmh-benchmark.yml
armughan11 May 5, 2023
eb05c20
Add files via upload
armughan11 May 5, 2023
3afdb82
Delete test.py
armughan11 May 5, 2023
b6d16c8
Update jmh-benchmark.yml
armughan11 May 5, 2023
04f34ab
Update jmh-benchmark.yml
armughan11 May 5, 2023
f8ed394
Update jmh-benchmark.yml
armughan11 May 5, 2023
4f616e4
Update jmh-benchmark.yml
armughan11 May 5, 2023
b8bdf4a
Update jmh-benchmark.yml
armughan11 May 7, 2023
500371f
Update jmh-benchmark.yml
armughan11 May 7, 2023
4cbcf34
Update jmh-benchmark.yml
armughan11 May 7, 2023
d58429e
Update jmh-benchmark.yml
armughan11 May 7, 2023
7ed8ec3
Branch Test #4
armughan11 May 7, 2023
f3ced35
Delete test.py
armughan11 May 7, 2023
813b9b2
Update jmh-benchmark.yml
armughan11 May 9, 2023
5ff6fe3
Update jmh-benchmark.yml
armughan11 May 11, 2023
3615ccf
Update jmh-benchmark.yml
armughan11 May 11, 2023
5e15f52
Update jmh-benchmark.yml
armughan11 May 11, 2023
f3720f0
Add files via upload
armughan11 May 11, 2023
82590a7
Delete test.py
armughan11 May 11, 2023
eccf9db
Update jmh-benchmark.yml
armughan11 May 11, 2023
652821c
dsadas
armughan11 May 11, 2023
358b2a1
Update jmh-benchmark.yml
armughan11 May 11, 2023
21b0796
Update jmh-benchmark.yml
armughan11 May 11, 2023
0609fd7
Update jmh-benchmark.yml
armughan11 May 11, 2023
1bdc013
Update jmh-benchmark.yml
armughan11 May 11, 2023
90dde3c
Update jmh-benchmark.yml
armughan11 May 11, 2023
9fcbb53
Update jmh-benchmark.yml
armughan11 May 11, 2023
e78df0b
Update jmh-benchmark.yml
armughan11 May 11, 2023
a9b007c
Update jmh-benchmark.yml
armughan11 May 11, 2023
a1173ab
Update jmh-benchmark.yml
armughan11 May 11, 2023
770a938
Update jmh-benchmark.yml
armughan11 May 11, 2023
d101171
Update jmh-benchmark.yml
armughan11 May 11, 2023
7234311
Update jmh-benchmark.yml
armughan11 May 11, 2023
517d3b4
Add files via upload
armughan11 May 11, 2023
4164312
Update jmh-benchmark.yml
armughan11 May 11, 2023
5b54988
Add files via upload
armughan11 May 11, 2023
c86f354
Add files via upload
armughan11 May 11, 2023
3d1d4b0
Update jmh-benchmark.yml
armughan11 May 11, 2023
998bf7a
Update jmh-benchmark.yml
armughan11 May 11, 2023
f6a3753
Update jmh-benchmark.yml
armughan11 May 11, 2023
e9cb3c6
Update jmh-benchmark.yml
armughan11 May 11, 2023
712c96f
Add files via upload
armughan11 May 11, 2023
5125f9f
Update jmh-benchmark.yml
armughan11 May 11, 2023
35c9fde
Update jmh-benchmark.yml
armughan11 May 11, 2023
21a7963
Add files via upload
armughan11 May 11, 2023
7abaf9b
Update jmh-benchmark.yml
armughan11 May 11, 2023
69f45d3
Update jmh-benchmark.yml
armughan11 May 27, 2023
2acc459
Update jmh-benchmark.yml
armughan11 May 27, 2023
319ae4c
Create comment.yml
armughan11 May 27, 2023
da7fa8d
Delete comment.yml
armughan11 May 27, 2023
1290374
Update jmh-benchmark.yml
armughan11 May 27, 2023
0c95cb5
Update jmh-benchmark.yml
armughan11 May 27, 2023
84c84c6
Update jmh-benchmark.yml
armughan11 May 27, 2023
b12ff25
Update jmh-benchmark.yml
armughan11 May 27, 2023
162a88f
Update jmh-benchmark.yml
armughan11 May 27, 2023
b8aec1e
Update jmh-benchmark.yml
armughan11 May 27, 2023
c70309e
Update jmh-benchmark.yml
armughan11 May 27, 2023
3a2f46d
Update jmh-benchmark.yml
armughan11 May 27, 2023
db5142a
Update jmh-benchmark.yml
armughan11 May 27, 2023
d259743
Update jmh-benchmark.yml
armughan11 May 27, 2023
f715219
Add files via upload
armughan11 May 27, 2023
f60a648
Update jmh-benchmark.yml
armughan11 May 30, 2023
2e65279
Update jmh-benchmark.yml
armughan11 May 30, 2023
72f5997
Update jmh-benchmark.yml
armughan11 May 30, 2023
500ec84
Update jmh-benchmark.yml
armughan11 May 30, 2023
410a576
Update jmh-benchmark.yml
armughan11 May 30, 2023
2e104d2
Update jmh-benchmark.yml
armughan11 May 30, 2023
72b9375
Update jmh-benchmark.yml
armughan11 May 30, 2023
52d73cb
Update jmh-benchmark.yml
armughan11 May 31, 2023
14b84e7
Update jmh-benchmark.yml
armughan11 Jun 1, 2023
ee0b3ed
Update jmh-benchmark.yml
armughan11 Jun 5, 2023
2728189
Create run_pr_benchmarks.sh
armughan11 Jun 15, 2023
0058466
Create run_main_benchmarks.sh
armughan11 Jun 15, 2023
0b9a868
Update jmh-benchmark.yml
armughan11 Jun 15, 2023
a2b34ad
Update jmh-benchmark.yml
armughan11 Jun 15, 2023
9ea4bef
Update jmh-benchmark.yml
armughan11 Jun 15, 2023
5578feb
Delete test.py
armughan11 Jun 16, 2023
28b8ab0
Merge branch 'uber:master' into master
armughan11 Jun 26, 2023
f6595d7
Update jmh-benchmark.yml
armughan11 Jun 26, 2023
2b9e337
Create run_benchmarks.sh
armughan11 Jun 26, 2023
1d890a6
Update jmh-benchmark.yml
armughan11 Jun 26, 2023
827471c
Update jmh-benchmark.yml
armughan11 Jun 26, 2023
69b1706
Update jmh-benchmark.yml
armughan11 Jun 26, 2023
1ccaaee
Update jmh-benchmark.yml
armughan11 Jun 26, 2023
f35a679
Update jmh-benchmark.yml
armughan11 Jun 26, 2023
7051379
Update and rename run_benchmarks.sh to gcloud_ssh.sh
armughan11 Jun 26, 2023
3df2372
Update jmh-benchmark.yml
armughan11 Jun 26, 2023
8b26c84
Update jmh-benchmark.yml
armughan11 Jun 26, 2023
04e1b4f
Update jmh-benchmark.yml
armughan11 Jun 26, 2023
b1d328c
Update jmh-benchmark.yml
armughan11 Jun 26, 2023
f6b384a
Update jmh-benchmark.yml
armughan11 Jun 26, 2023
750ed82
Update run_pr_benchmarks.sh
armughan11 Jun 28, 2023
fd1e993
Update run_main_benchmarks.sh
armughan11 Jun 28, 2023
78a0ca6
Update jmh-benchmark.yml
armughan11 Jun 28, 2023
7c7ae0b
Update jmh-benchmark.yml
armughan11 Jun 28, 2023
9d5008a
Update jmh-benchmark.yml
armughan11 Jun 28, 2023
3dd23da
Update jmh-benchmark.yml
armughan11 Jun 28, 2023
ee97fa2
Update run_pr_benchmarks.sh
armughan11 Jun 28, 2023
60f40c0
Update jmh-benchmark.yml
armughan11 Jun 28, 2023
a180681
Update jmh-benchmark.yml
armughan11 Jun 28, 2023
21fa635
Update jmh-benchmark.yml
armughan11 Jun 28, 2023
a22dd49
Update jmh-benchmark.yml
armughan11 Jul 6, 2023
3670482
Create run_gcp_benchmarks.sh
armughan11 Jul 6, 2023
859a079
Update jmh-benchmark.yml
armughan11 Jul 6, 2023
0af9dee
Update jmh-benchmark.yml
armughan11 Jul 6, 2023
c9cf2b0
Create get_repo_details.sh
armughan11 Jul 6, 2023
24d527b
Update jmh-benchmark.yml
armughan11 Jul 6, 2023
059cbcf
Update gcloud_ssh.sh
armughan11 Jul 6, 2023
d51e45f
Update get_repo_details.sh
armughan11 Jul 6, 2023
860ad36
Update run_gcp_benchmarks.sh
armughan11 Jul 6, 2023
9cded48
Update run_main_benchmarks.sh
armughan11 Jul 6, 2023
619176a
Update run_pr_benchmarks.sh
armughan11 Jul 6, 2023
4e6665e
Update jmh-benchmark.yml
armughan11 Jul 6, 2023
9c11cd2
Update jmh-benchmark.yml
armughan11 Jul 6, 2023
b7f6478
Update run_pr_benchmarks.sh
armughan11 Jul 6, 2023
b552753
Update run_pr_benchmarks.sh
armughan11 Jul 6, 2023
97a664d
Update run_pr_benchmarks.sh
armughan11 Jul 6, 2023
4f6df5c
Update jmh-benchmark.yml
armughan11 Jul 6, 2023
e4916be
Update run_gcp_benchmarks.sh
armughan11 Jul 6, 2023
bffefdb
Update jmh-benchmark.yml
armughan11 Jul 6, 2023
6c752c6
Update run_gcp_benchmarks.sh
armughan11 Jul 6, 2023
d6e832f
Update jmh-benchmark.yml
armughan11 Jul 6, 2023
2547993
Update gcloud_ssh.sh
armughan11 Jul 8, 2023
976df47
Update jmh-benchmark.yml
armughan11 Jul 8, 2023
9a41a4c
Update run_gcp_benchmarks.sh
armughan11 Jul 8, 2023
0e6a13f
Update jmh-benchmark.yml
armughan11 Jul 8, 2023
010843e
Update jmh-benchmark.yml
armughan11 Jul 8, 2023
041f2b8
Update jmh-benchmark.yml
armughan11 Jul 8, 2023
d0e89d2
Update jmh-benchmark.yml
armughan11 Jul 8, 2023
f2acee0
Update jmh-benchmark.yml
armughan11 Jul 8, 2023
11b65c9
Update gcloud_ssh.sh
armughan11 Jul 15, 2023
7de9274
Update get_repo_details.sh
armughan11 Jul 15, 2023
a1c9b50
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
9b99d3a
Update run_gcp_benchmarks.sh
armughan11 Jul 15, 2023
730a6c9
Update run_main_benchmarks.sh
armughan11 Jul 15, 2023
2e472d4
Update run_pr_benchmarks.sh
armughan11 Jul 15, 2023
2dd58e6
Update run_gcp_benchmarks.sh
armughan11 Jul 15, 2023
97ae313
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
90f1cb1
Update run_gcp_benchmarks.sh
armughan11 Jul 15, 2023
64c70a6
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
8a865bb
Update run_gcp_benchmarks.sh
armughan11 Jul 15, 2023
cf95913
Update run_gcp_benchmarks.sh
armughan11 Jul 15, 2023
21c030c
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
95eb12e
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
ca7f20c
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
12d16de
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
1c4681d
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
16231f5
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
52f94ca
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
03b47b2
Merge branch 'uber:master' into master
armughan11 Jul 15, 2023
75c6ca9
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
dc7588b
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
092ed4d
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
828a29d
Added VM start and stop commands
armughan11 Jul 15, 2023
006c624
minor tweaks
msridhar Jul 15, 2023
b150f9b
Merge branch 'master' into master
msridhar Jul 15, 2023
a0b77f0
Update jmh-benchmark.yml
armughan11 Jul 15, 2023
c9632de
change job name
msridhar Jul 17, 2023
1d1b050
tweak text
msridhar Jul 17, 2023
5d32846
Update jmh-benchmark.yml
armughan11 Jul 17, 2023
1b07f0d
change step name
msridhar Jul 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/gcloud_ssh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

msridhar marked this conversation as resolved.
Show resolved Hide resolved
# This script is used to run commands on a Google Cloud instance via SSH

# Define the variables for Google Cloud project, zone, username, and instance
PROJECT_ID="ucr-ursa-major-sridharan-lab"
ZONE="us-central1-a"
USER="root"
INSTANCE="nullway-jmh"
gcloud compute ssh --project=$PROJECT_ID --zone=$ZONE $USER@$INSTANCE --command="$1"
20 changes: 20 additions & 0 deletions .github/workflows/get_repo_details.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# This script retrieves the repository and branch details of a GitHub pull request

# Assign command line arguments to variables
# GH_TOKEN is the GitHub authentication token
# PR_NUMBER is the number of the pull request
# REPO_NAME is the name of the repository
GH_TOKEN="$1"
PR_NUMBER="$2"
REPO_NAME="$3"

PR_DETAILS=$(curl -s -H "Authorization: token $GH_TOKEN" "https://api.github.com/repos/$REPO_NAME/pulls/$PR_NUMBER")

REPO_FULL_NAME=$(echo "$PR_DETAILS" | jq -r .head.repo.full_name)
BRANCH_NAME=$(echo "$PR_DETAILS" | jq -r .head.ref)

# Export the REPO_FULL_NAME and BRANCH_NAME variables
echo "REPO_FULL_NAME=$REPO_FULL_NAME" >> $GITHUB_ENV
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
63 changes: 63 additions & 0 deletions .github/workflows/jmh-benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This GitHub Actions workflow runs JMH benchmarks when a new comment is created on a pull request
name: Run JMH Benchmarks for Pull Request

on:
issue_comment: # This workflow triggers when a comment is created
types: [created]

jobs:
setup:
# Only run this job if a comment on a pull request contains '/benchmark' and is a PR on the uber/NullAway repository
if: github.event.issue.pull_request && contains(github.event.comment.body, '/benchmark') && github.repository == 'uber/NullAway'
runs-on: ubuntu-latest
permissions: write-all

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

- name: Set branch name
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x ./.github/workflows/get_repo_details.sh
./.github/workflows/get_repo_details.sh "${{ secrets.GITHUB_TOKEN }}" "${{ github.event.issue.number }}" "${{ github.repository }}"

- id: 'auth'
name: Authenticating
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_SA_KEY_1 }}'

- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v1

- name: Start VM
run: gcloud compute instances start nullway-jmh --zone=us-central1-a

- name: Run benchmarks
run: |
chmod +x ./.github/workflows/run_gcp_benchmarks.sh
./.github/workflows/run_gcp_benchmarks.sh

- name: Cleanup
# Delete the branch directory on the Google Cloud instance
if: always()
run: |
./.github/workflows/gcloud_ssh.sh " export BRANCH_NAME=${BRANCH_NAME} && rm -r -f $BRANCH_NAME"

- name: Formatting Benchmark # Create a text file containing the benchmark results
run: |
(echo 'Main Benchmark:'; echo '```' ; cat main_text.txt; echo '```'; echo 'PR Benchmark:'; echo '```' ; cat pr_text.txt; echo '```') > benchmark.txt

- name: Comment Benchmark
uses: mshick/add-pr-comment@v2
if: always() # This step is for adding the comment
with:
message-path: benchmark.txt # The path to the message file to leave as a comment
message-id: benchmark
- name: Stop VM
armughan11 marked this conversation as resolved.
Show resolved Hide resolved
run: gcloud compute instances stop nullway-jmh --zone=us-central1-a



20 changes: 20 additions & 0 deletions .github/workflows/run_gcp_benchmarks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# This script is responsible for running benchmarks for a GitHub pull request and the main branch on Google Cloud Compute Engine (GCCE).


chmod +x ./.github/workflows/gcloud_ssh.sh
./.github/workflows/gcloud_ssh.sh "export BRANCH_NAME=${BRANCH_NAME} && mkdir $BRANCH_NAME"

# Using gcloud compute scp to copy the bash scripts that will run the benchmarks onto the GCCE
gcloud compute scp ./.github/workflows/run_pr_benchmarks.sh root@nullway-jmh:$BRANCH_NAME/ --zone=us-central1-a
gcloud compute scp ./.github/workflows/run_main_benchmarks.sh root@nullway-jmh:$BRANCH_NAME/ --zone=us-central1-a

# Running the benchmark script for the pull request branch and main branch on GCCE
./.github/workflows/gcloud_ssh.sh " export BRANCH_NAME=${BRANCH_NAME} && export REPO_NAME=${REPO_FULL_NAME} && chmod +x $BRANCH_NAME/run_pr_benchmarks.sh && $BRANCH_NAME/run_pr_benchmarks.sh && cd && chmod +x $BRANCH_NAME/run_main_benchmarks.sh && $BRANCH_NAME/run_main_benchmarks.sh"

# Copying the benchmark results from GCCE back to the Github runner for the PR branch
gcloud compute scp root@nullway-jmh:$BRANCH_NAME/pr/NullAway/jmh/build/results/jmh/results.txt ./pr_text.txt --zone=us-central1-a

# Copying the benchmark results from GCCE back to the Github runner for the main branch
gcloud compute scp root@nullway-jmh:$BRANCH_NAME/main/NullAway/jmh/build/results/jmh/results.txt ./main_text.txt --zone=us-central1-a
9 changes: 9 additions & 0 deletions .github/workflows/run_main_benchmarks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

cd $BRANCH_NAME/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this cd $BRANCH_NAME/ command in this script and also run_pr_benchmarks.sh?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just kept this for the sake of consistency across the two files. I am running the PR benchmark on the $BRANCH_NAME/pr/NullAway folder (the whole $BRANCH_NAME directory was set up to avoid errors due to any residual files from other PRs), and I am navigating back to the root directory after that's done. I can omit the cd $BRANCH_NAME from main, but that would mean that I will have to go up two directories to the $BRANCH_NAME folder in the step where I run the gcloud ssh command. Happy to make those changes if they are more suitable @msridhar. Thank you!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it's fine to keep, was just curious.

mkdir main
cd main/
git clone git@github.com:Uber/NullAway.git
cd NullAway/

./gradlew jmh
9 changes: 9 additions & 0 deletions .github/workflows/run_pr_benchmarks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

cd $BRANCH_NAME/
mkdir pr
cd pr/
git clone --branch $BRANCH_NAME --single-branch git@github.com:$REPO_NAME.git NullAway
cd NullAway/

./gradlew jmh