From c3b5bf74371499122cfb9af5ab2b9c35ab59f425 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 5 Jul 2020 14:10:42 +0200 Subject: [PATCH] GitHub Actions: Add pytest problem matcher (#37508) --- .github/workflows/ci.yaml | 10 ++++++++++ .github/workflows/matchers/python.json | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .github/workflows/matchers/python.json diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d6b550d2a9f..3cdd1a3a39c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -712,6 +712,16 @@ jobs: run: | echo "Failed to restore Python virtual environment from cache" exit 1 + - name: Register Python problem matcher + run: | + echo "::add-matcher::.github/workflows/matchers/python.json" + - name: Install Pytest Annotation plugin + run: | + . venv/bin/activate + # Ideally this should be part of our dependencies + # However this plugin is fairly new and doesn't run correctly + # on a non-GitHub environment. + pip install pytest-github-actions-annotate-failures - name: Run pytest run: | . venv/bin/activate diff --git a/.github/workflows/matchers/python.json b/.github/workflows/matchers/python.json new file mode 100644 index 00000000000..3e5d8d5b8ba --- /dev/null +++ b/.github/workflows/matchers/python.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "owner": "python", + "pattern": [ + { + "regexp": "^\\s*File\\s\\\"(.*)\\\",\\sline\\s(\\d+),\\sin\\s(.*)$", + "file": 1, + "line": 2 + }, + { + "regexp": "^\\s*raise\\s(.*)\\(\\'(.*)\\'\\)$", + "message": 2 + } + ] + } + ] +}