Skip to content

Commit

Permalink
Disable benchmarks comment on fork pull request (#820)
Browse files Browse the repository at this point in the history
* Disable benchmarks on fork PR

* run benchmarks on fork PR but disbable PR comment
  • Loading branch information
d11-amitsingh authored and amitksingh1490 committed Jan 13, 2022
1 parent 24f80a8 commit 0ff48ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,15 @@ jobs:
run: |
cp ./zio-http/example/src/main/scala/example/PlainTextBenchmarkServer.scala ./FrameworkBenchMarks/frameworks/Scala/zio-http/src/main/scala/Main.scala
cd ./FrameworkBenchMarks
echo ${{github.event.pull_request.head.sha}}
sed -i "s/---COMMIT_SHA---/${{github.event.pull_request.head.sha}}/g" frameworks/Scala/zio-http/build.sbt
sed -i "s/---COMMIT_SHA---/${{github.event.pull_request.head.repo.owner.login}}\/zio-http.git#${{github.event.pull_request.head.sha}}/g" frameworks/Scala/zio-http/build.sbt
./tfb --test zio-http | tee result
RESULT_REQUEST=$(echo $(grep -B 1 -A 17 "Concurrency: 256 for plaintext" result) | grep -oiE "requests/sec: [0-9]+.[0-9]+")
RESULT_CONCURRENCY=$(echo $(grep -B 1 -A 17 "Concurrency: 256 for plaintext" result) | grep -oiE "concurrency: [0-9]+")
echo ::set-output name=request_result::$(echo $RESULT_REQUEST)
echo ::set-output name=concurrency_result::$(echo $RESULT_CONCURRENCY)
- uses: peter-evans/commit-comment@v1
- if: ${{github.event.pull_request.head.repo.full_name == 'dream11/zio-http'}}
uses: peter-evans/commit-comment@v1
with:
sha: ${{github.event.pull_request.head.sha}}
body: |
Expand Down
10 changes: 7 additions & 3 deletions project/BenchmarkWorkFlow.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ object BenchmarkWorkFlow {
id = "runBenchMarks",
name = "Benchmarks",
oses = List("centos"),
cond = Some("${{ github.event_name == 'pull_request'}}"),
cond = Some(
"${{ github.event_name == 'pull_request'}}",
),
steps = List(
WorkflowStep.Run(
env = Map("GITHUB_TOKEN" -> "${{secrets.ACTIONS_PAT}}"),
Expand All @@ -34,8 +36,7 @@ object BenchmarkWorkFlow {
commands = List(
"cp ./zio-http/example/src/main/scala/example/PlainTextBenchmarkServer.scala ./FrameworkBenchMarks/frameworks/Scala/zio-http/src/main/scala/Main.scala",
"cd ./FrameworkBenchMarks",
"echo ${{github.event.pull_request.head.sha}}",
"""sed -i "s/---COMMIT_SHA---/${{github.event.pull_request.head.sha}}/g" frameworks/Scala/zio-http/build.sbt""",
"""sed -i "s/---COMMIT_SHA---/${{github.event.pull_request.head.repo.owner.login}}\/zio-http.git#${{github.event.pull_request.head.sha}}/g" frameworks/Scala/zio-http/build.sbt""",
"./tfb --test zio-http | tee result",
"""RESULT_REQUEST=$(echo $(grep -B 1 -A 17 "Concurrency: 256 for plaintext" result) | grep -oiE "requests/sec: [0-9]+.[0-9]+")""",
"""RESULT_CONCURRENCY=$(echo $(grep -B 1 -A 17 "Concurrency: 256 for plaintext" result) | grep -oiE "concurrency: [0-9]+")""",
Expand All @@ -45,6 +46,9 @@ object BenchmarkWorkFlow {
),
WorkflowStep.Use(
ref = UseRef.Public("peter-evans", "commit-comment", "v1"),
cond = Some(
"${{github.event.pull_request.head.repo.full_name == 'dream11/zio-http'}}",
),
params = Map(
"sha" -> "${{github.event.pull_request.head.sha}}",
"body" ->
Expand Down

0 comments on commit 0ff48ed

Please sign in to comment.