This repository has been archived on 2026-10-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
lightup/.gitlab-ci.yml

167 lines
4.2 KiB
YAML

stages: # List of stages for jobs, and their order of execution
- build
- test
- clang
- coverage
default:
tags:
- shell
- CREMI
workflow:
rules:
- if: $CI_COMMIT_MESSAGE =~ /-draft$/
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
build-job-debug: # 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.log
build-job-release: # 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=RELEASE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/c99-gcc ..
- make VERBOSE=ON -j 18 | tee ../build.log
artifacts:
expire_in: 10 minutes
paths:
- build.log
test-v1-job: # This job runs in the test stage.
needs:
- job: build-job-release
artifacts: false
- job: build-job-debug
artifacts: false
stage: test # It only starts when the job in the build stage completes successfully.
script:
- mkdir -p build
- cd build
- echo "building project"
- cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/c99-gcc ..
- make VERBOSE=ON -j 18
- echo "Running tests V1..."
- ctest -R v1 | tee ../test-v1-job.log
artifacts:
expire_in: 10 minutes
paths:
- test-v1-job.log
test-v2-job: # This job runs in the test stage.
needs:
- job: build-job-release
artifacts: false
- job: build-job-debug
artifacts: false
stage: test # It only starts when the job in the build stage completes successfully.
script:
- mkdir -p build
- cd build
- echo "building project"
- cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/c99-gcc ..
- make VERBOSE=ON -j 18
- echo "Running tests V2..."
- ctest -R v2 | tee ../test-v2-job.log
artifacts:
expire_in: 10 minutes
paths:
- test-v2-job.log
make-test-job:
needs:
- job: build-job-release
artifacts: false
- job: build-job-debug
artifacts: false
stage: test
script:
- mkdir -p build
- cd build
- echo "building project"
- cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/c99-gcc ..
- make VERBOSE=ON -j 18
- echo "Running tests ..."
- make test | tee ../make-test-job.log
allow_failure: true
artifacts:
expire_in: 10 minutes
paths:
- make-test-job.log
mem-check-job:
needs:
- job: make-test-job
artifacts: false
stage: test
script:
- mkdir -p build
- cd build
- echo "building project"
- cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/c99-gcc ..
- make VERBOSE=ON -j 18
- echo "Running Memory Checks..."
- make ExperimentalMemCheck | tee ../mem-check-job.log
artifacts:
expire_in: 10 minutes
paths:
- mem-check-job.log
### clang
clang-job:
needs:
- job: build-job-release
artifacts: false
- job: build-job-debug
artifacts: false
stage: clang
script:
- if [ $(clang-format -style=file -output-replacements-xml *.[c\|h] | grep -c "<replacement ") -eq 0 ]; then exit 0; else exit 1; fi
### coverage
coverage-job:
tags:
- shell
needs:
- job: build-job-release
artifacts: false
- job: build-job-debug
artifacts: false
stage: coverage
script:
- mkdir -p build
- cd build
- echo "building project"
- cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/c99-gcc ..
- make VERBOSE=ON -j 18
- make test
- make ExperimentalCoverage
- gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml --root ${CI_PROJECT_DIR}
allow_failure: true
coverage: /^\s*lines:\s*\d+.\d+\%/
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
expire_in: 2 days
### cleanup project for security issues
cleanup:
stage: .post
script:
- MYDIR=$(pwd) ; rm -rf $MYDIR ; mkdir $MYDIR
- ls $MYDIR
when: always