Skip to content

Commit

Permalink
Merge pull request #4 from antoinebou12/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinebou12 authored Sep 12, 2023
2 parents f5f062a + 569a97b commit 4bdb816
Show file tree
Hide file tree
Showing 31 changed files with 2,134 additions and 1,245 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ by uncommenting the line:
Then launch the task `Run Home Assistant on port 9123`, and launch the debugger
with the existing debugging configuration `Python: Attach Local`.

For more information, look at [the Remote Python Debugger integration documentation](https://www.home-assistant.io/integrations/debugpy/).
For more information, look at [the Remote Python Debugger integration documentation](https://www.home-assistant.io/integrations/debugpy/).
44 changes: 22 additions & 22 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"image": "ghcr.io/ludeeus/devcontainer/integration:stable",
"name": "HASS Renpho development",
"context": "..",
"appPort": ["9123:8123"],
"postCreateCommand": "container install && tools/post_create_command.sh",
"extensions": [
"ms-python.python",
"github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance",
"foxundermoon.shell-format"
],
"settings": {
"editor.tabSize": 4,
"python.analysis.autoSearchPaths": false,
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"ha_strava.remote_host": "home.local"
}
}
"image": "ghcr.io/ludeeus/devcontainer/integration:stable",
"name": "HASS Renpho development",
"context": "..",
"appPort": ["9123:8123"],
"postCreateCommand": "container install && tools/post_create_command.sh",
"extensions": [
"ms-python.python",
"github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance",
"foxundermoon.shell-format"
],
"settings": {
"editor.tabSize": 4,
"python.analysis.autoSearchPaths": false,
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"ha_strava.remote_host": "home.local"
}
}
11 changes: 6 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ Please describe the tests that you ran to verify your changes. Provide instructi
- [ ] Test B

**Test Configuration**:
* Firmware version:
* Hardware:
* Toolchain:
* SDK:

- Firmware version:
- Hardware:
- Toolchain:
- SDK:

# Checklist:

Expand All @@ -39,4 +40,4 @@ Please describe the tests that you ran to verify your changes. Provide instructi
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] Any dependent changes have been merged and published in downstream modules
83 changes: 41 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,50 @@ name: Create Release
on:
push:
tags:
- 'v*'
- "v*"

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Generate Changelog
id: changelog
run: |
export CHANGELOG=$(git log $(git describe --tags --abbrev=0)..HEAD --pretty="- %s")
echo "CHANGELOG=$CHANGELOG" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ env.CHANGELOG }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}

- name: Zip custom_components/renpho directory
run: zip -r renpho_custom_component.zip custom_components/renpho

- name: Zip complete code
run: zip -r complete_code.zip .

- name: Upload custom_components/renpho ZIP to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./renpho_custom_component.zip
asset_name: renpho_custom_component.zip
asset_content_type: application/zip

- name: Upload complete code ZIP to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./complete_code.zip
asset_name: complete_code.zip
asset_content_type: application/zip
- name: Checkout code
uses: actions/checkout@v2

- name: Generate Changelog
id: changelog
run: |
export CHANGELOG=$(git log $(git describe --tags --abbrev=0)..HEAD --pretty="- %s")
echo "CHANGELOG=$CHANGELOG" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ env.CHANGELOG }}
draft: false
prerelease: false

- name: Zip custom_components/renpho directory
run: zip -r renpho_custom_component.zip custom_components/renpho

- name: Zip complete code
run: zip -r complete_code.zip .

- name: Upload custom_components/renpho ZIP to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./renpho_custom_component.zip
asset_name: renpho_custom_component.zip
asset_content_type: application/zip

- name: Upload complete code ZIP to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./complete_code.zip
asset_name: complete_code.zip
asset_content_type: application/zip
22 changes: 22 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build

on:
push:
branches:
- master
- dev


jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions: read-all
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
29 changes: 14 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@ jobs:
runs-on: ubuntu-latest

container:
image: homeassistant/home-assistant:latest # Use Home Assistant's Docker image
image: homeassistant/home-assistant:latest # Use Home Assistant's Docker image

steps:
- uses: actions/checkout@v2
- name: Set up Python 3
run: |
python3 -m ensurepip
python3 -m pip install --upgrade pip
- name: Install Dependencies
run: |
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install -r requirements_test.txt
- name: Run Tests
run: |
python3 -m unittest discover
continue-on-error: true
- uses: actions/checkout@v2
- name: Set up Python 3
run: |
python3 -m ensurepip
python3 -m pip install --upgrade pip
- name: Install Dependencies
run: |
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install -r requirements_test.txt
- name: Run Tests
run: |
python3 -m unittest discover
13 changes: 12 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,15 @@ repos:
name: pylint
entry: pylint
language: system
types: [python]
types: [python]
require_serial: true
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910
hooks:
- id: mypy
args: [--ignore-missing-imports]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.8.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
66 changes: 33 additions & 33 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// Example of attaching to local debug server
"name": "Python: Attach Local",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
]
},
{
// Example of attaching to my production server
"name": "Python: Attach Remote",
"type": "python",
"request": "attach",
"port": 5678,
"host": "${config:ha_strava.remote_host}",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/usr/src/homeassistant"
}
]
}
]
}
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// Example of attaching to local debug server
"name": "Python: Attach Local",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
]
},
{
// Example of attaching to my production server
"name": "Python: Attach Remote",
"type": "python",
"request": "attach",
"port": 5678,
"host": "${config:ha_strava.remote_host}",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/usr/src/homeassistant"
}
]
}
]
}
80 changes: 40 additions & 40 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run Home Assistant on port 9123",
"type": "shell",
"command": "container start",
"problemMatcher": []
},
{
"label": "Run Home Assistant configuration check /config",
"type": "shell",
"command": "container check",
"problemMatcher": []
},
{
"label": "Upgrade Home Assistant to latest dev",
"type": "shell",
"command": "container install",
"problemMatcher": []
},
{
"label": "Install a specific version of Home Assistant",
"type": "shell",
"command": "container set-version",
"problemMatcher": []
},
{
"label": "Pre-commit",
"type": "shell",
"command": "pre-commit",
"problemMatcher": []
},
{
"label": "Push Component to Remote Host",
"type": "shell",
"command": "tools/push_remote.sh ${config:ha_strava.remote_host}",
"problemMatcher": []
}
]
}
"version": "2.0.0",
"tasks": [
{
"label": "Run Home Assistant on port 9123",
"type": "shell",
"command": "container start",
"problemMatcher": []
},
{
"label": "Run Home Assistant configuration check /config",
"type": "shell",
"command": "container check",
"problemMatcher": []
},
{
"label": "Upgrade Home Assistant to latest dev",
"type": "shell",
"command": "container install",
"problemMatcher": []
},
{
"label": "Install a specific version of Home Assistant",
"type": "shell",
"command": "container set-version",
"problemMatcher": []
},
{
"label": "Pre-commit",
"type": "shell",
"command": "pre-commit",
"problemMatcher": []
},
{
"label": "Push Component to Remote Host",
"type": "shell",
"command": "tools/push_remote.sh ${config:ha_strava.remote_host}",
"problemMatcher": []
}
]
}
Loading

0 comments on commit 4bdb816

Please sign in to comment.