From c79120def25bedad764474ffe77bf2406da76b15 Mon Sep 17 00:00:00 2001 From: Sebastian Thomschke Date: Wed, 10 Jul 2024 16:33:47 +0200 Subject: [PATCH] ci: enable Windows target and 2 retries of maven build step on failure --- .github/workflows/build.yml | 93 +++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7a4881c8..459a30c2b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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" @@ -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 + ) ##################################################