Gitlab CI Test stage after build without rebuilding project

Hi Curtis Mahieu !

Sorry for answering late but I’m new to GitLab so I have just seen your question.

I had the same problem and after some research and tries I found the answer here : http://docs.gitlab.com/ce/ci/yaml/.

What you are looking for here are the parameters artifacts and dependencies.
artifacts parameter informs about the files and folders that must be kept after the job is done and dependencies informs about what job should be done (and succeeded) before starting the current one.

In your case, I think what you are looking at is:

build_local:
  type: build
  tags:
    - linux
  script: "cd build && cmake .. && make -j12"
  artifacts:
    paths:
      - build/


test_local:
  type: test
  tags:
    - linux
  script: "cd build && ctest -j12"
  dependencies:
    - build_local
  artifacts:
    paths:
      - build/

analyze_local:
  type: analyze
  tags:
    - linux
    - sonar
  only:
    - master
  script: "cd build && make sonar"
  dependencies:
    - test_local

Maybe you should specify the files you want to keep instead of all the build directory because you may not need all the generated files.

Hope that helped you or will help someone in the future!

Abagnale.