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

Standalone and Add-on merge #334

Merged
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
03562b8
init standalone and addon merge
GeoDerp Aug 2, 2024
c31c71d
Fix check_def_loads
GeoDerp Aug 5, 2024
d1f728a
init merge config_emhass.yaml and options.json to config.json
GeoDerp Aug 18, 2024
09a33af
Configuration page init
GeoDerp Aug 27, 2024
24191d1
tweaked python test action
GeoDerp Aug 27, 2024
3910c7d
Move required data files
GeoDerp Aug 28, 2024
93d33a4
Scripts add new config.json support
GeoDerp Aug 28, 2024
fd05d0a
unitest bug fixes
GeoDerp Aug 29, 2024
e1df786
modified: .vscode/launch.json
GeoDerp Aug 29, 2024
a4cf845
Updated github actions
GeoDerp Aug 30, 2024
507f92c
Publish_docker with lowercase job
GeoDerp Aug 30, 2024
6eebe91
Fixed some pr bugs
GeoDerp Aug 30, 2024
ceb8c95
remove missed loggers
GeoDerp Aug 30, 2024
de6b929
Config.json removed most list dictionaries
GeoDerp Aug 30, 2024
c1d0a30
fix missing files in package and docker
GeoDerp Aug 31, 2024
c0284fa
adjusted share data directory
GeoDerp Aug 31, 2024
5ac3bc4
Fix some small mistakes
GeoDerp Aug 31, 2024
81d0182
Some addon specific bugs
GeoDerp Sep 1, 2024
6998a60
Some addon specific bugs
GeoDerp Sep 1, 2024
60931e1
Add yaml button in configuration page and fix web bugs
GeoDerp Sep 3, 2024
c0b2dd3
support yaml conversion of legacy and add button Tooltips
GeoDerp Sep 3, 2024
d6a3a77
support yaml conversion of legacy and add button Tooltips
GeoDerp Sep 3, 2024
998c576
Add PR comments and error handling. Add server_ip
GeoDerp Sep 7, 2024
e8f044e
Edit PR error handling, Fix bugs.
GeoDerp Sep 8, 2024
eff21b1
test_optimization adjust import
GeoDerp Sep 8, 2024
e7b2761
fix some param bugs
GeoDerp Sep 22, 2024
ead69c2
add vscode launch method to test emhass-add-on
GeoDerp Sep 23, 2024
2fd98ec
Fix continual publish and param save bugs
GeoDerp Sep 24, 2024
da00471
Docs, replace parameter names to suit
GeoDerp Oct 23, 2024
a4344a5
Docs adjust to match new methods
GeoDerp Oct 23, 2024
073e4ad
Merge branch 'master' into enhass-standalone-addon-merge
GeoDerp Oct 23, 2024
3099fd7
Docs and definitions fix small errors, update merge #335
GeoDerp Oct 23, 2024
776cb2f
Dev Container comment out podman commands
GeoDerp Oct 25, 2024
98d90c6
requirements patch fix pytz, command_line check optimization_time_ste…
GeoDerp Oct 25, 2024
cca79a1
requirement.txt revert pytz requirement change
GeoDerp Oct 25, 2024
f754cf9
forecast temp fix DST issue
GeoDerp Oct 25, 2024
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
5 changes: 0 additions & 5 deletions .devcontainer/Dockerfile

This file was deleted.

31 changes: 15 additions & 16 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
{
"name": "EMHASS",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
"dockerfile": "../Dockerfile",
"context": "../",
"args": { "TARGETARCH": "amd64"}
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"configureZshAsDefaultShell": "true",
"installOhMyZsh": "false",
"installOhMyZshConfig": "false",
"upgradePackages": "true"
},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
},
//"appPort": ["5000:5000"] //used to access app from external device (User discretion advised)
Expand All @@ -17,17 +25,8 @@
// Add the IDs of extensions you want installed when the container is created.
"extensions": ["ms-python.debugpy", "ms-python.python"]
}
}


// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
},

