Update actions/checkout digest to eef6144 #279
Workflow file for this run
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: Java CI with Gradle | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Build with Gradle wrapper | |
run: ./gradlew build --no-daemon | |
- name: Run app and test health | |
run: | | |
BOOT_WAIT_SECONDS=10 | |
LOG_FILE=app.log | |
# start app in background | |
java -jar build/libs/springboots2idemo-*.jar > $LOG_FILE 2>&1 & | |
# wait for server start and test health | |
sleep $BOOT_WAIT_SECONDS | |
HEALTH=$(curl http://localhost:9000/health) | |
# stop app | |
PID=$(ps -ef | grep "springboots2idemo-" | grep -v grep | awk '{ print $2 }') | |
if [ -z "$PID" ] | |
then | |
echo App is already stopped or did not start | |
exit 1 | |
else | |
echo "stop app (kill $PID)" | |
kill $PID | |
fi | |
# print app logs | |
echo "-- logs --" | |
cat $LOG_FILE | |
rm -f $LOG_FILE | |
# test app health | |
echo "-- test --" | |
if [ "$HEALTH" = '{"status":"UP"}' ]; then | |
echo "App started healthy" | |
else | |
echo "App not healthy" | |
exit 1 | |
fi |