Skip to content

Commit

Permalink
ci: enable Windows target and 2 retries of maven build step on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Jul 10, 2024
1 parent a4f491b commit 0e16bf1
Showing 1 changed file with 49 additions and 44 deletions.
93 changes: 49 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ jobs:
#- ubuntu-latest # TODO builds are extremely slow for no apparent reason and job currently times out after 15 minutes
- macos-12 # Intel
- macos-14 # ARM
#- windows-latest # TODO currently too many random test failures
- windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 15
timeout-minutes: 20

steps:
- name: "Show: GitHub context"
Expand Down Expand Up @@ -166,48 +166,53 @@ jobs:


- name: "Build with Maven 🔨"
run: |
set -eu
MAVEN_OPTS="${MAVEN_OPTS:-}"
if [[ "${{ runner.os }}" == "Windows" ]]; then
MAVEN_OPTS+=" -Djava.security.egd=file:/dev/urandom" # https://www.baeldung.com/java-security-egd#bd-testing-the-effect-of-javasecurityegd
else
MAVEN_OPTS+=" -Djava.security.egd=file:/dev/./urandom" # https://stackoverflow.com/questions/58991966/what-java-security-egd-option-is-for/59097932#59097932
fi
MAVEN_OPTS+=" -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS" # https://stackoverflow.com/questions/5120470/how-to-time-the-different-stages-of-maven-execution/49494561#49494561
MAVEN_OPTS+=" -Xmx1024m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dhttps.protocols=TLSv1.3,TLSv1.2"
export MAVEN_OPTS
echo "MAVEN_OPTS: $MAVEN_OPTS"
if [[ ${ACT:-} == "true" ]]; then # when running locally using nektos/act
maven_args="-Djgit.dirtyWorkingTree=warning"
else
maven_args="--no-transfer-progress"
fi
# prevent "org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]" on Linux
${{ runner.os == 'Linux' && 'xvfb-run --auto-servernum --server-args="-screen 0 1600x900x24" \' || '' }}
mvn \
--errors \
--update-snapshots \
--batch-mode \
--show-version \
-Dtycho.disableP2Mirrors=true \
-Dsurefire.rerunFailingTestsCount=3 \
$maven_args \
${{ github.event.inputs.additional_maven_args }} \
clean verify || (
rc=$?
if [[ ${ACT:-} != "true" ]]; then
find . -path "*/target/work/data/.metadata/.log" | while IFS= read -r file; do
echo "::group::$file"
cat "$file"
echo "::endgroup::"
done
fi
exit $rc
)
uses: nick-fields/retry@v3
with:
max_attempts: 3
timeout_minutes: 10
shell: bash
command: |
set -eu
MAVEN_OPTS="${MAVEN_OPTS:-}"
if [[ "${{ runner.os }}" == "Windows" ]]; then
MAVEN_OPTS+=" -Djava.security.egd=file:/dev/urandom" # https://www.baeldung.com/java-security-egd#bd-testing-the-effect-of-javasecurityegd
else
MAVEN_OPTS+=" -Djava.security.egd=file:/dev/./urandom" # https://stackoverflow.com/questions/58991966/what-java-security-egd-option-is-for/59097932#59097932
fi
MAVEN_OPTS+=" -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS" # https://stackoverflow.com/questions/5120470/how-to-time-the-different-stages-of-maven-execution/49494561#49494561
MAVEN_OPTS+=" -Xmx1024m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dhttps.protocols=TLSv1.3,TLSv1.2"
export MAVEN_OPTS
echo "MAVEN_OPTS: $MAVEN_OPTS"

if [[ ${ACT:-} == "true" ]]; then # when running locally using nektos/act
maven_args="-Djgit.dirtyWorkingTree=warning"
else
maven_args="--no-transfer-progress"
fi

# prevent "org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]" on Linux
${{ runner.os == 'Linux' && 'xvfb-run --auto-servernum --server-args="-screen 0 1600x900x24" \' || '' }}
mvn \
--errors \
--update-snapshots \
--batch-mode \
--show-version \
-Dtycho.disableP2Mirrors=true \
-Dsurefire.rerunFailingTestsCount=3 \
$maven_args \
${{ github.event.inputs.additional_maven_args }} \
clean verify || (
rc=$?
if [[ ${ACT:-} != "true" ]]; then
find . -path "*/target/work/data/.metadata/.log" | while IFS= read -r file; do
echo "::group::$file"
cat "$file"
echo "::endgroup::"
done
fi
exit $rc
)


##################################################
Expand Down

0 comments on commit 0e16bf1

Please sign in to comment.