Skip to content

Commit

Permalink
Add github checks
Browse files Browse the repository at this point in the history
  • Loading branch information
robbinjanssen committed Jan 8, 2023
1 parent 1a94fcc commit acc82ae
Show file tree
Hide file tree
Showing 27 changed files with 2,673 additions and 188 deletions.
1 change: 1 addition & 0 deletions .codespell-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hass
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 88
ignore = D202,W503
exclude = .git,.github,__pycache__,.venv
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
time: "03:00"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: daily
time: "04:00"
59 changes: 59 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
- name: "breaking-change"
color: ee0701
description: "A breaking change for existing users."
- name: "bugfix"
color: ee0701
description: "Inconsistencies or issues which will cause a problem for users or implementors."
- name: "documentation"
color: 0052cc
description: "Solely about the documentation of the project."
- name: "enhancement"
color: 1d76db
description: "Enhancement of the code, not introducing new features."
- name: "refactor"
color: 1d76db
description: "Improvement of existing code, not introducing new features."
- name: "performance"
color: 1d76db
description: "Improving performance, not introducing new features."
- name: "new-feature"
color: 0e8a16
description: "New features or options."
- name: "maintenance"
color: 2af79e
description: "Generic maintenance tasks."
- name: "ci"
color: 1d76db
description: "Work that improves the continue integration."
- name: "dependencies"
color: 1d76db
description: "Upgrade or downgrade of project dependencies."

- name: "in-progress"
color: fbca04
description: "Issue is currently being resolved by a developer."

- name: "security"
color: ee0701
description: "Marks a security issue that needs to be resolved asap."
- name: "incomplete"
color: fef2c0
description: "Marks a PR or issue that is missing information."
- name: "invalid"
color: fef2c0
description: "Marks a PR or issue that is missing information."

- name: "major"
color: b60205
description: "This PR causes a major version bump in the version number."
- name: "minor"
color: 0e8a16
description: "This PR causes a minor version bump in the version number."

- name: "skip-changelog"
color: fef2c0
description: "This issue or PR is exempted from the release notes."
- name: "automerge"
color: fef2c0
description: "Merge this PR automatically when there are no conflicts and all required checks are passed."
60 changes: 60 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name-template: '$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
change-template: '- [#$NUMBER] $TITLE [@$AUTHOR](https://github.com/$AUTHOR)'
sort-direction: ascending

exclude-labels:
- 'skip-changelog'

categories:
- title: "🚨 Breaking changes"
labels:
- "breaking-change"
- title: "✨ New features"
labels:
- "new-feature"
- title: "🐛 Bug fixes"
labels:
- "bugfix"
- title: "🚀 Enhancements"
labels:
- "enhancement"
- "refactor"
- "performance"
- title: "🧰 Maintenance"
labels:
- "maintenance"
- "ci"
- "security"
- title: "📚 Documentation"
labels:
- "documentation"
- title: "⬆️ Dependency updates"
collapse-after: 1
labels:
- "dependencies"

version-resolver:
major:
labels:
- "major"
- "breaking-change"
minor:
labels:
- "minor"
- "new-feature"
patch:
labels:
- "bugfix"
- "ci"
- "dependencies"
- "documentation"
- "enhancement"
- "performance"
- "refactor"
default: patch

template: |
## What’s changed
$CHANGES
39 changes: 0 additions & 39 deletions .github/workflows/check-syntax.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Draft Release

on:
push:
branches: [main]

jobs:
update-release-draft:
name: Update
runs-on: ubuntu-latest

steps:
- name: Run release drafter
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 changes: 53 additions & 0 deletions .github/workflows/issues.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Issues

on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:

jobs:
lock:
name: Lock closed issues and PRs
runs-on: ubuntu-latest

steps:
- uses: dessant/lock-threads@v4
with:
github-token: ${{ github.token }}
issue-inactive-days: "30"
issue-lock-reason: ""
pr-inactive-days: "1"
pr-lock-reason: ""

stale:
name: Clean up stale issues and PRs
runs-on: ubuntu-latest

steps:
- name: Run stale
uses: actions/stale@v7
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 30
days-before-close: 7
remove-stale-when-updated: true
stale-issue-label: "stale"
exempt-issue-labels: "no-stale,help-wanted"
stale-issue-message: >
There hasn't been any activity on this issue recently, so we
clean up some of the older and inactive issues.
Please make sure to update to the latest version and
check if that solves the issue. Let us know if that works for you
by leaving a comment 👍
This issue has now been marked as stale and will be closed if no
further activity occurs. Thanks!
stale-pr-label: "stale"
exempt-pr-labels: "no-stale"
stale-pr-message: >
There hasn't been any activity on this pull request recently. This
pull request has been automatically marked as stale because of that
and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.
110 changes: 110 additions & 0 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
name: Linting

on:
push:
pull_request:
workflow_dispatch:

jobs:
precommit:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
strategy:
matrix:
include:
- id: bandit
name: Check with bandit
- id: black
name: Check code style
- id: blacken-docs
name: Check code style in documentation
- id: check-ast
name: Check Python AST
- id: check-case-conflict
name: Check for case conflicts
- id: check-docstring-first
name: Check docstring is first
- id: check-executables-have-shebangs
name: Check that executables have shebangs
- id: check-json
name: Check JSON files
- id: check-merge-conflict
name: Check for merge conflicts
- id: check-symlinks
name: Check for broken symlinks
- id: check-toml
name: Check TOML files
- id: check-yaml
name: Check YAML files
- id: codespell
name: Check code for common misspellings
- id: debug-statements
name: Debug Statements and imports (Python)
- id: detect-private-key
name: Detect Private Keys
- id: end-of-file-fixer
name: Check End of Files
- id: fix-byte-order-marker
name: Check UTF-8 byte order marker
- id: flake8
name: Enforcing style guide with flake8
- id: isort
name: Check imports are sorted
- id: poetry
name: Check pyproject file
- id: pylint
name: Check with pylint
- id: pyupgrade
name: Check for upgradable syntax
- id: trailing-whitespace
name: Trim Trailing Whitespace
- id: vulture
name: Check for unused Python code
- id: yamllint
name: Check YAML style

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python 3.9
id: python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Set pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Restore cached Python pip packages
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ runner.os }}-v2-${{ steps.python.outputs.python-version }}-${{ hashFiles('.github/workflows/requirements.txt') }}
restore-keys: |
pip-${{ runner.os }}-v2-${{ steps.python.outputs.python-version }}-
- name: Install workflow dependencies
run: |
pip install -r .github/workflows/requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Restore cached Python venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: >-
venv-${{ runner.os }}-v2-${{ steps.python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
venv-${{ runner.os }}-v2-${{ steps.python.outputs.python-version }}-
- name: Install dependencies
run: poetry install --no-interaction

- name: Run pre-commit for ${{ matrix.id }}
run: poetry run pre-commit run ${{ matrix.id }} --all-files
2 changes: 2 additions & 0 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pip==22.3.1
poetry==1.3.1
23 changes: 23 additions & 0 deletions .github/workflows/sync-labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Sync labels

on:
workflow_dispatch:
push:
branches: [main]
paths:
- .github/labels.yml

jobs:
labels:
name: Sync labels
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Run Label Syncer
uses: micnncim/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit acc82ae

Please sign in to comment.