美文网首页
Gradle项目的Gitlab CI配置样例

Gradle项目的Gitlab CI配置样例

作者: EagleYan | 来源:发表于2020-06-11 17:41 被阅读0次

    A sample of .gitlab-ci.yml for a gradle project

    image: java:8-jdk
    
    stages:
      - build
      - test
      - deploy
    
    before_script:
    #  - echo `pwd` # debug
    #  - echo "$CI_BUILD_NAME, $CI_BUILD_REF_NAME $CI_BUILD_STAGE" # debug
      - export GRADLE_USER_HOME=`pwd`/.gradle
    
    cache:
      paths:
        - .gradle/wrapper
        - .gradle/caches
    
    build:
      stage: build
      script:
        - ./gradlew assemble
      artifacts:
        paths:
          - build/libs/*.jar
        expire_in: 1 week
      only:
        - master
    
    test:
      stage: test
      script:
        - ./gradlew check
    
    deploy:
      stage: deploy
      script:
        - ./deploy
    
    after_script:
      - echo "End CI"
    

    参考:
    https://gist.github.com/daicham/5ac8461b8b49385244aa0977638c3420
    https://forum.gitlab.com/t/using-gradle-for-ci/23491

    相关文章

      网友评论

          本文标题:Gradle项目的Gitlab CI配置样例

          本文链接:https://www.haomeiwen.com/subject/ketitktx.html