diff --git a/build/build-clang/civet-tidy-linux64.json b/build/build-clang/civet-tidy-linux64.json new file mode 100644 index 000000000000..55382875b1cd --- /dev/null +++ b/build/build-clang/civet-tidy-linux64.json @@ -0,0 +1,17 @@ +{ + "stages": "1", + "build_libcxx": true, + "build_type": "Release", + "assertions": false, + "build_clang_tidy": true, + "python_path": "/usr/bin/python2.7", + "gcc_dir": "{MOZ_FETCHES_DIR}/gcc", + "cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc", + "cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++", + "as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc", + "patches": [ + "clang-tidy-ci.patch", + "clang-tidy-no-errors.patch" + ], + "build_clang_tidy_external": true +} diff --git a/taskcluster/ci/fetch/toolchains.yml b/taskcluster/ci/fetch/toolchains.yml index b8a4e3fc91fc..b1acb01cb145 100644 --- a/taskcluster/ci/fetch/toolchains.yml +++ b/taskcluster/ci/fetch/toolchains.yml @@ -424,6 +424,14 @@ clang-10: repo: https://github.com/llvm/llvm-project revision: d32170dbd5b0d54436537b6b75beaf44324e0c28 +civet-source: + description: Repository for external static analysis checks + fetch: + type: git + repo: git@github.com:mozilla-services/civet.git + revision: 1a7a27f0a3bede8f94ac1e7c73f400de797296b5 + ssh-key: project/civet/github-deploy-key + wasi-sdk: description: wasi-sdk source code fetch: diff --git a/taskcluster/ci/source-test/clang.yml b/taskcluster/ci/source-test/clang.yml index 7675b1223242..17277eb7ee95 100644 --- a/taskcluster/ci/source-test/clang.yml +++ b/taskcluster/ci/source-test/clang.yml @@ -24,7 +24,6 @@ job-defaults: fetches: toolchain: - linux64-clang - - linux64-clang-tidy - linux64-rust - linux64-cbindgen - linux64-nasm @@ -52,7 +51,9 @@ tidy: command: >- source taskcluster/scripts/misc/source-test-clang-setup.sh && ./mach --log-no-times static-analysis check --outgoing --output $HOME/clang-tidy.json --format json - + fetches: + toolchain: + - linux64-clang-tidy worker: artifacts: - type: file @@ -69,6 +70,9 @@ format: source taskcluster/scripts/misc/source-test-clang-setup.sh && ./mach --log-no-times clang-format --outgoing --output $HOME/clang-format.json --format json && ./mach --log-no-times clang-format --outgoing --output $HOME/clang-format.diff --format diff + fetches: + toolchain: + - linux64-clang-tidy worker: artifacts: - type: file @@ -77,3 +81,23 @@ format: - type: file name: public/code-review/clang-format.diff path: /builds/worker/clang-format.diff + +civet: + description: Run static-analysis (clang-tidy) on C/C++ patches with external checks + attributes: + code-review: false + treeherder: + symbol: cpp(clang-civet) + run: + cwd: '{checkout}' + command: >- + source taskcluster/scripts/misc/source-test-clang-setup.sh && + ./mach --log-no-times static-analysis check --checks="-*,mozilla-civet-*" --outgoing --output $HOME/clang-tidy.json --format json + fetches: + toolchain: + - linux64-civet-tidy + worker: + artifacts: + - type: file + name: public/code-review/clang-tidy.json + path: /builds/worker/clang-tidy.json diff --git a/taskcluster/ci/toolchain/clang-tidy.yml b/taskcluster/ci/toolchain/clang-tidy.yml index 72a63386f589..cbc7c58c6b7c 100644 --- a/taskcluster/ci/toolchain/clang-tidy.yml +++ b/taskcluster/ci/toolchain/clang-tidy.yml @@ -92,3 +92,27 @@ win64-clang-tidy: fetch: - cmake - ninja + +linux64-civet-tidy: + index: + job-name: linux64-civet-tidy + treeherder: + symbol: TL(linux64-civet-tidy) + worker: + artifacts: + - name: project/civet/clang-tidy.tar.zst + path: /builds/worker/private-artifacts/clang-tidy.tar.zst + type: file + run: + toolchain-artifact: project/civet/clang-tidy.tar.zst + script: build-civet.sh + arguments: + - 'build/build-clang/civet-tidy-linux64.json' + resources: + - 'build/build-clang/civet-tidy-linux64.json' + fetches: + fetch: + - civet-source + toolchain: + - linux64-binutils + - linux64-gcc-7 diff --git a/taskcluster/scripts/misc/build-civet.sh b/taskcluster/scripts/misc/build-civet.sh new file mode 100755 index 000000000000..844a558fa2c1 --- /dev/null +++ b/taskcluster/scripts/misc/build-civet.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -x + +# Because we specify a private artifact, UPLOAD_DIR is not populated for us +export UPLOAD_DIR="/builds/worker/private-artifacts/" + +# # Delete the external directory +rm -rf $GECKO_PATH/build/clang-plugin/external/* + +# # Move civet into its place +cp -r $MOZ_FETCHES_DIR/civet.git/* $GECKO_PATH/build/clang-plugin/external + +# Call build-clang.sh with this script's first argument (our JSON config) +$GECKO_PATH/taskcluster/scripts/misc/build-clang.sh $1