diff options
author | Thomas Haller <thaller@redhat.com> | 2020-11-10 10:47:04 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-11-10 13:51:29 +0100 |
commit | 7fa122394cd8036913b6082646783c37c8d092b2 (patch) | |
tree | 2c3e1a3fd14a06469e6866400baaecf9870f4bd9 | |
parent | a5d92d78c628e8c5771c57f7818013146a05ae96 (diff) | |
download | NetworkManager-7fa122394cd8036913b6082646783c37c8d092b2.tar.gz |
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".
-rw-r--r-- | .gitlab-ci.yml | 39 | ||||
-rw-r--r-- | .gitlab-ci/ci.template | 40 | ||||
-rwxr-xr-x | .gitlab-ci/fedora-install.sh | 5 |
3 files changed, 37 insertions, 47 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f101ca2f91..12fb5b9f6d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template index eb8b67502e..e2291bf036 100644 --- a/.gitlab-ci/ci.template +++ b/.gitlab-ci/ci.template @@ -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 diff --git a/.gitlab-ci/fedora-install.sh b/.gitlab-ci/fedora-install.sh index d48fd397a6..6b4fce0e74 100755 --- a/.gitlab-ci/fedora-install.sh +++ b/.gitlab-ci/fedora-install.sh @@ -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 |