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 2 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 }}
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the compilation work without packaging the servlet module first? Same question to install command.

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
Loading