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

CI, linting, refactoring, cleanup, labeling, stuff #21

Merged
merged 1 commit into from
Mar 2, 2023
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
4 changes: 4 additions & 0 deletions .github/funding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
github: frenck
patreon: frenck
custom: https://frenck.dev/donate/
86 changes: 86 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
- 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: "stale"
color: fef2c0
description: "There has not been activity on this issue or PR for quite some time."
- name: "no-stale"
color: fef2c0
description: "This issue or PR is exempted from the stable bot."

- 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: "beginner-friendly"
color: 0e8a16
description: "Good first issue for people wanting to contribute to the project."
- name: "help-wanted"
color: 0e8a16
description: "We need some extra helping hands or expertise in order to resolve this."

- name: "hacktoberfest"
description: "Issues/PRs are participating in the Hacktoberfest."
color: fbca04
- name: "hacktoberfest-accepted"
description: "Issues/PRs are participating in the Hacktoberfest."
color: fbca04

- name: "priority-critical"
color: ee0701
description: "This should be dealt with ASAP. Not fixing this issue would be a serious error."
- name: "priority-high"
color: b60205
description: "After critical issues are fixed, these should be dealt with before any further issues."
- name: "priority-medium"
color: 0e8a16
description: "This issue may be useful, and needs some attention."
- name: "priority-low"
color: e4ea8a
description: "Nice addition, maybe... someday..."

- 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."

57 changes: 57 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
sort-direction: ascending

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"
- title: "📚 Documentation"
labels:
- "documentation"
- title: "⬆️ Dependency updates"
labels:
- "dependencies"

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

template: |
## What’s changed

$CHANGES
33 changes: 33 additions & 0 deletions .github/workflows/black.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Black

on:
pull_request:
push:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.10"

jobs:
black:
name: Black
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v3

- name: 🏗 Set up Poetry
run: pipx install poetry

- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"

- name: 🏗 Install Python dependencies
run: poetry install --no-interaction

- name: 🚀 Run black
run: poetry run black --diff --fast .
20 changes: 8 additions & 12 deletions .github/workflows/hacs.yml → .github/workflows/hacs.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
---
name: "HACS Validation"
name: HACS Validation

on:
workflow_dispatch:
pull_request:
push:
schedule:
- cron: "0 0 * * *"
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
hacs:
name: "HACS Validation"
name: HACS Validation
runs-on: ubuntu-latest
steps:
- name: "Checkout the repository"
uses: actions/checkout@v3.3.0
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v3

- name: "Run HACS validation"
- name: 🚀 Run HACS validation
uses: hacs/action@main
with:
category: integration
18 changes: 7 additions & 11 deletions .github/workflows/hassfest.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
---
name: "Hassfest"
name: Hassfest

on:
workflow_dispatch:
pull_request:
push:
schedule:
- cron: "0 0 * * *"
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
hassfest:
name: "Hassfest"
name: Hassfest
runs-on: ubuntu-latest
steps:
- name: "Checkout the repository"
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v3

- name: "Run hassfest validation"
- name: 🚀 Run hassfest validation
uses: home-assistant/actions/hassfest@master
23 changes: 23 additions & 0 deletions .github/workflows/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Sync labels

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

jobs:
labels:
name: ♻️ Sync labels
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v3

- name: 🚀 Run Label Syncer
uses: micnncim/action-label-syncer@v1.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/pr-labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: PR Labels

on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]

jobs:
pr_labels:
name: Verify
runs-on: ubuntu-latest
steps:
- name: 🏷 Verify PR has a valid label
uses: jesusvasquez333/verify-pr-label-action@v1.4.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
valid-labels: >-
breaking-change, bugfix, documentation, enhancement,
refactor, performance, new-feature, maintenance, ci, dependencies
disable-reviews: true
33 changes: 33 additions & 0 deletions .github/workflows/pylint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Pylint

on:
pull_request:
push:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.10"

jobs:
pylint:
name: Pylint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v3

- name: 🏗 Set up Poetry
run: pipx install poetry

- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"

- name: 🏗 Install Python dependencies
run: poetry install --no-interaction

- name: 🚀 Run Pylint
run: poetry run pylint custom_components/spook
19 changes: 19 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Release Drafter

# yamllint disable-line rule:truthy
on:
push:
branches:
- main
workflow_dispatch:

jobs:
update_release_draft:
name: ✏️ Draft release
runs-on: ubuntu-latest
steps:
- name: 🚀 Run Release Drafter
uses: release-drafter/release-drafter@v5.23.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 6 additions & 6 deletions .github/workflows/release.yml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "Release"
name: Release

on:
release:
Expand All @@ -8,13 +8,13 @@ on:

jobs:
release:
name: "Release the Spook! 👻"
name: Release the Spook! 👻
runs-on: ubuntu-latest
steps:
- name: "⬇️ Checkout the repository"
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v3

- name: "🔢 Adjust version number"
- name: 🔢 Adjust version number
shell: bash
run: |
version="${{ github.event.release.tag_name }}"
Expand All @@ -24,13 +24,13 @@ jobs:
-i ".version = \"${version}\"" \
"${{ github.workspace }}/custom_components/spook/manifest.json"

- name: "📦 Created zipped release package"
- name: 📦 Created zipped release package
shell: bash
run: |
cd "${{ github.workspace }}/custom_components/spook"
zip spook.zip -r ./

- name: "⬆️ Upload zip to release"
- name: ⬆️ Upload zip to release
uses: softprops/action-gh-release@v0.1.15
with:
files: ${{ github.workspace }}/custom_components/spook/spook.zip
Loading