Skip to content

Enable Framework Benchmark Workflow #15725

Enable Framework Benchmark Workflow

Enable Framework Benchmark Workflow #15725

Workflow file for this run

# This file was automatically generated by sbt-github-actions using the
# githubWorkflowGenerate task. You should add and commit this file to
# your git repository. It goes without saying that you shouldn't edit
# this file by hand! Instead, if you wish to make changes, you should
# change your sbt build configuration to revise the workflow description
# to meet your needs, then regenerate this file.
name: Continuous Integration
on:
pull_request:
branches: ['**']
types: [opened, synchronize, reopened, edited, labeled]
push:
branches: ['**']
tags: [v*]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.18, 2.13.12, 3.3.1]
java: [graal_graalvm@17, temurin@8]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup GraalVM (graal_graalvm@17)
if: matrix.java == 'graal_graalvm@17'
uses: graalvm/setup-graalvm@v1
with:
java-version: 17
distribution: graalvm
components: native-image
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: sbt
- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
cache: sbt
- name: Check that workflows are up to date
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.12]
java: [graal_graalvm@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup GraalVM (graal_graalvm@17)
if: matrix.java == 'graal_graalvm@17'
uses: graalvm/setup-graalvm@v1
with:
java-version: 17
distribution: graalvm
components: native-image
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: sbt
- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
cache: sbt
runBenchmarks-simple:
name: Performance Benchmarks (PlainTextBenchmarkServer)
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.12]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Clean up
id: clean_up
env:
GITHUB_TOKEN: ${{secrets.ACTIONS_PAT}}
run: sudo rm -rf *
- uses: actions/checkout@v2
with:
path: zio-http
- uses: actions/checkout@v2
with:
repository: khajavi/FrameworkBenchmarks
path: FrameworkBenchMarks
- id: result
env:
GITHUB_TOKEN: ${{secrets.ACTIONS_PAT}}
run: |
mkdir -p ./FrameworkBenchMarks/frameworks/Scala/zio-http/src/main/scala
cp ./zio-http/zio-http-example/src/main/scala/example/PlainTextBenchmarkServer.scala ./FrameworkBenchMarks/frameworks/Scala/zio-http/src/main/scala/Main.scala
cd ./FrameworkBenchMarks
cd ./frameworks/Scala/zio-http
git init .
git tag v1.0.0
git clone https://github.com/${{github.event.pull_request.head.repo.owner.login}}/zio-http.git
cd zio-http
git checkout ${{github.event.pull_request.head.sha}}
cd ../../../..
./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]+" | grep -oiE "[0-9]+" | head -1)
RESULT_CONCURRENCY=$(echo $(grep -B 1 -A 17 "Concurrency: 256 for plaintext" result) | grep -oiE "concurrency: [0-9]+" | grep -oiE "[0-9]+")
echo "request_per_second=$RESULT_REQUEST" >> $GITHUB_OUTPUT
echo "concurrency=$RESULT_CONCURRENCY" >> $GITHUB_OUTPUT
- if: ${{github.event.pull_request.head.repo.full_name == 'zio/zio-http'}}
uses: peter-evans/commit-comment@v2
with:
sha: ${{github.event.pull_request.head.sha}}
body: |
**🚀 :** Performance Benchmarks (PlainTextBenchmarkServer)
concurrency: ${{steps.result.outputs.concurrency}}
requests/sec: ${{steps.result.outputs.request_per_second}}
- name: Performance Report
id: perf-report
env:
REQUESTS_PER_SECOND: ${{steps.result.outputs.request_per_second}}
CONCURRENCY: ${{steps.result.outputs.concurrency}}
PERFORMANCE_FLOOR: 800000
run: |
echo "** 🚀 Performance Benchmarks (PlainTextBenchmarkServer) Report 🚀 **"
echo "$REQUESTS_PER_SECOND requests/sec for $CONCURRENCY concurrent requests"
if (( REQUESTS_PER_SECOND > PERFORMANCE_FLOOR )); then
echo "Woohoo! Performance is good! $REQUESTS_PER_SECOND requests/sec exceeds the performance floor of $PERFORMANCE_FLOOR requests/sec."
else
echo "Performance benchmark failed with $REQUESTS_PER_SECOND req/sec! Performance must exceed $PERFORMANCE_FLOOR req/sec."
exit 1
fi
runBenchmarks-effectful:
name: Performance Benchmarks (SimpleEffectBenchmarkServer)
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.12]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Clean up
id: clean_up
env:
GITHUB_TOKEN: ${{secrets.ACTIONS_PAT}}
run: sudo rm -rf *
- uses: actions/checkout@v2
with:
path: zio-http
- uses: actions/checkout@v2
with:
repository: khajavi/FrameworkBenchmarks
path: FrameworkBenchMarks
- id: result
env:
GITHUB_TOKEN: ${{secrets.ACTIONS_PAT}}
run: |
mkdir -p ./FrameworkBenchMarks/frameworks/Scala/zio-http/src/main/scala
cp ./zio-http/zio-http-example/src/main/scala/example/SimpleEffectBenchmarkServer.scala ./FrameworkBenchMarks/frameworks/Scala/zio-http/src/main/scala/Main.scala
cd ./FrameworkBenchMarks
cd ./frameworks/Scala/zio-http
git init .
git tag v1.0.0
git clone https://github.com/${{github.event.pull_request.head.repo.owner.login}}/zio-http.git
cd zio-http
git checkout ${{github.event.pull_request.head.sha}}
cd ../../../..
./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]+" | grep -oiE "[0-9]+" | head -1)
RESULT_CONCURRENCY=$(echo $(grep -B 1 -A 17 "Concurrency: 256 for plaintext" result) | grep -oiE "concurrency: [0-9]+" | grep -oiE "[0-9]+")
echo "request_per_second=$RESULT_REQUEST" >> $GITHUB_OUTPUT
echo "concurrency=$RESULT_CONCURRENCY" >> $GITHUB_OUTPUT
- if: ${{github.event.pull_request.head.repo.full_name == 'zio/zio-http'}}
uses: peter-evans/commit-comment@v2
with:
sha: ${{github.event.pull_request.head.sha}}
body: |
**🚀 :** Performance Benchmarks (SimpleEffectBenchmarkServer)
concurrency: ${{steps.result.outputs.concurrency}}
requests/sec: ${{steps.result.outputs.request_per_second}}
- name: Performance Report
id: perf-report
env:
REQUESTS_PER_SECOND: ${{steps.result.outputs.request_per_second}}
CONCURRENCY: ${{steps.result.outputs.concurrency}}
PERFORMANCE_FLOOR: 500000
run: |
echo "** 🚀 Performance Benchmarks (SimpleEffectBenchmarkServer) Report 🚀 **"
echo "$REQUESTS_PER_SECOND requests/sec for $CONCURRENCY concurrent requests"
if (( REQUESTS_PER_SECOND > PERFORMANCE_FLOOR )); then
echo "Woohoo! Performance is good! $REQUESTS_PER_SECOND requests/sec exceeds the performance floor of $PERFORMANCE_FLOOR requests/sec."
else
echo "Performance benchmark failed with $REQUESTS_PER_SECOND req/sec! Performance must exceed $PERFORMANCE_FLOOR req/sec."
exit 1
fi