-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Activate dependabot * Rework CI * Code style * Patch wrong code style generated * Update documentation with pre-commit
- Loading branch information
1 parent
ae17360
commit 18cc719
Showing
10 changed files
with
105 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python | ||
import json | ||
from pathlib import Path | ||
|
||
|
||
def reindent_cookiecutter_json(): | ||
"""Indent .cookiecutter.json using two spaces. | ||
The jsonify extension distributed with Cookiecutter uses an indentation | ||
width of four spaces. This conflicts with the default indentation width of | ||
Prettier for JSON files. Prettier is run as a pre-commit hook in CI. | ||
""" | ||
path = Path(".cookiecutter.json") | ||
|
||
with path.open() as io: | ||
data = json.load(io) | ||
|
||
with path.open(mode="w") as io: | ||
json.dump(data, io, sort_keys=True, indent=2) | ||
io.write("\n") | ||
|
||
|
||
if __name__ == "__main__": | ||
reindent_cookiecutter_json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
- package-ecosystem: pip | ||
directory: "/.github/workflows" | ||
schedule: | ||
interval: daily |
5 changes: 5 additions & 0 deletions
5
{{cookiecutter.project_name}}/.github/workflows/constraints.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pip==20.2.4 | ||
pre-commit==2.9.0 | ||
black==20.8b1 | ||
flake8==3.8.4 | ||
reorder-python-imports==2.3.6 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
{{cookiecutter.project_name}}/.github/workflows/tests.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
- dev | ||
pull_request: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
env: | ||
DEFAULT_PYTHON: 3.9 | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: "ubuntu-latest" | ||
name: Pre-commit | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v2.3.4 | ||
|
||
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | ||
uses: actions/setup-python@v2.1.4 | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
|
||
- name: Upgrade pip | ||
run: | | ||
pip install --constraint=.github/workflows/constraints.txt pip | ||
pip --version | ||
- name: Install Python modules | ||
run: | | ||
pip install --constraint=.github/workflows/constraints.txt pre-commit black flake8 reorder-python-imports | ||
- name: Run pre-commit on all files | ||
run: | | ||
pre-commit run --all-files --show-diff-on-failure --color=always | ||
hacs: | ||
runs-on: "ubuntu-latest" | ||
name: HACS | ||
steps: | ||
- name: Check out the repository | ||
uses: "actions/checkout@v2.3.4" | ||
|
||
- name: HACS validation | ||
uses: "hacs/action@20.11.1" | ||
with: | ||
category: "integration" | ||
ignore: brands | ||
|
||
hassfest: | ||
runs-on: "ubuntu-latest" | ||
name: Hassfest | ||
steps: | ||
- name: Check out the repository | ||
uses: "actions/checkout@v2.3.4" | ||
|
||
- name: Hassfest validation | ||
uses: "home-assistant/actions/hassfest@master" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
__pycache__ | ||
.python-version | ||
.vscode/settings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters