stages: # List of stages for jobs, and their order of execution - build - test - coverage default: tags: - CREMI build-job: # This job runs in the build stage, which runs first. allow_failure: false stage: build script: - mkdir -p build - cd build - cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/c99-gcc .. - make VERBOSE=ON -j 18 | tee ./build.log artifacts: expire_in: 10 minutes paths: - build/ - build.log test-v1-job: # This job runs in the test stage. needs: - job: build-job artifacts: false stage: test # It only starts when the job in the build stage completes successfully. script: - mkdir -p build - echo "building project" - cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/c99-gcc .. - make VERBOSE=ON -j 18 | tee ./build.log - cd build - echo "Running tests V1..." - ctest -R v1 | tee ../test-v1-job.log artifacts: expire_in: 10 minutes paths: - build/ - test-v1-job.log test-v2-job: # This job runs in the test stage. needs: - job: test-v1-job artifacts: false stage: test # It only starts when the job in the build stage completes successfully. script: - mkdir -p build - echo "building project" - cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/c99-gcc .. - make VERBOSE=ON -j 18 | tee ./build.log - cd build - echo "Running tests V2..." - ctest -R v2 | tee ../test-v2-job.log artifacts: expire_in: 10 minutes paths: - build/ - test-v2-job.log ### coverage coverage-job: stage: coverage needs: - job: test-v2-job artifacts: false script: - mkdir -p build - echo "building project" - cd build - cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/c99-gcc .. - make VERBOSE=ON -j 18 - ctest -R v1 - ctest -R v2 - make ExperimentalCoverage - gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml --root ${CI_PROJECT_DIR} coverage: /^\s*lines:\s*\d+.\d+\%/ artifacts: name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA} expire_in: 2 days reports: cobertura: build/coverage.xml ### cleanup project for security issues cleanup: stage: .post script: - MYDIR=$(pwd) ; rm -rf $MYDIR ; mkdir $MYDIR - ls $MYDIR when: always