有没有办法检查grails测试应用程序是否在travis CI上返回错误?

时间:2018-11-20 04:31:26

标签: grails groovy travis-ci travis-ci-cli

我正在为我的grails项目创建Travis CI / CD。当我们执行grails测试应用程序时,如果测试应用程序有任何错误,我希望部署停止。

我的travis.yml文件看起来像这样

dist: trusty
sudo: true
addons:
    chrome: stable
before_cache:
    -  rm -f $HOME/.gradle/caches/modules-2/module-2.lock
cache:
    directories:
            - $HOME/.gradle/caches/
            - $HOME/.gradle/wrapper/
language: groovy
jdk:
    - openjdk7
services:
    - mysql
script: "./travis-build.sh"
before_install:
    -  chmod +x travis-build.sh
    -  mysql -e 'CREATE DATABASE IF NOT EXISTS customer';
before_script:
    -  rm -rf target
deploy:
    - provider: s3
      access_key_id: $AWS_ACCESS_KEY
      secret_access_key: $AWS_SECRET_KEY
      local_dir: target
      skip_cleanup: true
      on:
        branch: travis
      bucket: bucket-name
      region: "region-here"
    - provider: codedeploy
      access_key_id: $AWS_ACCESS_KEY
      secret_access_key: $AWS_SECRET_KEY
      bucket: buckentname
      key: customer-0.1.war
      application: customer
      deployment_group: groupNameHere
      region: "region-here"
      on:
        branch: travis

travis-build.sh文件如下所示:         #!/ bin / bash

    EXIT_STATUS=0


    ./grailsw refresh-dependencies --non-interactive 
    ./grailsw compile --non-interactive
    ./grailsw test-app :unit --non-interactive
    ./grailsw war --non-interactive

    exit $EXIT_STATUS

在执行grailsw test-app时,如果构建失败,我想停止部署。有办法吗?

0 个答案:

没有答案