CICD代码运行

gitlab-ci.yml文件脚本

stages:
    - .pre
    - compile
    - test

compile: #noop
    stage: compile
    script: echo "Compile successful"
    rules:
        - when: on_success

compile-test:
    stage: test
    image: 'maven:3.6-openjdk-11-slim'
    variables:
        MAVEN_CLI_OPTS: '-s .m2/settings.xml'
        MAVEN_OPTS: '-Dmaven.repo.local=.m2/repository'
    script:
        - mvn clean
        - mvn test -Denv=all -Dplatform=api -DtestngXmlFile="src/main/resources/suite/all/all_api.xml"
    artifacts:
        paths:
            - target/
        expire_in: 1 day
    dependencies:
        - compile
    needs:
        - compile
    cache:
        key: M2_REPO
        paths:
            - .m2/repository/

1.提交代码后,自动触发脚本,执行任务,点击任务编号

CICD代码运行_第1张图片

 

2.进入任务界面,如果可以看见两个job,第一个是编译,第二个是执行测试

CICD代码运行_第2张图片

3.点击执行测试进入测试详情界面,可以点击右侧的Browse,查看生成的结果

 CICD代码运行_第3张图片

 4.生成的target文件夹如下图所示

CICD代码运行_第4张图片

 

 

你可能感兴趣的:(Java,自动化测试,html,前端)