Skip to content

Commit

Permalink
Use run.sh to streamline build
Browse files Browse the repository at this point in the history
  • Loading branch information
msdousti committed Nov 17, 2024
1 parent 9e4bea3 commit fb8808e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ jobs:
distribution: temurin
java-version: 17
cache: 'maven'
- name: Compile
run: ./mvnw package -DskipTests -pl logbook-servlet -am
- name: Test
run: ./mvnw verify -P "${{ matrix.profile }}" -B
- name: Compile & test
run: ./build.sh
- name: Coverage
if: github.event_name != 'pull_request'
run: ./mvnw -P coverage coveralls:report -B -D repoToken=${{ secrets.COVERALLS_TOKEN }}
40 changes: 40 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -euxo pipefail

# Define default commands
COMPILE_CMD="./mvnw compile"
PACKAGE_CMD="./mvnw package -DskipTests -pl logbook-servlet -am"
VERIFY_CMD="./mvnw verify -B"
INSTALL_CMD="./mvnw install -DskipTests -Djacoco.skip=true"

# Flags to track selected options
COMPILE=false
NO_TEST_INSTALL=false

# Parse options
while [[ "$#" -gt 0 ]]; do
case $1 in
--compile|-c) COMPILE=true ;;
--no-test-install|-i) NO_TEST_INSTALL=true ;;
-ci|-ic) COMPILE=true; NO_TEST_INSTALL=true ;;
*) echo "Unknown option: $1"; exit 1 ;;
esac
shift
done

# Execute commands based on the flags
if $COMPILE; then
echo "Running compile..."
eval "$COMPILE_CMD"
fi

if $NO_TEST_INSTALL; then
echo "Running install without tests..."
eval "$INSTALL_CMD"
fi

if ! $COMPILE && ! $NO_TEST_INSTALL; then
echo "Running default commands..."
eval "$PACKAGE_CMD"
eval "$VERIFY_CMD"
fi

0 comments on commit fb8808e

Please sign in to comment.