Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI build speed #1956

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 clean package -DskipTests
- 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 }}
49 changes: 49 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/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
PACKAGE=false

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

# Execute commands based on the flags
if $PACKAGE; then
echo "Running package..."
eval "$PACKAGE_CMD"
fi

if $COMPILE; then
echo "Running compile..."
eval "$COMPILE_CMD"
kasmarian marked this conversation as resolved.
Show resolved Hide resolved
fi

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

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