GitHub Actions workflow improvements (#2557)

* Checkout merged branches for pull requests
* Echo the mvn command used for builds
* Use more functions in maven-build so it is similar to what will be used for add-on builds

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born 2021-11-04 14:36:18 +01:00 committed by GitHub
parent 4bc8027461
commit cd29a16609
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 19 deletions

View File

@ -1,7 +1,11 @@
#!/bin/bash
BUILD_LOG=build.log
DEFAULT_ARGUMENTS="clean verify -B -T 1.5C -U"
ARGUMENTS="clean verify -B -T 1.5C -U"
if [ $# -ge 1 ]; then
ARGUMENTS=$@
fi
function print_reactor_summary() {
local start_end=$(grep -anE "\[INFO\] \\-{70,}" "$BUILD_LOG" | tail -n4 | cut -f1 -d: | sed -e 1b -e '$!d' | xargs)
@ -22,22 +26,26 @@ function mvnp() {
stdbuf -o0 sed -e :a -e "s/^.\{1,${padding}\}|/ &/;ta" # right align progress with padding
}
function build_all() {
echo
echo "Building all projects"
echo
echo "+ mvn $ARGUMENTS"
echo
mvnp $ARGUMENTS
status=$?
echo
if [ $status -eq 0 ]; then
print_reactor_summary
else
tail -n 2000 "$BUILD_LOG"
fi
exit $status
}
mvn -v
echo
if [ $# -ge 1 ]; then
mvnp $@
else
mvnp $DEFAULT_ARGUMENTS
fi
status=$?
echo
if [ $status -eq 0 ]; then
print_reactor_summary
else
tail -n 2000 "$BUILD_LOG"
fi
exit $status
build_all

View File

@ -24,8 +24,15 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
if: github.head_ref == ''
uses: actions/checkout@v2
- name: Checkout merge
if: github.head_ref != ''
uses: actions/checkout@v2
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge
- name: Set up Cache
uses: actions/cache@v2
with: