Add example for Kubernetes (#15) #229
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Maven Package | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Install prerequisites | |
run: | |
sudo | |
DEBIAN_FRONTEND=noninteractive | |
apt-get -y --no-install-recommends install | |
siege | |
- uses: actions/checkout@v3 | |
- name: Checkout utils | |
uses: actions/checkout@v2 | |
with: | |
repository: CRaC/utils | |
path: utils | |
- run: make -C utils | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- run: ./mvnw -B package | |
- name: Test on Vanila JDK | |
run: | | |
P=$(utils/start-bg.sh \ | |
-s "Started Application" \ | |
java -jar target/example-spring-boot-0.0.1-SNAPSHOT.jar) | |
curl localhost:8080 | grep "Greetings from Spring Boot!" | |
utils/bench.sh http://localhost:8080 | |
kill $P | |
- name: Download JDK | |
run: | | |
url=https://cdn.azul.com/zulu/bin/zulu17.44.17-ca-crac-jdk17.0.8-linux_x64.tar.gz | |
archive=${url##*/} | |
curl -LO $url | |
sudo tar -axf $archive | |
echo JDK=${archive%%.tar.gz} >> $GITHUB_ENV | |
- name: Prepare warm checkpoint | |
run: | | |
P=$(utils/start-bg.sh \ | |
-s "Started Application" \ | |
-e exitcode \ | |
${{ env.JDK }}/bin/java \ | |
-XX:CRaCCheckpointTo=cr \ | |
-XX:+UnlockDiagnosticVMOptions \ | |
-XX:+CRTraceStartupTime \ | |
-Djdk.crac.trace-startup-time=true \ | |
--add-opens java.base/java.lang=ALL-UNNAMED \ | |
-jar target/example-spring-boot-0.0.1-SNAPSHOT.jar) | |
# warmup the service | |
utils/bench.sh http://localhost:8080 | |
jcmd $P JDK.checkpoint | |
[ 137 = $(utils/read-exitcode.sh exitcode) ] | |
- name: Test on C/RaC | |
run: | | |
P=$(utils/start-bg.sh \ | |
-s "restore-finish" \ | |
${{ env.JDK }}/bin/java -XX:CRaCRestoreFrom=cr) | |
curl localhost:8080 | grep "Greetings from Spring Boot!" | |
utils/bench.sh http://localhost:8080 | |
kill $P | |
- name: Test C/RaC startup time | |
run: | |
timeout 3 bash -c "utils/javatime ; ${{ env.JDK }}/bin/java -XX:CRaCRestoreFrom=cr" | |
| utils/sel.awk -v from=prestart -v to=restore-finish |