From 5c6d80f95b00aa03d1ba90fcc9187ddf15f3be12 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 18 Oct 2024 15:17:53 -0400 Subject: [PATCH] [CI/Build] Add error matching config for mypy (#9512) Signed-off-by: Amit Garg --- .github/workflows/matchers/mypy.json | 16 ++++++++++++++++ .github/workflows/mypy.yaml | 3 ++- tools/mypy.sh | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/matchers/mypy.json diff --git a/.github/workflows/matchers/mypy.json b/.github/workflows/matchers/mypy.json new file mode 100644 index 0000000000000..f048fce528941 --- /dev/null +++ b/.github/workflows/matchers/mypy.json @@ -0,0 +1,16 @@ +{ + "problemMatcher": [ + { + "owner": "mypy", + "pattern": [ + { + "regexp": "^(.+):(\\d+):\\s(error|warning):\\s(.+)$", + "file": 1, + "line": 2, + "severity": 3, + "message": 4 + } + ] + } + ] +} diff --git a/.github/workflows/mypy.yaml b/.github/workflows/mypy.yaml index 4b98324e3a812..5f1e5f8eeaf7d 100644 --- a/.github/workflows/mypy.yaml +++ b/.github/workflows/mypy.yaml @@ -32,4 +32,5 @@ jobs: pip install types-setuptools - name: Mypy run: | - tools/mypy.sh + echo "::add-matcher::.github/workflows/matchers/mypy.json" + tools/mypy.sh 1 diff --git a/tools/mypy.sh b/tools/mypy.sh index d69b61c7f34fc..14b0976a27da5 100755 --- a/tools/mypy.sh +++ b/tools/mypy.sh @@ -2,6 +2,10 @@ CI=${1:-0} +if [ $CI -eq 1 ]; then + set -e +fi + run_mypy() { echo "Running mypy on $1" if [ $CI -eq 1 ] && [ -z "$1" ]; then