gitlab-ci: merge "check-ci-script" test with static checks

Certain parts of the code are entirely generated or must follow
a certain format that can be enforced by a tool. These invariants
must never fail:

  - ci-fairy generate-template (check-ci-script)
  - black python formatting
  - clang-format C formatting
  - msgfmt -vs

On the other hand, we also have a checkpatch script that checks
the current patch for common errors. These are heuristics and
only depend on the current patch (contrary to the previous type
that depend on the entire source tree).

Refactor the gitlab-ci tests:

- split "checkpatch" into "check-patch" and "check-tree".

- merge the "check-ci-script" test into "check-tree".
This commit is contained in:
Thomas Haller 2020-11-10 10:47:04 +01:00
parent a5d92d78c6
commit 7fa122394c
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
3 changed files with 37 additions and 47 deletions

View file

@ -59,26 +59,9 @@ variables:
- NetworkManager-1*.tar.xz
- NetworkManager-1*.src.rpm
#################################################################
# #
# prep stage #
# #
#################################################################
# Re-generate the .gitlab-ci.yml file and make sure it's the one currently checked in
# If this job fails, re-generate the gitlab-ci.yml script and git commit it.
#
check-ci-script:
image: golang:alpine
stage: prep
before_script:
- apk add python3 py-pip git
- pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script:
- ci-fairy generate-template
- git diff --exit-code && exit 0 || true
- echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
- exit 1
.nm_artifacts_undo:
artifacts:
paths: []
#################################################################
# #
@ -778,16 +761,26 @@ t_centos:8.1.1911:
# specific jobs #
# #
#################################################################
checkpatch:
check-patch:
extends:
- t_fedora:33
- .nm_artifacts_undo
stage: test
script:
- date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh
allow_failure: true
check-tree:
extends:
- t_fedora:33
- .nm_artifacts_undo
stage: test
script:
- date '+%Y%m%d-%H%M%S'; black --check . examples/python/gi/nm-wg-set
- date '+%Y%m%d-%H%M%S'; git ls-files -z -- 'po/*.po' | xargs -0 -n1 msgfmt -vc
- date '+%Y%m%d-%H%M%S'; contrib/scripts/nm-code-format.sh
- date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh
allow_failure: true
- date '+%Y%m%d-%H%M%S'; ci-fairy generate-template && git diff --exit-code
pages:
stage: deploy

View file

@ -49,26 +49,9 @@ variables:
- NetworkManager-1*.tar.xz
- NetworkManager-1*.src.rpm
#################################################################
# #
# prep stage #
# #
#################################################################
# Re-generate the .gitlab-ci.yml file and make sure it's the one currently checked in
# If this job fails, re-generate the gitlab-ci.yml script and git commit it.
#
check-ci-script:
image: golang:alpine
stage: prep
before_script:
- apk add python3 py-pip git
- pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script:
- ci-fairy generate-template
- git diff --exit-code && exit 0 || true
- echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
- exit 1
.nm_artifacts_undo:
artifacts:
paths: []
#################################################################
# #
@ -192,17 +175,26 @@ t_{{distro.name}}:{{version}}:
# specific jobs #
# #
#################################################################
checkpatch:
check-patch:
extends:
{# run checkpatch on the same image that generates pages because why not #}
- t_{{pages_build.name}}:{{pages_build.version}}
- .nm_artifacts_undo
stage: test
script:
- date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh
allow_failure: true
check-tree:
extends:
- t_{{pages_build.name}}:{{pages_build.version}}
- .nm_artifacts_undo
stage: test
script:
- date '+%Y%m%d-%H%M%S'; black --check . examples/python/gi/nm-wg-set
- date '+%Y%m%d-%H%M%S'; git ls-files -z -- 'po/*.po' | xargs -0 -n1 msgfmt -vc
- date '+%Y%m%d-%H%M%S'; contrib/scripts/nm-code-format.sh
- date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh
allow_failure: true
- date '+%Y%m%d-%H%M%S'; ci-fairy generate-template && git diff --exit-code
pages:
stage: deploy

View file

@ -46,3 +46,8 @@ contrib/scripts/nm-ci-patch-gtkdoc.sh || true
if [ -x /usr/bin/ninja ] && ! [ -x /usr/bin/ninja-build ]; then
ln -s /usr/bin/ninja-build /usr/bin/ninja
fi
if [ $IS_FEDORA = 1 ]; then
dnf install -y python3-pip
pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
fi