Skip to content
Merged
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
19 changes: 19 additions & 0 deletions .github/problem-matchers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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.

The following problem matcher JSON files 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)
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
}
]
}
]
}
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
}
]
}
]
}
39 changes: 38 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

name: Continuous integration checks
run-name: Continuous integration checks triggered by ${{github.event_name}}
run-name: CI checks for ${{github.event_name}} by ${{github.actor}}

on:
pull_request:
Expand Down Expand Up @@ -81,6 +81,8 @@ jobs:
outputs:
python: ${{steps.filter.outputs.python}}
python_files: ${{steps.filter.outputs.python_files}}
yaml: ${{steps.filter.outputs.yaml}}
yaml_files: ${{steps.filter.outputs.yaml_files}}
steps:
# When invoked manually, use the given SHA to figure out the change list.
- if: github.event_name == 'workflow_dispatch'
Expand Down Expand Up @@ -121,12 +123,17 @@ jobs:
python:
- added|modified:
- '**/*.py'
yaml:
- added|modified:
- '**/*.yaml'
- '**/*.yml'

setup:
if: needs.changes.outputs.python == 'true'
name: (Set up Python)
needs: changes
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out a copy of the git repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -155,6 +162,7 @@ jobs:
name: Python format checks
needs: [changes, setup]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out a copy of the git repository
uses: actions/checkout@v4
Expand All @@ -180,6 +188,7 @@ jobs:
name: Python type checks
needs: [changes, setup]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out a copy of the git repository
uses: actions/checkout@v4
Expand All @@ -203,6 +212,7 @@ jobs:
name: Python lint checks
needs: [changes, setup]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out a copy of the git repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -234,6 +244,7 @@ jobs:
name: (Python pytest matrix)
needs: [changes, setup]
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
Expand Down Expand Up @@ -277,6 +288,7 @@ jobs:
name: (Python extra pytest matrix)
needs: [changes, setup]
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
Expand Down Expand Up @@ -320,6 +332,7 @@ jobs:
name: Python compatibility checks
needs: [changes, setup]
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Check out a copy of the git repository
uses: actions/checkout@v4
Expand All @@ -343,6 +356,7 @@ jobs:
name: Python code coverage checks
needs: [changes, setup]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out a copy of the git repository
uses: actions/checkout@v4
Expand All @@ -361,3 +375,26 @@ jobs:

- name: Run code coverage tests
run: check/pytest-and-incremental-coverage

yaml-lint:
if: needs.changes.outputs.yaml == 'true'
name: YAML lint checks
needs: changes
runs-on: ubuntu-24.04
timeout-minutes: 5
env:
changed_files: ${{needs.changes.outputs.yaml_files}}
steps:
- name: Check out a copy of the git repository
uses: actions/checkout@v4

- name: Set up yamllint output problem matcher
run: |
ls -la
echo "::add-matcher::.github/problem-matchers/yamllint.json"

- name: Run yamllint
run: |
set -x
# shellcheck disable=SC2086
yamllint $changed_files
14 changes: 14 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Summary: yamllint configuration.
# See https://yamllint.readthedocs.io/ for info about configuration options.

rules:
line-length:
# YAML files (especially GitHub Actions workflows) tend to end up with
# long lines. The default of 80 is pretty limiting, and besides, in Python
# code linting, we set line lengths to 100. May as well follow suit here.
max: 100
# Another common occurrence in YAML files is long URLs. The next two
# settings are not specific to URLs, but help. It saves developer time by
# not requiring comment directives to disable warnings at every occurrence.
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
Loading