2020-01-11 12:02:47 +00:00
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- test
|
|
|
|
- report
|
2019-11-30 05:54:01 +00:00
|
|
|
|
2020-01-11 12:02:47 +00:00
|
|
|
default:
|
|
|
|
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:31
|
|
|
|
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Test the formatting in a merge request using clang-format
|
|
|
|
##########################################################################
|
2019-12-03 14:58:51 +00:00
|
|
|
# The variable CI_COMMIT_BEFORE_SHA is not available in normal merge requests
|
|
|
|
# so we must build the commit hash ourselves, see:
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/issues/12850
|
2019-11-30 05:54:01 +00:00
|
|
|
test_formatting:
|
|
|
|
stage: test
|
2020-07-31 17:42:00 +00:00
|
|
|
needs: []
|
2020-01-11 12:02:47 +00:00
|
|
|
only:
|
|
|
|
- merge_requests
|
2019-12-04 20:10:23 +00:00
|
|
|
allow_failure: true
|
2020-01-11 12:02:47 +00:00
|
|
|
before_script:
|
|
|
|
# We must manually add the KiCad remote to ensure it is named sensibly
|
|
|
|
- git remote add product https://gitlab.com/kicad/code/kicad.git
|
2020-07-31 17:42:00 +00:00
|
|
|
- git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git
|
2020-01-11 12:02:47 +00:00
|
|
|
- git fetch -n product
|
2020-07-31 17:42:00 +00:00
|
|
|
- git fetch -n source
|
2020-01-11 12:02:47 +00:00
|
|
|
# Get the SHAs of the commits
|
|
|
|
- "TARGET_HEAD_SHA=$(git rev-parse product/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME})"
|
2020-07-31 17:42:00 +00:00
|
|
|
- "SOURCE_HEAD_SHA=$(git rev-parse source/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME})"
|
2020-01-11 12:02:47 +00:00
|
|
|
- "MERGE_BASE_SHA=$(git merge-base ${TARGET_HEAD_SHA} ${SOURCE_HEAD_SHA})"
|
2019-12-03 14:58:51 +00:00
|
|
|
script:
|
2019-12-03 18:51:59 +00:00
|
|
|
- echo "Testing formatting from commit ${MERGE_BASE_SHA}"
|
|
|
|
- ./tools/check_coding.sh --diff --ci --commit ${MERGE_BASE_SHA}
|
2020-01-11 12:02:47 +00:00
|
|
|
|
|
|
|
|
2020-07-17 18:42:14 +00:00
|
|
|
include:
|
|
|
|
- local: '/.gitlab/templates.yml'
|
|
|
|
- local: '/.gitlab/Fedora-Linux-CI.yml'
|
|
|
|
- local: '/.gitlab/coverity.yml'
|