-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add tests for create starter * Fix ci/cd * Minor workflow update
- Loading branch information
1 parent
3b4f7c7
commit 23b843c
Showing
5 changed files
with
166 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Copyright 2025 Oracle Corporation and/or its affiliates. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at | ||
# https://oss.oracle.com/licenses/upl. | ||
|
||
# --------------------------------------------------------------------------- | ||
# Coherence CLI GitHub Actions CI build - Test Create Starter | ||
# --------------------------------------------------------------------------- | ||
name: CI Test Create Starter | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches-ignore: | ||
- gh-pages | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
javaVersion: | ||
- 21 | ||
- 22 | ||
|
||
# Checkout the source, we need a depth of zero to fetch all of the history otherwise | ||
# the copyright check cannot work out the date of the files from Git. | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ matrix.javaVersion }} | ||
distribution: 'zulu' | ||
|
||
- name: Cache Go Modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-mods-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-mods- | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
|
||
- name: Build cohctl | ||
shell: bash | ||
run: make cohctl | ||
|
||
- name: Run Create Starter Test | ||
shell: bash | ||
run: | | ||
make test-create-starter | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: test-output-${{ matrix.coherenceVersion }} | ||
path: build/_output/test-logs |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright (c) 2025 Oracle and/or its affiliates. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at | ||
# https://oss.oracle.com/licenses/upl. | ||
# | ||
|
||
# Test various command related to creating starter projects | ||
# environment variables COM and COHERENCE_VERSION accepted | ||
|
||
pwd | ||
|
||
|
||
CONFIG_DIR=/tmp/$$.create.starter | ||
DIR=`pwd` | ||
OUTPUT=/tmp/$$.output | ||
STARTER_DIR=`mktemp -d` | ||
LOGS_DIR=$DIR/build/_output/test-logs | ||
|
||
mkdir -p ${CONFIG_DIR} ${STARTER_DIR} ${LOGS_DIR} | ||
trap "cp ${CONFIG_DIR}/cohctl.log /tmp && rm -rf ${CONFIG_DIR} $OUTPUT" 0 1 2 3 | ||
|
||
echo | ||
echo "Config Dir: ${CONFIG_DIR}" | ||
echo "Starter Dir: ${STARTER_DIR}" | ||
echo "Logs Dir: ${LOGS_DIR}" | ||
echo | ||
|
||
# Default command | ||
COHCTL="$DIR/bin/cohctl --config-dir ${CONFIG_DIR}" | ||
|
||
function runCommand() { | ||
echo "=========================================================" | ||
echo "Running command: cohctl $*" | ||
$COHCTL $* > $OUTPUT 2>&1 | ||
ret=$? | ||
cat $OUTPUT | ||
if [ $ret -ne 0 ] ; then | ||
echo "Command failed" | ||
# copy the log files | ||
save_logs | ||
exit 1 | ||
fi | ||
} | ||
|
||
runCommand version | ||
|
||
cd ${STARTER_DIR} | ||
|
||
function run_test() { | ||
curl -X POST -H "Content-Type: application/json" -d '{"id": 1, "name": "Tim", "balance": 1000}' http://localhost:8080/api/customers | ||
curl -s http://localhost:8080/api/customers/1 | ||
curl -s http://localhost:8080/api/customers | ||
curl -X DELETE http://localhost:8080/api/customers/1 | ||
} | ||
|
||
echo "Testing Helidon Starter" | ||
runCommand create starter helidon-starter -y -f helidon | ||
cd helidon-starter | ||
mvn clean install | ||
java -jar target/helidon.jar > ${LOGS_DIR}/helidon.log 2>&1 & | ||
PID=$! | ||
echo "Sleeping for 30..." | ||
sleep 30 | ||
run_test | ||
kill -9 $PID | ||
cd .. | ||
|
||
echo "Testing Spring Boot Starter" | ||
runCommand create starter springboot-starter -y -f springboot | ||
cd springboot-starter | ||
mvn clean install | ||
java -jar target/springboot-1.0-SNAPSHOT.jar > ${LOGS_DIR}/springboot.log 2>&1 & | ||
PID=$! | ||
echo "Sleeping for 30..." | ||
sleep 30 | ||
run_test | ||
kill -9 $PID | ||
cd .. | ||
|
||
echo "Testing Micronaut Starter" | ||
runCommand create starter micronaut-starter -y -f micronaut | ||
cd micronaut-starter | ||
mvn clean install | ||
java -jar target/micronaut-1.0-SNAPSHOT-shaded.jar > ${LOGS_DIR}/micronaut.log 2>&1 & | ||
PID=$! | ||
echo "Sleeping for 30..." | ||
sleep 30 | ||
run_test | ||
kill -9 $PID | ||
cd .. |
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