Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add problem matchers #7122

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/problem-matchers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Problem Matchers

GitHub [Problem
Matchers](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md)
are a mechanism that enable workflow steps to scan the outputs of GitHub
Actions for regex patterns and automatically write annotations in the workflow
summary page. Using Problem Matchers allows information to be displayed more
prominently in the GitHub user interface.

This directory contains Problem Matchers used by the GitHub Actions workflows
in the [`workflows`](./workflows) subdirectory.

## Original sources

The Pylint and YAML file problem matchers found in this directory were copied
from the [Home Assistant](https://github.com/home-assistant/core) project on
GitHub. The Home Assistant project is licensed under the Apache 2.0 open-source
license. The version of the files at the time they were copied was 2025.1.2.

- [`pylint.json`](https://github.com/home-assistant/core/blob/dev/.github/workflows/matchers/pylint.json)
- [`yamllint.json`](https://github.com/home-assistant/core/blob/dev/.github/workflows/matchers/yamllint.json)

The Mypy and Pytest problem matchers files originally came from the
[gh-problem-matcher-wrap](https://github.com/liskin/gh-problem-matcher-wrap/tree/master/problem-matchers)
repository (copied 2025-03-04, version 3.0.0), and were subsequently modified by
Michael Hucka. The original JSON files are Copyright © 2020 Tomáš Janoušek and
made available under the terms of the MIT license.

- [`mypy.json`](https://github.com/liskin/gh-problem-matcher-wrap/blob/master/problem-matchers/mypy.json)
- [`pytest.json`](https://github.com/liskin/gh-problem-matcher-wrap/blob/master/problem-matchers/pytest.json)

The following problem matcher for Black came from a fork of the
[MLflow](https://github.com/mlflow/mlflow) project by user Sumanth077 on GitHub.
The MLflow project is licensed under the Apache 2.0 open-source license. The
version of the file copied was dated 2022-05-29.

- [`black.json`](https://github.com/Sumanth077/mlflow/blob/problem-matcher-for-black/.github/workflows/matchers/black.json)

The Shellcheck problem matcher JSON file came from the
[shellcheck-problem-matchers](uhttps://github.com/lumaxis/shellcheck-problem-matchers)
repository (copied 2025-02-26, version v2.1.0).

- [`shellcheck-tty.json`](https://github.com/lumaxis/shellcheck-problem-matchers/blob/main/.github/shellcheck-tty.json)
15 changes: 15 additions & 0 deletions .github/problem-matchers/black.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"problemMatcher": [
{
"owner": "black",
"severity": "error",
"pattern": [
{
"regexp": "^(would reformat) (.+)$",
"file": 2,
"message": 1
}
]
}
]
}
19 changes: 19 additions & 0 deletions .github/problem-matchers/mypy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"problemMatcher": [
{
"owner": "mypy",
"severity": "error",
"pattern": [
{
"regexp": "^([^:]*):(\\d+):(?:(\\d+):)?\\s(error|warning): (.*?)(?: \\[(\\S+)\\])?$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
"code": 6
}
]
}
]
}
32 changes: 32 additions & 0 deletions .github/problem-matchers/pylint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"problemMatcher": [
{
"owner": "pylint-error",
"severity": "error",
"pattern": [
{
"regexp": "^(.+):(\\d+):(\\d+):\\s(([EF]\\d{4}):\\s.+)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5
}
]
},
{
"owner": "pylint-warning",
"severity": "warning",
"pattern": [
{
"regexp": "^(.+):(\\d+):(\\d+):\\s(([CRW]\\d{4}):\\s.+)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5
}
]
}
]
}
16 changes: 16 additions & 0 deletions .github/problem-matchers/pytest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"problemMatcher": [
{
"owner": "pytest",
"severity": "error",
"pattern": [
{
"regexp": "^(\\S+):(\\d+): (.*)$",
"file": 1,
"line": 2,
"message": 3
}
]
}
]
}
24 changes: 24 additions & 0 deletions .github/problem-matchers/shellcheck.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"problemMatcher": [
{
"owner": "shellcheck",
"pattern": [
{
"regexp": "^In\\s(.+)\\sline\\s(\\d+):$",
"file": 1,
"line": 2
},
{
"regexp": ".*"
},
{
"regexp": "SC(\\d+)(\\s\\((note|warning|error)\\))?:\\s(.+)$",
"code": 1,
"severity": 3,
"message": 4,
"loop": true
}
]
}
]
}
22 changes: 22 additions & 0 deletions .github/problem-matchers/yamllint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"problemMatcher": [
{
"owner": "yamllint",
"pattern": [
{
"regexp": "^(.*\\.ya?ml)$",
"file": 1
},
{
"regexp": "^\\s{2}(\\d+):(\\d+)\\s+(error|warning)\\s+(.*?)\\s+\\((.*)\\)$",
"line": 1,
"column": 2,
"severity": 3,
"message": 4,
"code": 5,
"loop": true
}
]
}
]
}
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
architecture: 'x64'
- name: Install dependencies
run: pip install -r dev_tools/requirements/deps/format.txt
- name: Set up problem matcher for Black output
run: echo '::add-matcher::.github/problem-matchers/black.json'
- name: Format
run: check/format-incremental
mypy:
Expand All @@ -77,6 +79,8 @@ jobs:
architecture: 'x64'
- name: Install mypy
run: pip install -r dev_tools/requirements/mypy.env.txt
- name: Set up problem matcher for Mypy output
run: echo '::add-matcher::.github/problem-matchers/mypy.json'
- name: Type check
run: check/mypy
changed_files:
Expand All @@ -94,6 +98,8 @@ jobs:
architecture: 'x64'
- name: Install changed files test dependencies
run: dev_tools/conf/pip-install-minimal-for-pytest-changed-files.sh
- name: Set up problem matcher for Pytest output
run: echo '::add-matcher::.github/problem-matchers/pytest.json'
- name: Changed files test
run: check/pytest-changed-files -n auto
lint:
Expand All @@ -109,6 +115,8 @@ jobs:
architecture: 'x64'
- name: Install pylint
run: pip install -r dev_tools/requirements/pylint.env.txt
- name: Set up problem matcher for Pylint output
run: echo '::add-matcher::.github/problem-matchers/pylint.json'
- name: Display version
run: check/pylint --version
- name: Lint
Expand Down Expand Up @@ -151,6 +159,8 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Set up problem matcher for Shellcheck output
run: echo '::add-matcher::.github/problem-matchers/shellcheck.json'
- name: Run shellcheck
run: check/shellcheck
isolated-modules:
Expand All @@ -166,6 +176,8 @@ jobs:
architecture: 'x64'
- name: Install dependencies
run: pip install -r dev_tools/requirements/isolated-base.env.txt
- name: Set up problem matcher for Pytest output
run: echo '::add-matcher::.github/problem-matchers/pytest.json'
- name: Test each module in isolation
run: pytest -n auto --enable-slow-tests dev_tools/packaging/isolated_packages_test.py
pytest:
Expand Down Expand Up @@ -197,6 +209,8 @@ jobs:
pip install --upgrade --upgrade-strategy eager -r dev_tools/requirements/dev.env.txt
- name: Run Quil dependencies
run: docker compose -f cirq-rigetti/docker-compose.test.yaml up -d
- name: Set up problem matcher for Pytest output
run: echo '::add-matcher::.github/problem-matchers/pytest.json'
- name: Pytest check
run: check/pytest -n auto --durations=20 --ignore=cirq-core/cirq/contrib --rigetti-integration
- name: Stop Quil dependencies
Expand Down Expand Up @@ -229,6 +243,8 @@ jobs:
run: |
pip install wheel
pip install --upgrade --upgrade-strategy eager -r dev_tools/requirements/dev-np2.env.txt
- name: Set up problem matcher for Pytest output
run: echo '::add-matcher::.github/problem-matchers/pytest.json'
- name: Pytest check
run: check/pytest -n auto --warn-numpy-data-promotion --durations=20 --ignore=cirq-rigetti
pip-compile:
Expand Down Expand Up @@ -324,6 +340,8 @@ jobs:
run: |
pip install wheel
pip install --upgrade --upgrade-strategy eager -r dev_tools/requirements/no-contrib.env.txt
- name: Set up problem matcher for Pytest output
run: echo '::add-matcher::.github/problem-matchers/pytest.json'
- name: Pytest Windows
run: |
source dev_tools/pypath
Expand Down Expand Up @@ -352,6 +370,8 @@ jobs:
run: |
pip install wheel
pip install --upgrade --upgrade-strategy eager -r dev_tools/requirements/no-contrib.env.txt
- name: Set up problem matcher for Pytest output
run: echo '::add-matcher::.github/problem-matchers/pytest.json'
- name: Pytest check
run: check/pytest -n auto --durations=20 --ignore=cirq-core/cirq/contrib
notebooks-stable:
Expand All @@ -375,6 +395,8 @@ jobs:
architecture: 'x64'
- name: Install requirements
run: pip install -r dev_tools/requirements/isolated-base.env.txt
- name: Set up problem matcher for Pytest output
run: echo '::add-matcher::.github/problem-matchers/pytest.json'
- name: Notebook tests
run: check/pytest -n auto -m slow dev_tools/notebooks/isolated_notebook_test.py -k ${{matrix.partition}}
- name: Persist the outputs
Expand All @@ -396,6 +418,8 @@ jobs:
architecture: 'x64'
- name: Install requirements
run: pip install -r dev_tools/requirements/notebooks.env.txt
- name: Set up problem matcher for Pytest output
run: echo '::add-matcher::.github/problem-matchers/pytest.json'
- name: Notebook tests
run: check/pytest -n auto -m slow dev_tools/notebooks/notebook_test.py
- name: Persist the outputs
Expand Down