Skip to content

Commit 1d5eaec

Browse files
authored
Merge branch 'main' into mh-add-scorecard
2 parents 70f0aea + 2a89ac8 commit 1d5eaec

File tree

6 files changed

+104
-13
lines changed

6 files changed

+104
-13
lines changed

.github/problem-matchers/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Problem Matchers
2+
3+
GitHub [Problem
4+
Matchers](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md)
5+
are a mechanism that enable workflow steps to scan the outputs of GitHub
6+
Actions for regex patterns and automatically write annotations in the workflow
7+
summary page. Using Problem Matchers allows information to be displayed more
8+
prominently in the GitHub user interface.
9+
10+
This directory contains Problem Matchers used by the GitHub Actions workflows
11+
in the [`workflows`](./workflows) subdirectory.
12+
13+
The following problem matcher JSON file for Pylint was copied from the [Home
14+
Assistant](https://github.com/home-assistant/core) project on GitHub. The Home
15+
Assistant project is licensed under the Apache 2.0 open-source license. The
16+
versions of the file at the time it was copied was 2025.1.2.
17+
18+
- [`pylint.json`](https://github.com/home-assistant/core/blob/dev/.github/workflows/matchers/pylint.json)
19+
20+
The following problem matcher for Black came from a fork of the
21+
[MLflow](https://github.com/mlflow/mlflow) project by user Sumanth077 on
22+
GitHub. The MLflow project is licensed under the Apache 2.0 open-source
23+
license. The version of the file copied was dated 2022-05-29.
24+
25+
- [`black.json`](https://github.com/Sumanth077/mlflow/blob/problem-matcher-for-black/.github/workflows/matchers/black.json)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "black",
5+
"severity": "error",
6+
"pattern": [
7+
{
8+
"regexp": "^(would reformat) (.+)$",
9+
"file": 2,
10+
"message": 1
11+
}
12+
]
13+
}
14+
]
15+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "pylint-error",
5+
"severity": "error",
6+
"pattern": [
7+
{
8+
"regexp": "^(.+):(\\d+):(\\d+):\\s(([EF]\\d{4}):\\s.+)$",
9+
"file": 1,
10+
"line": 2,
11+
"column": 3,
12+
"message": 4,
13+
"code": 5
14+
}
15+
]
16+
},
17+
{
18+
"owner": "pylint-warning",
19+
"severity": "warning",
20+
"pattern": [
21+
{
22+
"regexp": "^(.+):(\\d+):(\\d+):\\s(([CRW]\\d{4}):\\s.+)$",
23+
"file": 1,
24+
"line": 2,
25+
"column": 3,
26+
"message": 4,
27+
"code": 5
28+
}
29+
]
30+
}
31+
]
32+
}

.github/workflows/black.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
name: Lint
1+
name: Python formatting
22

33
on: [push, pull_request]
44

5+
# Declare default permissions as read only.
6+
permissions: read-all
7+
58
jobs:
69
lint:
7-
runs-on: ubuntu-latest
10+
name: Run black
11+
runs-on: ubuntu-24.04
12+
timeout-minutes: 10
813
steps:
9-
- uses: actions/checkout@v4
10-
- uses: psf/black@stable
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
15+
- name: Set up problem matcher for Black output
16+
run: echo '::add-matcher::.github/problem-matchers/black.json'
17+
- uses: psf/black@8a737e727ac5ab2f1d4cf5876720ed276dc8dc4b # stable
1118
with:
1219
src: "./unitary"

.github/workflows/pylint.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@ name: Pylint
22

33
on: [push, pull_request]
44

5+
# Declare default permissions as read only.
6+
permissions: read-all
7+
58
jobs:
69
pylint:
7-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-24.04
11+
timeout-minutes: 10
812
steps:
9-
- uses: actions/checkout@v4
10-
- uses: actions/setup-python@v5
13+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
14+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
1115
with:
1216
python-version: '3.12'
1317
architecture: 'x64'
1418
- name: Install Pylint
1519
run: |
1620
python -m pip install --upgrade pip
1721
pip install pylint
22+
- name: Set up problem matcher for Pylint output
23+
run: echo '::add-matcher::.github/problem-matchers/pylint.json'
1824
- name: Pylint check
1925
run: dev_tools/pylint

.github/workflows/pythonpackage.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,30 @@
1313
# limitations under the License.
1414

1515
name: Python package
16+
1617
on:
1718
push:
1819
branches: [ main ]
1920
pull_request:
2021
branches: [ main ]
2122

23+
# Declare default permissions as read only.
24+
permissions: read-all
25+
2226
jobs:
2327
pytest:
2428
name: Pytest
25-
runs-on: ubuntu-latest
29+
runs-on: ubuntu-24.04
30+
timeout-minutes: 15
2631
strategy:
2732
matrix:
2833
cirq-version:
2934
- 'current'
3035
- 'next'
3136
fail-fast: false
3237
steps:
33-
- uses: actions/checkout@v4
34-
- uses: actions/setup-python@v5
38+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
39+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
3540
with:
3641
python-version: '3.12'
3742
- name: Install dependencies
@@ -57,10 +62,11 @@ jobs:
5762
UNITARY_CHESS_TEST_SEED=789 UNITARY_IMPORT_FAILSAFE=y pytest -v
5863
nbformat:
5964
name: Notebook formatting
60-
runs-on: ubuntu-latest
65+
runs-on: ubuntu-24.04
66+
timeout-minutes: 15
6167
steps:
62-
- uses: actions/checkout@v4
63-
- uses: actions/setup-python@v5
68+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
69+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
6470
with:
6571
python-version: '3.12'
6672
- name: Doc check

0 commit comments

Comments
 (0)