.gitlab-ci.yml 파일에 테스트 단계 추가

다음을 수행하여 .gitlab-ci.yml 파일에 테스트 단계 및 maven-test Job을 추가합니다.

  • git pull 명령을 실행하여 원격 저장소에서 .gitlab-ci.yml 파일을 가져 옵니다.

    git pull
  • STS에서 .gitlab-ci.yml 파일을 엽니다.

  • stages- test을 추가하고 maven-test Job을 추가하여 아래와 같이 수정합니다.

    stages:
      - build
      - test
    
    maven-build:
      image: maven:3.6.3-openjdk-11
      stage: build
      script: "./mvnw clean compile"
    
    maven-test:
      image: maven:3.6.3-openjdk-11
      stage: test
      script: "./mvnw test"
  • 아래 명령을 수행하여 GitLab에 Push합니다.

    git add .
    git commit -m "Add Test stage & job"
    git push