Fix test formatting CI and change pipeline ordering

Gitlab 13.3 changed so now pipelines started by developers run
inside the main repo, even for MRs. So we must explicitly add
the source repo to the git environment and use it.

Also, explictily say the formatting test doesn't need any other jobs
so that it will run in parallel with the main build, otherwise it
won't run until the test stage starts.
This commit is contained in:
Ian McInerney 2020-07-31 18:42:00 +01:00
parent 61c817377f
commit f9819a004a
1 changed files with 4 additions and 2 deletions

View File

@ -15,17 +15,19 @@ default:
# https://gitlab.com/gitlab-org/gitlab/issues/12850
test_formatting:
stage: test
needs: []
only:
- merge_requests
allow_failure: true
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
- git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git
- git fetch -n product
- git fetch -n origin
- git fetch -n source
# Get the SHAs of the commits
- "TARGET_HEAD_SHA=$(git rev-parse product/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME})"
- "SOURCE_HEAD_SHA=$(git rev-parse origin/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME})"
- "SOURCE_HEAD_SHA=$(git rev-parse source/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME})"
- "MERGE_BASE_SHA=$(git merge-base ${TARGET_HEAD_SHA} ${SOURCE_HEAD_SHA})"
script:
- echo "Testing formatting from commit ${MERGE_BASE_SHA}"