From 66c75604d6311ef20d9740b6819b8d214200adca Mon Sep 17 00:00:00 2001 From: Andrew Imeson Date: Wed, 10 Aug 2022 22:29:59 -0400 Subject: [PATCH] Fix pre-commit and update CI (#875) --- .github/workflows/stale.yml | 8 ++++---- .github/workflows/validation.yml | 17 +++++++++++------ .pre-commit-config.yaml | 8 ++++---- tests/yamllint.yaml => .yamllint.yaml | 3 --- requirements.txt | 2 +- 5 files changed, 20 insertions(+), 18 deletions(-) rename tests/yamllint.yaml => .yamllint.yaml (89%) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 62acbae3b..ec825e9f7 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,7 +1,7 @@ --- # close-stale-issues (https://github.com/marketplace/actions/close-stale-issues) name: Close stale PRs -on: +on: # yamllint disable-line rule:truthy schedule: - cron: 0 4 * * * @@ -19,6 +19,6 @@ jobs: remove-stale-when-updated: false stale-pr-label: stale stale-pr-message: > - This PR has been automatically marked as stale because it has not had - recent activity. It will be closed automatically if no further progress - is made. + This PR has been automatically marked as stale because it has not + had recent activity. It will be closed automatically if no further + progress is made. diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 9b4dfe77d..3bdb6b602 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -1,25 +1,30 @@ --- name: Validate definitions -on: + +on: # yamllint disable-line rule:truthy pull_request: branches: - master jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 + - name: Setup Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: 3.8 + - name: Install dependencies run: pip install -r requirements.txt + - name: Lint YAML files - run: yamllint --format parsable --strict -c=tests/yamllint.yaml device-types/ module-types/ + run: | + yamllint --format github --strict \ + device-types/ module-types/ + - name: Run tests run: pytest --tb=short -v diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 14743794a..7f468dbdd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,20 +1,20 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.3.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml name: Check YAML files - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt - rev: 0.1.0 + rev: 0.2.2 hooks: - id: yamlfmt args: [--mapping, '2', --sequence, '4', --offset, '2'] - repo: https://github.com/adrienverge/yamllint.git - rev: v1.26.0 + rev: v1.27.1 hooks: - id: yamllint name: Lint YAML files - args: [--format, parsable, --strict, -c=tests/yamllint.yaml] + args: [--format, parsable, --strict] diff --git a/tests/yamllint.yaml b/.yamllint.yaml similarity index 89% rename from tests/yamllint.yaml rename to .yamllint.yaml index dc107579d..6cc159888 100644 --- a/tests/yamllint.yaml +++ b/.yamllint.yaml @@ -27,6 +27,3 @@ rules: octal-values: disable quoted-strings: disable trailing-spaces: enable - truthy: - ignore: | - .github/workflows/validation.yml diff --git a/requirements.txt b/requirements.txt index 2f63fb3a2..7697152b0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ jsonschema==3.2.0 pytest==5.3.2 PyYAML==5.4 -yamllint==1.26.0 +yamllint==1.27.1