-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Brunas/workflows_some_cleanup
Code cleanup, workflows, docs
- Loading branch information
Showing
25 changed files
with
1,034 additions
and
690 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
# Use an official Python image as the base image | ||
FROM python:3.12-slim | ||
|
||
# Set environment variables | ||
ENV PYTHONUNBUFFERED=1 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
# Install system dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
curl \ | ||
libffi-dev \ | ||
libssl-dev \ | ||
libjpeg-dev \ | ||
zlib1g-dev \ | ||
gcc \ | ||
make \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set the timezone to Europe/Vilnius | ||
ENV TZ=Europe/Vilnius | ||
|
||
# Set up the user for vscode | ||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME | ||
|
||
# Switch to the vscode user | ||
USER $USERNAME | ||
|
||
# Set the working directory | ||
WORKDIR /home/vscode | ||
|
||
# Expose the default Home Assistant port | ||
EXPOSE 8123 | ||
# Use an official Python image as the base image | ||
FROM python:3.12-slim | ||
|
||
# Set environment variables | ||
ENV PYTHONUNBUFFERED=1 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
# Install system dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
curl \ | ||
libffi-dev \ | ||
libssl-dev \ | ||
libjpeg-dev \ | ||
zlib1g-dev \ | ||
gcc \ | ||
make \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set the timezone to Europe/Vilnius | ||
ENV TZ=Europe/Vilnius | ||
|
||
# Set up the user for vscode | ||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME | ||
|
||
# Switch to the vscode user | ||
USER $USERNAME | ||
|
||
# Set the working directory | ||
WORKDIR /home/vscode | ||
|
||
# Expose the default Home Assistant port | ||
EXPOSE 8123 |
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,37 +1,45 @@ | ||
{ | ||
"name": "Home Assistant Dev Container", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": ".." | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"python.pythonPath": "/usr/local/bin/python", | ||
"terminal.integrated.shell.linux": "/bin/bash" | ||
}, | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"ms-toolsai.jupyter", | ||
"ms-python.black-formatter", | ||
"ms-python.autopep8", | ||
"ms-python.pylint", | ||
"ms-vscode.remote-containers", | ||
"charliermarsh.ruff" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "pip install -r requirements.txt", | ||
"remoteUser": "vscode", | ||
"mounts": [ | ||
"source=${localWorkspaceFolder}/config,target=/config,type=bind", | ||
"source=${localWorkspaceFolder}/custom_components,target=/config/custom_components,type=bind" | ||
], | ||
"forwardPorts": [ | ||
8123 | ||
], | ||
"remoteEnv": { | ||
"TZ": "Europe/Vilnius" | ||
} | ||
{ | ||
"name": "Home Assistant Dev Container", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": ".." | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"python.pythonPath": "/usr/local/bin/python", | ||
"python.selectInterpreter": "/usr/local/bin/python", | ||
"terminal.integrated.shell.linux": "/bin/bash" | ||
}, | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"ms-toolsai.jupyter", | ||
"ms-python.black-formatter", | ||
"ms-python.autopep8", | ||
"ms-python.pylint", | ||
"ms-vscode.remote-containers", | ||
"charliermarsh.ruff", | ||
"yzhang.markdown-all-in-one", | ||
"kevinrose.vsc-python-indent", | ||
"keesschollaart.vscode-home-assistant", | ||
"donjayamanne.githistory", | ||
"mhutchie.git-graph", | ||
"mikoz.black-py" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "pip install -r requirements.txt", | ||
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", | ||
"remoteUser": "vscode", | ||
"mounts": [ | ||
"source=${localWorkspaceFolder}/config,target=/config,type=bind", | ||
"source=${localWorkspaceFolder}/custom_components,target=/config/custom_components,type=bind" | ||
], | ||
"forwardPorts": [ | ||
8123 | ||
], | ||
"remoteEnv": { | ||
"TZ": "Europe/Vilnius" | ||
} | ||
} |
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,18 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
# Maintain dependencies for pip | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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,34 @@ | ||
name: "Lint" | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- "**/README.md" | ||
- "**/CHANGELOG.md" | ||
- "**/CONTRIBUTING.md" | ||
- "**/requirements.txt" | ||
branches: | ||
- "main" | ||
pull_request: | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
ruff: | ||
name: "Ruff" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Checkout the repository" | ||
uses: "actions/[email protected]" | ||
|
||
- name: "Set up Python" | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.12" | ||
cache: "pip" | ||
|
||
- name: "Install requirements" | ||
run: python3 -m pip install -r requirements.txt | ||
|
||
- name: "Run" | ||
run: python3 -m ruff check . |
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,35 @@ | ||
name: "Release" | ||
|
||
on: | ||
release: | ||
types: | ||
- "published" | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
release: | ||
name: "Release" | ||
runs-on: "ubuntu-latest" | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: "Checkout the repository" | ||
uses: "actions/[email protected]" | ||
|
||
- name: "Adjust version number" | ||
shell: "bash" | ||
run: | | ||
yq -i -o json '.version="${{ github.event.release.tag_name }}"' \ | ||
"${{ github.workspace }}/custom_components/meteo_lt/manifest.json" | ||
- name: "ZIP the integration directory" | ||
shell: "bash" | ||
run: | | ||
cd "${{ github.workspace }}/custom_components/meteo_lt" | ||
zip meteo_lt.zip -r ./ | ||
- name: "Upload the ZIP file to the release" | ||
uses: softprops/[email protected] | ||
with: | ||
files: ${{ github.workspace }}/custom_components/meteo_lt/meteo_lt.zip |
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,40 @@ | ||
name: "Validate" | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
push: | ||
paths-ignore: | ||
- "**/README.md" | ||
- "**/CHANGELOG.md" | ||
- "**/CONTRIBUTING.md" | ||
- "**/requirements.txt" | ||
branches: | ||
- "main" | ||
pull_request: | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest | ||
name: "Hassfest Validation" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Checkout the repository" | ||
uses: "actions/[email protected]" | ||
|
||
- name: "Run hassfest validation" | ||
uses: "home-assistant/actions/hassfest@master" | ||
|
||
hacs: # https://github.com/hacs/action | ||
name: "HACS Validation" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Checkout the repository" | ||
uses: "actions/[email protected]" | ||
|
||
- name: "Run HACS validation" | ||
uses: "hacs/action@main" | ||
with: | ||
category: "integration" |
Oops, something went wrong.