Windows build hangs after Done exit 0

My build for Windows fails to stop after successful build.

My .travis.yml is as follows:

matrix:
  include:
    - os: linux
      language: java
      sudo: false # for faster builds
      jdk: openjdk11
    - os: osx
      language: java
      sudo: false # for faster builds
      jdk: openjdk11
    - os: windows
      language: c # 'java' not supported, 'generic' causes VM to hang on boot.
      sudo: false # for faster builds
before_script:
  - |
    if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
      choco install -y openjdk --version 11.0
      export JAVA_HOME="/c/Program Files/OpenJDK/jdk-11"
      export PATH="$JAVA_HOME/bin:$PATH"
      gem install bundle
    fi
  - chmod +x gradlew
script:
  - |
    if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then
      ./gradlew check
      ./gradlew test jacocoTestReport
    fi
  - ./gradlew jar
  - java -jar build/http-server.jar &
  - cd acceptance-tests
  - bundle install
  - bundle exec spinach
  - kill %1
  - cd ..
after_success:
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then bash <(curl -s https://codecov.io/bash); fi
  - travis_terminate 0 # try to make Windows quit

Any thoughts or suggestions to fix this?

The problem seems to be related to the Gradle Daemon which continues running in the background even after your build is finished.

You can add the following command to your before_script section to disable the daemon:
export GRADLE_OPTS=-Dorg.gradle.daemon=false

For me this solved the exact issue you are describing.

Ah ha! That’s sorted it. Thanks very much, very helpful.

I have exactly the same issue using a node_js build… so no Gradle involved in this one! Build is here

My .travis.yml:

dist: xenial
osx_image: xcode10.1

language: node_js
node_js: "8"

env:
  global:
    - ELECTRON_CACHE=$HOME/.cache/electron
    - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder

os:
  - linux
  - osx
  - windows

cache:
  directories:
  - node_modules
  - $HOME/.cache/electron
  - $HOME/.cache/electron-builder
  - $HOME/.npm/_prebuilds

before_install:
  - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.2.1
  - export PATH=$HOME/.yarn/bin:$PATH
  - node --version && yarn --version && python --version

install:
  - yarn

script:
  - yarn run sass

before_cache:
  - rm -rf $HOME/.cache/electron-builder/wine
2 Likes

see Timeout after build finished (and succeeded)

@AviVahl thanks that does enable the build to now complete on Windows. However the Windows build takes 20 minutes, where the Linux build takes 2 minutes. The build on Windows seems to stall for a very long period of time related to storing cached assets. Any ideas?

Yeah, the Windows builds are much slower for us as well. yarn install takes forever. Appears to disconnect/retry several times until it succeeds.

Same here for nodejs build. However the exit status is (0/1), it is not reported and ends after timeout. May be worth to report as seperate issue, will do in the next few days.

You may consider using Gravis-CI to deal with the Travis Java environment configuration. It also pre-configures Gradle for not using the daemon under Windows.

1 Like