"postCreateCommand": ["pip3", "install", "requests-mock", "--break-system-packages"]

}
27 changes: 0 additions & 27 deletions .devcontainer/setup.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
language: [ 'python' , 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/docker-build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ jobs:
context: .
platforms: ${{ matrix.platform.buildx }}
build-args: |
build_version=standalone
TARGETARCH=${{ matrix.platform.target_arch }}
os_version=${{ matrix.platform.os_version }}
tags: emhass/standalone-test
tags: emhass
load: true
- name: Test #assume docker fail with FileNotFound secrets_emhass.yaml error
run: docker run --rm -it emhass/standalone-test | grep -q secrets_emhass.yaml && echo 0 || echo 1
- name: Test # Run docker for 2min, if the output contains waitress INFO "Serving on" http://0.0.0.0:5000 assume it worked
run: timeout 2 docker run --rm -it emhass | grep -q "Serving on" && echo 0 || echo 1
51 changes: 31 additions & 20 deletions .github/workflows/publish_docker.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
#template modified from: https://docs.docker.com/build/ci/github-actions/multi-platform/
#template modified from: https://docs.docker.com/build/ci/github-actions/multi-platform/ & https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images
name: "Publish Docker"

on:
release:
types: [published]
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
fail-fast: false
matrix:
Expand All @@ -19,35 +28,36 @@ jobs:
{buildx: linux/arm64, target_arch: aarch64, os_version: debian}
]
steps:
# Pull git repo and build each architecture image separately (with QEMU and Buildx)
- name: Checkout the repository
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKERHUB_USERNAME }}/emhass-docker-standalone
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform.buildx }}
build-args: |
build_version=standalone
TARGETARCH=${{ matrix.platform.target_arch }}
os_version=${{ matrix.platform.os_version }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ secrets.DOCKERHUB_USERNAME }}/emhass-docker-standalone,push-by-digest=true,name-canonical=true,push=true
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
# Export the build images as artifact for the next job of merging
- name: Export digest
run: |
mkdir -p /tmp/digests
Expand All @@ -60,6 +70,7 @@ jobs:
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
# Merge platforms into images into a multi-platform image
merge:
if: always()
runs-on: ubuntu-latest
Expand All @@ -74,24 +85,24 @@ jobs:
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/emhass-docker-standalone
tags: |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
type=semver,pattern={{version}}
type=raw,value=latest
- name: Login to Docker Hub
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ secrets.DOCKERHUB_USERNAME }}/emhass-docker-standalone@sha256:%s ' *)
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ secrets.DOCKERHUB_USERNAME }}/emhass-docker-standalone:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
5 changes: 2 additions & 3 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest requests-mock
python setup.py install
pip install pytest requests-mock
pip install .

- name: Test with pytest
run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
test.py
# Secret yaml file
secrets_emhass.yaml
# config json file
config.json
*.tar
.vscode/*
.vscode/launch.json
.vscode/settings.json
.vscode/tasks.json
*.html
*.pkl
**/app

Expand Down
27 changes: 2 additions & 25 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,8 @@
],
"justMyCode": true,
"env": {
"CONFIG_PATH": "/workspaces/emhass/config_emhass.yaml",
"OPTIONS_PATH": "/workspaces/emhass/options.json",
"SECRETS_PATH": "/workspaces/emhass/secrets_emhass.yaml",
"DATA_PATH": "/workspaces/emhass/data/",
"LOGGING_LEVEL": "DEBUG"
}
},
{
"name": "EMHASS run ADDON",
"type": "debugpy",
"request": "launch",
"module": "emhass.web_server",
"console": "integratedTerminal",
"args": [
"--addon",
"true",
"--no_response",
"true"
],
"purpose": [
"debug-in-terminal"
],
"justMyCode": true,
"env": {
"CONFIG_PATH": "/workspaces/emhass/config_emhass.yaml",
//"LEGACY_CONFIG_PATH": "/workspaces/emhass/tests/config_emhass.yaml",
"CONFIG_PATH": "/workspaces/emhass/config.json",
"OPTIONS_PATH": "/workspaces/emhass/options.json",
"SECRETS_PATH": "/workspaces/emhass/secrets_emhass.yaml",
"DATA_PATH": "/workspaces/emhass/data/",
Expand Down
5 changes: 3 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
"install",
"--no-deps",
"--force-reinstall",
"--break-system-packages",
"--editable",
"."
],
"presentation": {
"echo": true,
"panel": "shared",
"focus": true
}
},
},
{
"label": "EMHASS install with dependencies",
Expand All @@ -29,7 +30,7 @@
"isDefault": true
},
"args": [
"install", "--force-reinstall", "."
"install", "--break-system-packages", "--force-reinstall", "."
],
"presentation": {
"echo": true,
Expand Down
Loading
Loading