Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Update the GitLab CI integration guide #4234

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions docs/gitlab_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ within each project. Create this file in your project root directory:

```yml
code_quality:
allow_failure: false
script:
- bash .gitlab/ci/run_codechecker.sh
after_script:
Expand All @@ -39,6 +38,7 @@ code_quality:
codequality: gl-code-quality-report.json
paths: [gl-code-quality-report.json]
expire_in: '2 mos'
expose_as: 'Code Quality Report'
stage: test
```

Expand All @@ -47,6 +47,9 @@ expire and are therefore deleted. You can set it to a lower or a higher value.
For more information
[see](https://docs.gitlab.com/ee/ci/yaml/README.html#artifactsexpire_in).

`expose_as` makes the report JSON file downloadable directly from the ongoing
merge requests.

Script is a shell script which will be executed by the Runner.

# 3. Create a script to run CodeChecker analysis
Expand Down Expand Up @@ -74,9 +77,9 @@ CodeChecker parse \
-e codeclimate \
./reports > gl-code-quality-report.json

# Exit with status code 1 if there is any report in the output file.
status=$(cat gl-code-quality-report.json)
if [[ -n "$status" && "$status" != "[]" ]]; then
# Exit with status code 1 if the report file was not generated.
if [ ! -f "gl-code-quality-report.json" ]; then
echo Report file (gl-code-quality-report.json) does not exist."
exit 1
fi
```
Expand Down Expand Up @@ -106,17 +109,11 @@ CodeChecker cmd diff \
out_file="codeclimate/codeclimate_issues.json"

if [ ! -f "$out_file" ]; then
echo "${out_file} does not exists."
echo "Report file (${out_file}) does not exist."
exit 1
fi

cp $out_file gl-code-quality-report.json

# Exit with status code 1 if there is any report in the output file.
status=$(cat gl-code-quality-report.json)
if [[ -n "$status" && "$status" != "[]" ]]; then
exit 1
fi
```

# 4. Create a merge request
Expand Down
Loading