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

Modify JMH Benchmark Workflow For Shellcheck #813

Merged
merged 10 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .buildscript/check_git_clean.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh -eux

if [ -n "$(git status --porcelain)" ]; then
echo 'warning: source tree contains uncommitted changes; .gitignore patterns may need to be fixed'
git status
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
arguments: build
- name: Run shellcheck
uses: gradle/gradle-build-action@v2
with:
arguments: shellcheck
if: runner.os == 'Linux'
- name: Report jacoco coverage
uses: gradle/gradle-build-action@v2
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/get_repo_details.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ REPO_FULL_NAME=$(echo "$PR_DETAILS" | jq -r .head.repo.full_name)
BRANCH_NAME=$(echo "$PR_DETAILS" | jq -r .head.ref)

# Export vars to GITHUB_ENV so they can be used by later scripts
echo "REPO_FULL_NAME=$REPO_FULL_NAME" >> $GITHUB_ENV
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "REPO_FULL_NAME=$REPO_FULL_NAME" >> "$GITHUB_ENV"
echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_ENV"
8 changes: 4 additions & 4 deletions .github/workflows/run_gcp_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ 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
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
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
gcloud compute scp root@nullway-jmh:"$BRANCH_NAME/main/NullAway/jmh/build/results/jmh/results.txt" ./main_text.txt --zone=us-central1-a
8 changes: 4 additions & 4 deletions .github/workflows/run_main_benchmarks.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/bash -eux

cd $BRANCH_NAME/
cd "$BRANCH_NAME/"
mkdir main
cd main/
cd main/
git clone [email protected]:Uber/NullAway.git
cd NullAway/
cd NullAway/

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

cd $BRANCH_NAME/
cd "$BRANCH_NAME/"
mkdir pr
cd pr/
git clone --branch $BRANCH_NAME --single-branch [email protected]:$REPO_NAME.git NullAway
cd NullAway/
cd pr/
git clone --branch "$BRANCH_NAME" --single-branch [email protected]:"$REPO_NAME".git NullAway
cd NullAway/

./gradlew jmh --no-daemon
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ plugins {
id "com.github.kt3k.coveralls" version "2.12.0" apply false
id "me.champeau.jmh" version "0.7.1" apply false
id "com.github.ben-manes.versions" version "0.47.0"
id "com.felipefzdz.gradle.shellcheck" version "1.4.6"
}

repositories {
Expand Down Expand Up @@ -121,6 +122,16 @@ spotless {
spotlessPredeclare {
java { googleJavaFormat('1.17.0') }
}

shellcheck {
useDocker = false
shellcheckBinary = "shellcheck"
sourceFiles =
fileTree(".") {
include("**/*.sh")
}
}

////////////////////////////////////////////////////////////////////////
//
// Google Java Format pre-commit hook installation
Expand Down