Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramunas-OAG committed Jul 24, 2024
1 parent df1d3ad commit d423462
Show file tree
Hide file tree
Showing 18 changed files with 844 additions and 820 deletions.
76 changes: 38 additions & 38 deletions .devcontainer/Dockerfile
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
79 changes: 43 additions & 36 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,44 @@
{
"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"
]
}
},
"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"
}
}
38 changes: 19 additions & 19 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: HACS validation

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: "actions/checkout@v4"
- name: Hassfest
uses: "home-assistant/actions/hassfest@master"
- name: HACS validation
uses: "hacs/action@main"
with:
name: HACS validation

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: "actions/checkout@v4"
- name: Hassfest
uses: "home-assistant/actions/hassfest@master"
- name: HACS validation
uses: "hacs/action@main"
with:
CATEGORY: integration
Loading

0 comments on commit d423462

Please sign in to comment.