From 150ea6eeda8497afeb06768ec49efb464a7c300f Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 19:10:32 +0200 Subject: [PATCH 01/14] refactor some loggers --- lib/py_edge_device/carlos/edge/device/retry.py | 5 ++--- lib/py_edge_device/carlos/edge/device/update.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/py_edge_device/carlos/edge/device/retry.py b/lib/py_edge_device/carlos/edge/device/retry.py index b4a9c1c2..2ae19a22 100644 --- a/lib/py_edge_device/carlos/edge/device/retry.py +++ b/lib/py_edge_device/carlos/edge/device/retry.py @@ -93,10 +93,9 @@ async def execute( return await func() except expected_exceptions as ex: logger.info( - f"Failed to run function: {func}.\n\n" - f"Exception: {''.join(traceback.format_exception(ex))}\n\n" - f"Retrying in {backoff_time}." + f"Failed to run function: {func}. Retrying in {backoff_time}." ) + logger.debug(traceback.format_exc()) await sleep(backoff_time.total_seconds()) diff --git a/lib/py_edge_device/carlos/edge/device/update.py b/lib/py_edge_device/carlos/edge/device/update.py index 09928623..9dcf387b 100644 --- a/lib/py_edge_device/carlos/edge/device/update.py +++ b/lib/py_edge_device/carlos/edge/device/update.py @@ -40,7 +40,7 @@ def update_device(): # pragma: no cover logger.debug(process.stdout.decode("utf-8").strip()) # Restart the running process - logger.debug("Restarting the running process...") + logger.info("Restarting the running process...") os.execv(sys.executable, [sys.executable] + sys.argv) From d5e89f76d186706153601a0dcebd66ba2931a43b Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 19:24:39 +0200 Subject: [PATCH 02/14] add linux service --- .monorepo_manager.yaml | 3 +++ lib/py_edge_device/carlos/edge/device/retry.py | 2 +- lib/py_edge_device/carlos/edge/device/runtime.py | 10 ++++++++++ services/device/carlos_device.service | 13 +++++++++++++ services/device/install-service.sh | 3 +++ 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 services/device/carlos_device.service create mode 100644 services/device/install-service.sh diff --git a/.monorepo_manager.yaml b/.monorepo_manager.yaml index 25e3500d..6a6f2f13 100644 --- a/.monorepo_manager.yaml +++ b/.monorepo_manager.yaml @@ -40,6 +40,9 @@ services/api: language: python services/device: language: python + makefile: + run: + - poetry run -m device.cli services/frontend: language: javascript services/nginx: diff --git a/lib/py_edge_device/carlos/edge/device/retry.py b/lib/py_edge_device/carlos/edge/device/retry.py index 2ae19a22..a932c40a 100644 --- a/lib/py_edge_device/carlos/edge/device/retry.py +++ b/lib/py_edge_device/carlos/edge/device/retry.py @@ -91,7 +91,7 @@ async def execute( while True: try: return await func() - except expected_exceptions as ex: + except expected_exceptions: logger.info( f"Failed to run function: {func}. Retrying in {backoff_time}." ) diff --git a/lib/py_edge_device/carlos/edge/device/runtime.py b/lib/py_edge_device/carlos/edge/device/runtime.py index d8207c2b..56a43c8b 100644 --- a/lib/py_edge_device/carlos/edge/device/runtime.py +++ b/lib/py_edge_device/carlos/edge/device/runtime.py @@ -1,10 +1,13 @@ """The runtime module contains the device runtime that is used as the main entry point of the application.""" +from datetime import timedelta +from pathlib import Path from apscheduler import AsyncScheduler from apscheduler.triggers.interval import IntervalTrigger from carlos.edge.interface import EdgeConnectionDisconnected, EdgeProtocol from carlos.edge.interface.protocol import PING +from loguru import logger from .communication import DeviceCommunicationHandler from .config import DeviceConfig @@ -25,6 +28,13 @@ def __init__(self, config: DeviceConfig, protocol: EdgeProtocol): async def run(self): """Runs the device runtime.""" + logger.add( + sink=Path.cwd() / ".carlos_data" / "device" / "device_log_{time}.log", + level="INFO", + rotation="50 MB", + retention=timedelta(days=60), + ) + communication_handler = DeviceCommunicationHandler( protocol=self.protocol, device_id=self.config.device_id ) diff --git a/services/device/carlos_device.service b/services/device/carlos_device.service new file mode 100644 index 00000000..3c1ffac0 --- /dev/null +++ b/services/device/carlos_device.service @@ -0,0 +1,13 @@ +[Unit] +Description=Carlos Device +After=network.target + +[Service] +Type=simple +User=carlos +WorkingDirectory=~/carlos/services/device +ExecStart=~/carlos/services/device/.venv/bin/python -m device.cli run +Restart=always + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/services/device/install-service.sh b/services/device/install-service.sh new file mode 100644 index 00000000..1347bcdf --- /dev/null +++ b/services/device/install-service.sh @@ -0,0 +1,3 @@ +sudo cp carlos_device.service /etc/systemd/system/ +sudo systemctl enable carlos_device.service +sudo systemctl start carlos_device.service \ No newline at end of file From 04813281b3644a0c26e2b480d1d32ef351a5a9da Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 19:30:45 +0200 Subject: [PATCH 03/14] add a step to check pyproject.toml --- .../templates/github-action-python.yml.jinja2 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 index 88db34cd..0dd26f7b 100644 --- a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 +++ b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 @@ -123,4 +123,21 @@ jobs: coauthor_email: ${{ github.event.pull_request.user.login }}@users.noreply.github.com coauthor_name: ${{ github.event.pull_request.user.login }} {%- endraw %} + + - name: Set up - Get changed files for CHANGELOG.md + if: ${{ !cancelled() }} + id: detect-changed-files + uses: tj-actions/changed-files@v42 + with: + files_yaml: | + pyproject_toml: + - {{ project.path_from_root }}/CHANGELOG.md + python_files: + - {{ project.path_from_root }}/{{ project.root_package_name }}/**/*.py + - name: Test - Version bump + # This step will fail if there are python files changed but the version in pyproject.toml is not updated + if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + run: | + echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." + exit 1 {% endif %} \ No newline at end of file From a8eb517a27f3e8f50c206f1d43c5371ca65243ad Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 19:31:32 +0200 Subject: [PATCH 04/14] fix template --- .../language/python/templates/github-action-python.yml.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 index 0dd26f7b..c4b2d162 100644 --- a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 +++ b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 @@ -125,7 +125,7 @@ jobs: {%- endraw %} - name: Set up - Get changed files for CHANGELOG.md - if: ${{ !cancelled() }} + if: {% raw %}${{ !cancelled() }}{% endraw %} id: detect-changed-files uses: tj-actions/changed-files@v42 with: From feca827a7d3043ed165fe072fc05e29970e5424c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 16 Apr 2024 17:32:41 +0000 Subject: [PATCH 05/14] update lib/py_edge_device Co-authored-by: flxdot --- lib/py_edge_device/carlos/edge/device/runtime.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/py_edge_device/carlos/edge/device/runtime.py b/lib/py_edge_device/carlos/edge/device/runtime.py index 56a43c8b..14949287 100644 --- a/lib/py_edge_device/carlos/edge/device/runtime.py +++ b/lib/py_edge_device/carlos/edge/device/runtime.py @@ -1,5 +1,6 @@ """The runtime module contains the device runtime that is used as the main entry point of the application.""" + from datetime import timedelta from pathlib import Path From cf8271e13a21b69c3f898320f2f1b8e5905b069f Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 19:39:26 +0200 Subject: [PATCH 06/14] fix monorepo ci --- .../workflows/generate-monorepo-manager.yml | 161 +++++++++--------- .../templates/ci.install_workflow.yml.jinja2 | 2 +- .../generate-monorepo-manager.yml.jinja2 | 39 +++-- 3 files changed, 100 insertions(+), 102 deletions(-) diff --git a/.github/workflows/generate-monorepo-manager.yml b/.github/workflows/generate-monorepo-manager.yml index c680e4c2..ca6d9e3f 100644 --- a/.github/workflows/generate-monorepo-manager.yml +++ b/.github/workflows/generate-monorepo-manager.yml @@ -47,84 +47,83 @@ jobs: if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - - - uses: actions/checkout@v4 - name: Set up - Checkout lib/py_monorepo_manager - with: - ref: ${{ github.head_ref }} - token: ${{ secrets.WORKFLOW_TOKEN }} - - # Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow - # from installing Poetry every time, which can be slow. Note the use of the Poetry version - # number in the cache key, and the "-0" suffix: this allows you to invalidate the cache - # manually if/when you want to upgrade Poetry, or if something goes wrong. This could be - # mildly cleaner by using an environment variable, but I don't really care. - - name: Set up - Cache Poetry 1.7.1 - uses: actions/cache@v4 - with: - path: ~/.local - key: python-3.11-poetry-1.7.1 - - # If you wanted to use multiple Python versions, you'd have specify a matrix in the job and - # reference the matrix python version here. - - uses: actions/setup-python@v5 - name: Set up - Install Python 3.11 - with: - python-version: 3.11 - - # Install Poetry. You could do this manually, or there are several actions that do this. - # `snok/install-poetry` seems to be minimal yet complete, and really just calls out to - # Poetry's default install script, which feels correct. I pin the Poetry version here - # because Poetry does occasionally change APIs between versions and I don't want my - # actions to break if it does. - # - # The key configuration value here is `virtualenvs-in-project: true`: this creates the - # venv as a `.venv` in your testing directory, which allows the next step to easily - # cache it. - - name: Set up - Install Poetry 1.7.1 - uses: snok/install-poetry@v1 - with: - version: 1.7.1 - virtualenvs-create: true - virtualenvs-in-project: true - - # Cache your dependencies (i.e. all the stuff in your `pyproject.toml`). Note the cache - # key: if you're using multiple Python versions, or multiple OSes, you'd need to include - # them in the cache key. I'm not, so it can be simple and just depend on the poetry.lock. - - name: Set up - Cache lib/py_monorepo_manager dependencies - id: cache-deps - uses: actions/cache@v4 - with: - path: ./lib/py_monorepo_manager/.venv - key: py_monorepo_manager-${{ hashFiles('./lib/py_monorepo_manager/poetry.lock', './lib/py_dev_dependencies/**/*.py', './lib/py_dev_dependencies/**/*.sql', './lib/py_dev_dependencies/poetry.lock')}}-3.11-1.7.1 - - # Install dependencies. `--no-root` means "install all dependencies but not the project - # itself", which is what you want to avoid caching _your_ code. The `if` statement - # ensures this only runs on a cache miss. - - name: Set up - Install lib/py_monorepo_manager dependencies - run: poetry install --no-interaction --no-root --all-extras - working-directory: ./lib/py_monorepo_manager - - - name: generate files - # always run poetry install to ensure the entrypoint is up to date - run: poetry install && poetry run monorepo_manager all - working-directory: ./lib/py_monorepo_manager - - - name: Add add new workflow files - run: git add ./.github/workflows/* - - - name: Add add new library files - run: git add ./lib/* - - - name: Add add new service files - run: git add ./services/* - - - name: Add add new script files - run: git add ./scripts/* - - - uses: actions-js/push@master - name: Push changes - with: - github_token: ${{ secrets.WORKFLOW_TOKEN }} - branch: ${{ github.head_ref }} - message: "Update monorepo boilerplate" + - uses: actions/checkout@v4 + name: Set up - Checkout lib/py_monorepo_manager + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.WORKFLOW_TOKEN }} + + # Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow + # from installing Poetry every time, which can be slow. Note the use of the Poetry version + # number in the cache key, and the "-0" suffix: this allows you to invalidate the cache + # manually if/when you want to upgrade Poetry, or if something goes wrong. This could be + # mildly cleaner by using an environment variable, but I don't really care. + - name: Set up - Cache Poetry 1.7.1 + uses: actions/cache@v4 + with: + path: ~/.local + key: python-3.11-poetry-1.7.1 + + # If you wanted to use multiple Python versions, you'd have specify a matrix in the job and + # reference the matrix python version here. + - uses: actions/setup-python@v5 + name: Set up - Install Python 3.11 + with: + python-version: 3.11 + + # Install Poetry. You could do this manually, or there are several actions that do this. + # `snok/install-poetry` seems to be minimal yet complete, and really just calls out to + # Poetry's default install script, which feels correct. I pin the Poetry version here + # because Poetry does occasionally change APIs between versions and I don't want my + # actions to break if it does. + # + # The key configuration value here is `virtualenvs-in-project: true`: this creates the + # venv as a `.venv` in your testing directory, which allows the next step to easily + # cache it. + - name: Set up - Install Poetry 1.7.1 + uses: snok/install-poetry@v1 + with: + version: 1.7.1 + virtualenvs-create: true + virtualenvs-in-project: true + + # Cache your dependencies (i.e. all the stuff in your `pyproject.toml`). Note the cache + # key: if you're using multiple Python versions, or multiple OSes, you'd need to include + # them in the cache key. I'm not, so it can be simple and just depend on the poetry.lock. + - name: Set up - Cache lib/py_monorepo_manager dependencies + id: cache-deps + uses: actions/cache@v4 + with: + path: ./lib/py_monorepo_manager/.venv + key: py_monorepo_manager-${{ hashFiles('./lib/py_monorepo_manager/poetry.lock', './lib/py_dev_dependencies/**/*.py', './lib/py_dev_dependencies/**/*.sql', './lib/py_dev_dependencies/poetry.lock')}}-3.11-1.7.1 + + # Install dependencies. `--no-root` means "install all dependencies but not the project + # itself", which is what you want to avoid caching _your_ code. The `if` statement + # ensures this only runs on a cache miss. + - name: Set up - Install lib/py_monorepo_manager dependencies + run: poetry install --no-interaction --no-root --all-extras + working-directory: ./lib/py_monorepo_manager + + - name: generate files + # always run poetry install to ensure the entrypoint is up to date + run: poetry install && poetry run monorepo_manager all + working-directory: ./lib/py_monorepo_manager + + - name: Add add new workflow files + run: git add ./.github/workflows/* + + - name: Add add new library files + run: git add ./lib/* + + - name: Add add new service files + run: git add ./services/* + + - name: Add add new script files + run: git add ./scripts/* + + - uses: actions-js/push@master + name: Push changes + with: + github_token: ${{ secrets.WORKFLOW_TOKEN }} + branch: ${{ github.head_ref }} + message: "Update monorepo boilerplate" diff --git a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/ci.install_workflow.yml.jinja2 b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/ci.install_workflow.yml.jinja2 index 903a0592..a3de55c2 100644 --- a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/ci.install_workflow.yml.jinja2 +++ b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/ci.install_workflow.yml.jinja2 @@ -1,4 +1,4 @@ {% extends "ci.install.yml.jinja2" %} {%- block checkout_with %} -token: {% raw %}${{ secrets.WORKFLOW_TOKEN }}{% endraw %} + token: {% raw %}${{ secrets.WORKFLOW_TOKEN }}{% endraw %} {%- endblock %} diff --git a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/generate-monorepo-manager.yml.jinja2 b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/generate-monorepo-manager.yml.jinja2 index cdc0856e..8b1e6707 100644 --- a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/generate-monorepo-manager.yml.jinja2 +++ b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/generate-monorepo-manager.yml.jinja2 @@ -47,32 +47,31 @@ jobs: if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - {% macro include_runtime_install() %}{% include "ci.install_workflow.yml.jinja2" %}{% endmacro %} - {{ include_runtime_install()|indent(6) }} + {% include "ci.install_workflow.yml.jinja2" %} - - name: generate files - # always run poetry install to ensure the entrypoint is up to date - run: poetry install && poetry run monorepo_manager all - working-directory: ./{{ project.path_from_root }} + - name: generate files + # always run poetry install to ensure the entrypoint is up to date + run: poetry install && poetry run monorepo_manager all + working-directory: ./{{ project.path_from_root }} - - name: Add add new workflow files - run: git add ./.github/workflows/* + - name: Add add new workflow files + run: git add ./.github/workflows/* - - name: Add add new library files - run: git add ./lib/* + - name: Add add new library files + run: git add ./lib/* - - name: Add add new service files - run: git add ./services/* + - name: Add add new service files + run: git add ./services/* - - name: Add add new script files - run: git add ./scripts/* + - name: Add add new script files + run: git add ./scripts/* {%- raw %} - - uses: actions-js/push@master - name: Push changes - with: - github_token: ${{ secrets.WORKFLOW_TOKEN }} - branch: ${{ github.head_ref }} - message: "Update monorepo boilerplate" + - uses: actions-js/push@master + name: Push changes + with: + github_token: ${{ secrets.WORKFLOW_TOKEN }} + branch: ${{ github.head_ref }} + message: "Update monorepo boilerplate" {%- endraw %} From eb5391a6d941ef994af929858a7dd998af0d53ec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 16 Apr 2024 17:39:53 +0000 Subject: [PATCH 07/14] Update monorepo boilerplate --- .../workflows/test-lib-py_carlos_database.yml | 20 ++++++++++++++++++- .../test-lib-py_dev_dependencies.yml | 17 ++++++++++++++++ .github/workflows/test-lib-py_edge_device.yml | 17 ++++++++++++++++ .../workflows/test-lib-py_edge_interface.yml | 17 ++++++++++++++++ .github/workflows/test-lib-py_edge_server.yml | 20 ++++++++++++++++++- .../test-lib-py_monorepo_manager.yml | 17 ++++++++++++++++ .github/workflows/test-services-api.yml | 17 ++++++++++++++++ .github/workflows/test-services-device.yml | 17 ++++++++++++++++ scripts/update_all_python_venvs.sh | 2 +- services/device/Makefile | 4 ++++ 10 files changed, 145 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-lib-py_carlos_database.yml b/.github/workflows/test-lib-py_carlos_database.yml index 99f0cd1c..4b789d11 100644 --- a/.github/workflows/test-lib-py_carlos_database.yml +++ b/.github/workflows/test-lib-py_carlos_database.yml @@ -18,6 +18,7 @@ on: - .github/workflows/test-lib-py_carlos_database.yml - lib/py_carlos_database/** - lib/py_dev_dependencies/** + - lib/py_edge_interface/** workflow_dispatch: @@ -94,7 +95,7 @@ jobs: uses: actions/cache@v4 with: path: ./lib/py_carlos_database/.venv - key: py_carlos_database-${{ hashFiles('./lib/py_carlos_database/poetry.lock', './lib/py_dev_dependencies/**/*.py', './lib/py_dev_dependencies/**/*.sql', './lib/py_dev_dependencies/poetry.lock')}}-3.11-1.7.1 + key: py_carlos_database-${{ hashFiles('./lib/py_carlos_database/poetry.lock', './lib/py_dev_dependencies/**/*.py', './lib/py_edge_interface/**/*.py', './lib/py_dev_dependencies/**/*.sql', './lib/py_edge_interface/**/*.sql', './lib/py_dev_dependencies/poetry.lock', './lib/py_edge_interface/poetry.lock')}}-3.11-1.7.1 # Install dependencies. `--no-root` means "install all dependencies but not the project # itself", which is what you want to avoid caching _your_ code. The `if` statement @@ -147,3 +148,20 @@ jobs: message: "update lib/py_carlos_database" coauthor_email: ${{ github.event.pull_request.user.login }}@users.noreply.github.com coauthor_name: ${{ github.event.pull_request.user.login }} + + - name: Set up - Get changed files for CHANGELOG.md + if: ${{ !cancelled() }} + id: detect-changed-files + uses: tj-actions/changed-files@v42 + with: + files_yaml: | + pyproject_toml: + - lib/py_carlos_database/CHANGELOG.md + python_files: + - lib/py_carlos_database/carlos/**/*.py + - name: Test - Version bump + # This step will fail if there are python files changed but the version in pyproject.toml is not updated + if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + run: | + echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." + exit 1 diff --git a/.github/workflows/test-lib-py_dev_dependencies.yml b/.github/workflows/test-lib-py_dev_dependencies.yml index 2ad52970..5e2cacec 100644 --- a/.github/workflows/test-lib-py_dev_dependencies.yml +++ b/.github/workflows/test-lib-py_dev_dependencies.yml @@ -146,3 +146,20 @@ jobs: message: "update lib/py_dev_dependencies" coauthor_email: ${{ github.event.pull_request.user.login }}@users.noreply.github.com coauthor_name: ${{ github.event.pull_request.user.login }} + + - name: Set up - Get changed files for CHANGELOG.md + if: ${{ !cancelled() }} + id: detect-changed-files + uses: tj-actions/changed-files@v42 + with: + files_yaml: | + pyproject_toml: + - lib/py_dev_dependencies/CHANGELOG.md + python_files: + - lib/py_dev_dependencies/devtools/**/*.py + - name: Test - Version bump + # This step will fail if there are python files changed but the version in pyproject.toml is not updated + if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + run: | + echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." + exit 1 diff --git a/.github/workflows/test-lib-py_edge_device.yml b/.github/workflows/test-lib-py_edge_device.yml index f879aa0d..c05ef557 100644 --- a/.github/workflows/test-lib-py_edge_device.yml +++ b/.github/workflows/test-lib-py_edge_device.yml @@ -148,3 +148,20 @@ jobs: message: "update lib/py_edge_device" coauthor_email: ${{ github.event.pull_request.user.login }}@users.noreply.github.com coauthor_name: ${{ github.event.pull_request.user.login }} + + - name: Set up - Get changed files for CHANGELOG.md + if: ${{ !cancelled() }} + id: detect-changed-files + uses: tj-actions/changed-files@v42 + with: + files_yaml: | + pyproject_toml: + - lib/py_edge_device/CHANGELOG.md + python_files: + - lib/py_edge_device/carlos/**/*.py + - name: Test - Version bump + # This step will fail if there are python files changed but the version in pyproject.toml is not updated + if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + run: | + echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." + exit 1 diff --git a/.github/workflows/test-lib-py_edge_interface.yml b/.github/workflows/test-lib-py_edge_interface.yml index 13138159..4ad2b877 100644 --- a/.github/workflows/test-lib-py_edge_interface.yml +++ b/.github/workflows/test-lib-py_edge_interface.yml @@ -147,3 +147,20 @@ jobs: message: "update lib/py_edge_interface" coauthor_email: ${{ github.event.pull_request.user.login }}@users.noreply.github.com coauthor_name: ${{ github.event.pull_request.user.login }} + + - name: Set up - Get changed files for CHANGELOG.md + if: ${{ !cancelled() }} + id: detect-changed-files + uses: tj-actions/changed-files@v42 + with: + files_yaml: | + pyproject_toml: + - lib/py_edge_interface/CHANGELOG.md + python_files: + - lib/py_edge_interface/carlos/**/*.py + - name: Test - Version bump + # This step will fail if there are python files changed but the version in pyproject.toml is not updated + if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + run: | + echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." + exit 1 diff --git a/.github/workflows/test-lib-py_edge_server.yml b/.github/workflows/test-lib-py_edge_server.yml index 40f0aa05..c318b896 100644 --- a/.github/workflows/test-lib-py_edge_server.yml +++ b/.github/workflows/test-lib-py_edge_server.yml @@ -18,6 +18,7 @@ on: - .github/workflows/test-lib-py_edge_server.yml - lib/py_edge_server/** - lib/py_edge_interface/** + - lib/py_carlos_database/** - lib/py_dev_dependencies/** - lib/py_edge_device/** @@ -96,7 +97,7 @@ jobs: uses: actions/cache@v4 with: path: ./lib/py_edge_server/.venv - key: py_edge_server-${{ hashFiles('./lib/py_edge_server/poetry.lock', './lib/py_edge_interface/**/*.py', './lib/py_dev_dependencies/**/*.py', './lib/py_edge_device/**/*.py', './lib/py_edge_interface/**/*.sql', './lib/py_dev_dependencies/**/*.sql', './lib/py_edge_device/**/*.sql', './lib/py_edge_interface/poetry.lock', './lib/py_dev_dependencies/poetry.lock', './lib/py_edge_device/poetry.lock')}}-3.11-1.7.1 + key: py_edge_server-${{ hashFiles('./lib/py_edge_server/poetry.lock', './lib/py_edge_interface/**/*.py', './lib/py_carlos_database/**/*.py', './lib/py_dev_dependencies/**/*.py', './lib/py_edge_device/**/*.py', './lib/py_edge_interface/**/*.sql', './lib/py_carlos_database/**/*.sql', './lib/py_dev_dependencies/**/*.sql', './lib/py_edge_device/**/*.sql', './lib/py_edge_interface/poetry.lock', './lib/py_carlos_database/poetry.lock', './lib/py_dev_dependencies/poetry.lock', './lib/py_edge_device/poetry.lock')}}-3.11-1.7.1 # Install dependencies. `--no-root` means "install all dependencies but not the project # itself", which is what you want to avoid caching _your_ code. The `if` statement @@ -149,3 +150,20 @@ jobs: message: "update lib/py_edge_server" coauthor_email: ${{ github.event.pull_request.user.login }}@users.noreply.github.com coauthor_name: ${{ github.event.pull_request.user.login }} + + - name: Set up - Get changed files for CHANGELOG.md + if: ${{ !cancelled() }} + id: detect-changed-files + uses: tj-actions/changed-files@v42 + with: + files_yaml: | + pyproject_toml: + - lib/py_edge_server/CHANGELOG.md + python_files: + - lib/py_edge_server/carlos/**/*.py + - name: Test - Version bump + # This step will fail if there are python files changed but the version in pyproject.toml is not updated + if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + run: | + echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." + exit 1 diff --git a/.github/workflows/test-lib-py_monorepo_manager.yml b/.github/workflows/test-lib-py_monorepo_manager.yml index 02b20e1f..0c3f4b2b 100644 --- a/.github/workflows/test-lib-py_monorepo_manager.yml +++ b/.github/workflows/test-lib-py_monorepo_manager.yml @@ -147,3 +147,20 @@ jobs: message: "update lib/py_monorepo_manager" coauthor_email: ${{ github.event.pull_request.user.login }}@users.noreply.github.com coauthor_name: ${{ github.event.pull_request.user.login }} + + - name: Set up - Get changed files for CHANGELOG.md + if: ${{ !cancelled() }} + id: detect-changed-files + uses: tj-actions/changed-files@v42 + with: + files_yaml: | + pyproject_toml: + - lib/py_monorepo_manager/CHANGELOG.md + python_files: + - lib/py_monorepo_manager/monorepo_manager/**/*.py + - name: Test - Version bump + # This step will fail if there are python files changed but the version in pyproject.toml is not updated + if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + run: | + echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." + exit 1 diff --git a/.github/workflows/test-services-api.yml b/.github/workflows/test-services-api.yml index 86c37d8b..bfa8b887 100644 --- a/.github/workflows/test-services-api.yml +++ b/.github/workflows/test-services-api.yml @@ -172,3 +172,20 @@ jobs: message: "update services/api" coauthor_email: ${{ github.event.pull_request.user.login }}@users.noreply.github.com coauthor_name: ${{ github.event.pull_request.user.login }} + + - name: Set up - Get changed files for CHANGELOG.md + if: ${{ !cancelled() }} + id: detect-changed-files + uses: tj-actions/changed-files@v42 + with: + files_yaml: | + pyproject_toml: + - services/api/CHANGELOG.md + python_files: + - services/api/carlos/**/*.py + - name: Test - Version bump + # This step will fail if there are python files changed but the version in pyproject.toml is not updated + if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + run: | + echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." + exit 1 diff --git a/.github/workflows/test-services-device.yml b/.github/workflows/test-services-device.yml index 339c296b..06c68c03 100644 --- a/.github/workflows/test-services-device.yml +++ b/.github/workflows/test-services-device.yml @@ -148,3 +148,20 @@ jobs: message: "update services/device" coauthor_email: ${{ github.event.pull_request.user.login }}@users.noreply.github.com coauthor_name: ${{ github.event.pull_request.user.login }} + + - name: Set up - Get changed files for CHANGELOG.md + if: ${{ !cancelled() }} + id: detect-changed-files + uses: tj-actions/changed-files@v42 + with: + files_yaml: | + pyproject_toml: + - services/device/CHANGELOG.md + python_files: + - services/device/device/**/*.py + - name: Test - Version bump + # This step will fail if there are python files changed but the version in pyproject.toml is not updated + if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + run: | + echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." + exit 1 diff --git a/scripts/update_all_python_venvs.sh b/scripts/update_all_python_venvs.sh index 34e9dced..77f2627e 100644 --- a/scripts/update_all_python_venvs.sh +++ b/scripts/update_all_python_venvs.sh @@ -11,8 +11,8 @@ update_venv(){ # the order is important update_venv lib/py_dev_dependencies -update_venv lib/py_carlos_database update_venv lib/py_edge_interface +update_venv lib/py_carlos_database update_venv lib/py_edge_device update_venv lib/py_edge_server update_venv lib/py_monorepo_manager diff --git a/services/device/Makefile b/services/device/Makefile index 44f8a217..811dabba 100644 --- a/services/device/Makefile +++ b/services/device/Makefile @@ -50,3 +50,7 @@ ci-check: make mypy make pytest make coverage + + +run: + poetry run -m device.cli From acc0bc76c46d7b98cbb85b31a7e70be6aa4f2810 Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 19:45:39 +0200 Subject: [PATCH 08/14] fix ci check --- .github/workflows/test-lib-py_carlos_database.yml | 4 ++-- .github/workflows/test-lib-py_dev_dependencies.yml | 4 ++-- .github/workflows/test-lib-py_edge_device.yml | 4 ++-- .github/workflows/test-lib-py_edge_interface.yml | 4 ++-- .github/workflows/test-lib-py_edge_server.yml | 4 ++-- .github/workflows/test-lib-py_monorepo_manager.yml | 4 ++-- .github/workflows/test-services-api.yml | 4 ++-- .github/workflows/test-services-device.yml | 4 ++-- .../language/python/templates/github-action-python.yml.jinja2 | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test-lib-py_carlos_database.yml b/.github/workflows/test-lib-py_carlos_database.yml index 4b789d11..a4215b4d 100644 --- a/.github/workflows/test-lib-py_carlos_database.yml +++ b/.github/workflows/test-lib-py_carlos_database.yml @@ -156,12 +156,12 @@ jobs: with: files_yaml: | pyproject_toml: - - lib/py_carlos_database/CHANGELOG.md + - lib/py_carlos_database/pyproject.toml python_files: - lib/py_carlos_database/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_dev_dependencies.yml b/.github/workflows/test-lib-py_dev_dependencies.yml index 5e2cacec..e283d802 100644 --- a/.github/workflows/test-lib-py_dev_dependencies.yml +++ b/.github/workflows/test-lib-py_dev_dependencies.yml @@ -154,12 +154,12 @@ jobs: with: files_yaml: | pyproject_toml: - - lib/py_dev_dependencies/CHANGELOG.md + - lib/py_dev_dependencies/pyproject.toml python_files: - lib/py_dev_dependencies/devtools/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_edge_device.yml b/.github/workflows/test-lib-py_edge_device.yml index c05ef557..3c5a09a0 100644 --- a/.github/workflows/test-lib-py_edge_device.yml +++ b/.github/workflows/test-lib-py_edge_device.yml @@ -156,12 +156,12 @@ jobs: with: files_yaml: | pyproject_toml: - - lib/py_edge_device/CHANGELOG.md + - lib/py_edge_device/pyproject.toml python_files: - lib/py_edge_device/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_edge_interface.yml b/.github/workflows/test-lib-py_edge_interface.yml index 4ad2b877..08d9c603 100644 --- a/.github/workflows/test-lib-py_edge_interface.yml +++ b/.github/workflows/test-lib-py_edge_interface.yml @@ -155,12 +155,12 @@ jobs: with: files_yaml: | pyproject_toml: - - lib/py_edge_interface/CHANGELOG.md + - lib/py_edge_interface/pyproject.toml python_files: - lib/py_edge_interface/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_edge_server.yml b/.github/workflows/test-lib-py_edge_server.yml index c318b896..7ecc2543 100644 --- a/.github/workflows/test-lib-py_edge_server.yml +++ b/.github/workflows/test-lib-py_edge_server.yml @@ -158,12 +158,12 @@ jobs: with: files_yaml: | pyproject_toml: - - lib/py_edge_server/CHANGELOG.md + - lib/py_edge_server/pyproject.toml python_files: - lib/py_edge_server/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_monorepo_manager.yml b/.github/workflows/test-lib-py_monorepo_manager.yml index 0c3f4b2b..188ae66d 100644 --- a/.github/workflows/test-lib-py_monorepo_manager.yml +++ b/.github/workflows/test-lib-py_monorepo_manager.yml @@ -155,12 +155,12 @@ jobs: with: files_yaml: | pyproject_toml: - - lib/py_monorepo_manager/CHANGELOG.md + - lib/py_monorepo_manager/pyproject.toml python_files: - lib/py_monorepo_manager/monorepo_manager/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-services-api.yml b/.github/workflows/test-services-api.yml index bfa8b887..5fd9ab1f 100644 --- a/.github/workflows/test-services-api.yml +++ b/.github/workflows/test-services-api.yml @@ -180,12 +180,12 @@ jobs: with: files_yaml: | pyproject_toml: - - services/api/CHANGELOG.md + - services/api/pyproject.toml python_files: - services/api/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-services-device.yml b/.github/workflows/test-services-device.yml index 06c68c03..23e170d9 100644 --- a/.github/workflows/test-services-device.yml +++ b/.github/workflows/test-services-device.yml @@ -156,12 +156,12 @@ jobs: with: files_yaml: | pyproject_toml: - - services/device/CHANGELOG.md + - services/device/pyproject.toml python_files: - services/device/device/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 index c4b2d162..b4de160f 100644 --- a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 +++ b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 @@ -131,12 +131,12 @@ jobs: with: files_yaml: | pyproject_toml: - - {{ project.path_from_root }}/CHANGELOG.md + - {{ project.path_from_root }}/pyproject.toml python_files: - {{ project.path_from_root }}/{{ project.root_package_name }}/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files == 'true') && (steps.detect-changed-files.outputs.pyproject_toml == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 From 503226ae1fdba7669c98e30b9c1c2b95866e8a66 Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 19:52:35 +0200 Subject: [PATCH 09/14] fix ci check --- .github/workflows/test-lib-py_carlos_database.yml | 3 ++- .github/workflows/test-lib-py_dev_dependencies.yml | 3 ++- .github/workflows/test-lib-py_edge_device.yml | 3 ++- .github/workflows/test-lib-py_edge_interface.yml | 3 ++- .github/workflows/test-lib-py_edge_server.yml | 3 ++- .github/workflows/test-lib-py_monorepo_manager.yml | 3 ++- .github/workflows/test-services-api.yml | 3 ++- .github/workflows/test-services-device.yml | 3 ++- .../language/python/templates/github-action-python.yml.jinja2 | 3 ++- 9 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-lib-py_carlos_database.yml b/.github/workflows/test-lib-py_carlos_database.yml index a4215b4d..d5212a62 100644 --- a/.github/workflows/test-lib-py_carlos_database.yml +++ b/.github/workflows/test-lib-py_carlos_database.yml @@ -157,11 +157,12 @@ jobs: files_yaml: | pyproject_toml: - lib/py_carlos_database/pyproject.toml + - lib/py_carlos_database/poetry.lock python_files: - lib/py_carlos_database/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_dev_dependencies.yml b/.github/workflows/test-lib-py_dev_dependencies.yml index e283d802..daf55e10 100644 --- a/.github/workflows/test-lib-py_dev_dependencies.yml +++ b/.github/workflows/test-lib-py_dev_dependencies.yml @@ -155,11 +155,12 @@ jobs: files_yaml: | pyproject_toml: - lib/py_dev_dependencies/pyproject.toml + - lib/py_dev_dependencies/poetry.lock python_files: - lib/py_dev_dependencies/devtools/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_edge_device.yml b/.github/workflows/test-lib-py_edge_device.yml index 3c5a09a0..81b6a6ab 100644 --- a/.github/workflows/test-lib-py_edge_device.yml +++ b/.github/workflows/test-lib-py_edge_device.yml @@ -157,11 +157,12 @@ jobs: files_yaml: | pyproject_toml: - lib/py_edge_device/pyproject.toml + - lib/py_edge_device/poetry.lock python_files: - lib/py_edge_device/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_edge_interface.yml b/.github/workflows/test-lib-py_edge_interface.yml index 08d9c603..08039009 100644 --- a/.github/workflows/test-lib-py_edge_interface.yml +++ b/.github/workflows/test-lib-py_edge_interface.yml @@ -156,11 +156,12 @@ jobs: files_yaml: | pyproject_toml: - lib/py_edge_interface/pyproject.toml + - lib/py_edge_interface/poetry.lock python_files: - lib/py_edge_interface/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_edge_server.yml b/.github/workflows/test-lib-py_edge_server.yml index 7ecc2543..1ff1fa02 100644 --- a/.github/workflows/test-lib-py_edge_server.yml +++ b/.github/workflows/test-lib-py_edge_server.yml @@ -159,11 +159,12 @@ jobs: files_yaml: | pyproject_toml: - lib/py_edge_server/pyproject.toml + - lib/py_edge_server/poetry.lock python_files: - lib/py_edge_server/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_monorepo_manager.yml b/.github/workflows/test-lib-py_monorepo_manager.yml index 188ae66d..e4a9daa7 100644 --- a/.github/workflows/test-lib-py_monorepo_manager.yml +++ b/.github/workflows/test-lib-py_monorepo_manager.yml @@ -156,11 +156,12 @@ jobs: files_yaml: | pyproject_toml: - lib/py_monorepo_manager/pyproject.toml + - lib/py_monorepo_manager/poetry.lock python_files: - lib/py_monorepo_manager/monorepo_manager/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-services-api.yml b/.github/workflows/test-services-api.yml index 5fd9ab1f..82c7e9a8 100644 --- a/.github/workflows/test-services-api.yml +++ b/.github/workflows/test-services-api.yml @@ -181,11 +181,12 @@ jobs: files_yaml: | pyproject_toml: - services/api/pyproject.toml + - services/api/poetry.lock python_files: - services/api/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-services-device.yml b/.github/workflows/test-services-device.yml index 23e170d9..13a0d17f 100644 --- a/.github/workflows/test-services-device.yml +++ b/.github/workflows/test-services-device.yml @@ -157,11 +157,12 @@ jobs: files_yaml: | pyproject_toml: - services/device/pyproject.toml + - services/device/poetry.lock python_files: - services/device/device/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 index b4de160f..9bfb6967 100644 --- a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 +++ b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 @@ -132,11 +132,12 @@ jobs: files_yaml: | pyproject_toml: - {{ project.path_from_root }}/pyproject.toml + - {{ project.path_from_root }}/poetry.lock python_files: - {{ project.path_from_root }}/{{ project.root_package_name }}/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 From 9521c028de11396687e26478577e9290eecb5589 Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 20:07:28 +0200 Subject: [PATCH 10/14] add nice banner on startup --- services/device/device/run.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/services/device/device/run.py b/services/device/device/run.py index 2a977751..55800539 100644 --- a/services/device/device/run.py +++ b/services/device/device/run.py @@ -1,4 +1,6 @@ from carlos.edge.device import DeviceRuntime, read_config +from carlos.edge.device.constants import VERSION +from loguru import logger from device.connection import read_connection_settings from device.websocket import DeviceWebsocketClient @@ -8,6 +10,20 @@ async def main(): # pragma: no cover """The main entry point of the application.""" + logger.info( + r""" + + ______ __ ____ _ + / ____/____ _ _____ / /____ _____ / __ \ ___ _ __ (_)_____ ___ + / / / __ `// ___// // __ \ / ___// / / // _ \| | / // // ___// _ \ + / /___ / /_/ // / / // /_/ /(__ )/ /_/ // __/| |/ // // /__ / __/ + \____/ \__,_//_/ /_/ \____//____//_____/ \___/ |___//_/ \___/ \___/ + + """ + ) + + logger.info(f"Starting Carlos device (v{VERSION})...") + device_config = read_config() device_connection = read_connection_settings() protocol = DeviceWebsocketClient( From 7268ff5a2a5fcaf20a626bf1c3dba65a883e7276 Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 20:09:33 +0200 Subject: [PATCH 11/14] add more usefull commands --- .monorepo_manager.yaml | 6 +++++- services/device/Makefile | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.monorepo_manager.yaml b/.monorepo_manager.yaml index 6a6f2f13..499f1f5a 100644 --- a/.monorepo_manager.yaml +++ b/.monorepo_manager.yaml @@ -41,8 +41,12 @@ services/api: services/device: language: python makefile: + config: + - poetry run python -m device.cli config create + config-show: + - poetry run python -m device.cli config show run: - - poetry run -m device.cli + - poetry run python -m device.cli run services/frontend: language: javascript services/nginx: diff --git a/services/device/Makefile b/services/device/Makefile index 811dabba..61c547ad 100644 --- a/services/device/Makefile +++ b/services/device/Makefile @@ -52,5 +52,9 @@ ci-check: make coverage +config: + poetry run python -m device.cli config create +config-show: + poetry run python -m device.cli config show run: - poetry run -m device.cli + poetry run python -m device.cli run From af1a105691a5645a6ba29c78eb794271fc03a0ab Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 20:10:22 +0200 Subject: [PATCH 12/14] update project files --- lib/py_edge_device/poetry.lock | 46 +++++++++++++++---------------- lib/py_edge_device/pyproject.toml | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/py_edge_device/poetry.lock b/lib/py_edge_device/poetry.lock index 98e374dd..96ec1d33 100644 --- a/lib/py_edge_device/poetry.lock +++ b/lib/py_edge_device/poetry.lock @@ -79,33 +79,33 @@ tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "p [[package]] name = "black" -version = "24.3.0" +version = "24.4.0" description = "The uncompromising code formatter." optional = false python-versions = ">=3.8" files = [ - {file = "black-24.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7d5e026f8da0322b5662fa7a8e752b3fa2dac1c1cbc213c3d7ff9bdd0ab12395"}, - {file = "black-24.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9f50ea1132e2189d8dff0115ab75b65590a3e97de1e143795adb4ce317934995"}, - {file = "black-24.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2af80566f43c85f5797365077fb64a393861a3730bd110971ab7a0c94e873e7"}, - {file = "black-24.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:4be5bb28e090456adfc1255e03967fb67ca846a03be7aadf6249096100ee32d0"}, - {file = "black-24.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4f1373a7808a8f135b774039f61d59e4be7eb56b2513d3d2f02a8b9365b8a8a9"}, - {file = "black-24.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:aadf7a02d947936ee418777e0247ea114f78aff0d0959461057cae8a04f20597"}, - {file = "black-24.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65c02e4ea2ae09d16314d30912a58ada9a5c4fdfedf9512d23326128ac08ac3d"}, - {file = "black-24.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:bf21b7b230718a5f08bd32d5e4f1db7fc8788345c8aea1d155fc17852b3410f5"}, - {file = "black-24.3.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:2818cf72dfd5d289e48f37ccfa08b460bf469e67fb7c4abb07edc2e9f16fb63f"}, - {file = "black-24.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4acf672def7eb1725f41f38bf6bf425c8237248bb0804faa3965c036f7672d11"}, - {file = "black-24.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c7ed6668cbbfcd231fa0dc1b137d3e40c04c7f786e626b405c62bcd5db5857e4"}, - {file = "black-24.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:56f52cfbd3dabe2798d76dbdd299faa046a901041faf2cf33288bc4e6dae57b5"}, - {file = "black-24.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:79dcf34b33e38ed1b17434693763301d7ccbd1c5860674a8f871bd15139e7837"}, - {file = "black-24.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e19cb1c6365fd6dc38a6eae2dcb691d7d83935c10215aef8e6c38edee3f77abd"}, - {file = "black-24.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65b76c275e4c1c5ce6e9870911384bff5ca31ab63d19c76811cb1fb162678213"}, - {file = "black-24.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:b5991d523eee14756f3c8d5df5231550ae8993e2286b8014e2fdea7156ed0959"}, - {file = "black-24.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c45f8dff244b3c431b36e3224b6be4a127c6aca780853574c00faf99258041eb"}, - {file = "black-24.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6905238a754ceb7788a73f02b45637d820b2f5478b20fec82ea865e4f5d4d9f7"}, - {file = "black-24.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7de8d330763c66663661a1ffd432274a2f92f07feeddd89ffd085b5744f85e7"}, - {file = "black-24.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:7bb041dca0d784697af4646d3b62ba4a6b028276ae878e53f6b4f74ddd6db99f"}, - {file = "black-24.3.0-py3-none-any.whl", hash = "sha256:41622020d7120e01d377f74249e677039d20e6344ff5851de8a10f11f513bf93"}, - {file = "black-24.3.0.tar.gz", hash = "sha256:a0c9c4a0771afc6919578cec71ce82a3e31e054904e7197deacbc9382671c41f"}, + {file = "black-24.4.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6ad001a9ddd9b8dfd1b434d566be39b1cd502802c8d38bbb1ba612afda2ef436"}, + {file = "black-24.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e3a3a092b8b756c643fe45f4624dbd5a389f770a4ac294cf4d0fce6af86addaf"}, + {file = "black-24.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dae79397f367ac8d7adb6c779813328f6d690943f64b32983e896bcccd18cbad"}, + {file = "black-24.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:71d998b73c957444fb7c52096c3843875f4b6b47a54972598741fe9a7f737fcb"}, + {file = "black-24.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:8e5537f456a22cf5cfcb2707803431d2feeb82ab3748ade280d6ccd0b40ed2e8"}, + {file = "black-24.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:64e60a7edd71fd542a10a9643bf369bfd2644de95ec71e86790b063aa02ff745"}, + {file = "black-24.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5cd5b4f76056cecce3e69b0d4c228326d2595f506797f40b9233424e2524c070"}, + {file = "black-24.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:64578cf99b6b46a6301bc28bdb89f9d6f9b592b1c5837818a177c98525dbe397"}, + {file = "black-24.4.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f95cece33329dc4aa3b0e1a771c41075812e46cf3d6e3f1dfe3d91ff09826ed2"}, + {file = "black-24.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4396ca365a4310beef84d446ca5016f671b10f07abdba3e4e4304218d2c71d33"}, + {file = "black-24.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:44d99dfdf37a2a00a6f7a8dcbd19edf361d056ee51093b2445de7ca09adac965"}, + {file = "black-24.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:21f9407063ec71c5580b8ad975653c66508d6a9f57bd008bb8691d273705adcd"}, + {file = "black-24.4.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:652e55bb722ca026299eb74e53880ee2315b181dfdd44dca98e43448620ddec1"}, + {file = "black-24.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7f2966b9b2b3b7104fca9d75b2ee856fe3fdd7ed9e47c753a4bb1a675f2caab8"}, + {file = "black-24.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1bb9ca06e556a09f7f7177bc7cb604e5ed2d2df1e9119e4f7d2f1f7071c32e5d"}, + {file = "black-24.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:d4e71cdebdc8efeb6deaf5f2deb28325f8614d48426bed118ecc2dcaefb9ebf3"}, + {file = "black-24.4.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6644f97a7ef6f401a150cca551a1ff97e03c25d8519ee0bbc9b0058772882665"}, + {file = "black-24.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:75a2d0b4f5eb81f7eebc31f788f9830a6ce10a68c91fbe0fade34fff7a2836e6"}, + {file = "black-24.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eb949f56a63c5e134dfdca12091e98ffb5fd446293ebae123d10fc1abad00b9e"}, + {file = "black-24.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:7852b05d02b5b9a8c893ab95863ef8986e4dda29af80bbbda94d7aee1abf8702"}, + {file = "black-24.4.0-py3-none-any.whl", hash = "sha256:74eb9b5420e26b42c00a3ff470dc0cd144b80a766128b1771d07643165e08d0e"}, + {file = "black-24.4.0.tar.gz", hash = "sha256:f07b69fda20578367eaebbd670ff8fc653ab181e1ff95d84497f9fa20e7d0641"}, ] [package.dependencies] diff --git a/lib/py_edge_device/pyproject.toml b/lib/py_edge_device/pyproject.toml index fc71ba4b..de3e1ec8 100644 --- a/lib/py_edge_device/pyproject.toml +++ b/lib/py_edge_device/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "carlos.edge.device" -version = "0.1.0" +version = "0.1.1" description = "The library for the edge device of the carlos project." authors = ["Felix Fanghanel"] license = "MIT" From ca901f2f560ed59a57c5535bef1aeba8eb508275 Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 20:10:53 +0200 Subject: [PATCH 13/14] update lock files --- services/device/poetry.lock | 2 +- services/device/pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/device/poetry.lock b/services/device/poetry.lock index 67896057..b76f5872 100644 --- a/services/device/poetry.lock +++ b/services/device/poetry.lock @@ -123,7 +123,7 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "carlos-edge-device" -version = "0.1.0" +version = "0.1.1" description = "The library for the edge device of the carlos project." optional = false python-versions = ">=3.11,<3.12" diff --git a/services/device/pyproject.toml b/services/device/pyproject.toml index 9ca6e5e8..32eec1ee 100644 --- a/services/device/pyproject.toml +++ b/services/device/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "device" -version = "0.1.0" +version = "0.1.1" description = "The device runtime for the Carlos Edge Computing Platform" authors = ["Felix Fanghänel"] readme = "README.md" From c2f91f5d6d300eda0d5cd02acd4bc9323e78d1bc Mon Sep 17 00:00:00 2001 From: flxdot Date: Tue, 16 Apr 2024 20:11:51 +0200 Subject: [PATCH 14/14] revert ci checks to only check pyproject.toml --- .github/workflows/test-lib-py_carlos_database.yml | 3 +-- .github/workflows/test-lib-py_dev_dependencies.yml | 3 +-- .github/workflows/test-lib-py_edge_device.yml | 3 +-- .github/workflows/test-lib-py_edge_interface.yml | 3 +-- .github/workflows/test-lib-py_edge_server.yml | 3 +-- .github/workflows/test-lib-py_monorepo_manager.yml | 3 +-- .github/workflows/test-services-api.yml | 3 +-- .github/workflows/test-services-device.yml | 3 +-- .../language/python/templates/github-action-python.yml.jinja2 | 3 +-- 9 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test-lib-py_carlos_database.yml b/.github/workflows/test-lib-py_carlos_database.yml index d5212a62..a4215b4d 100644 --- a/.github/workflows/test-lib-py_carlos_database.yml +++ b/.github/workflows/test-lib-py_carlos_database.yml @@ -157,12 +157,11 @@ jobs: files_yaml: | pyproject_toml: - lib/py_carlos_database/pyproject.toml - - lib/py_carlos_database/poetry.lock python_files: - lib/py_carlos_database/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_dev_dependencies.yml b/.github/workflows/test-lib-py_dev_dependencies.yml index daf55e10..e283d802 100644 --- a/.github/workflows/test-lib-py_dev_dependencies.yml +++ b/.github/workflows/test-lib-py_dev_dependencies.yml @@ -155,12 +155,11 @@ jobs: files_yaml: | pyproject_toml: - lib/py_dev_dependencies/pyproject.toml - - lib/py_dev_dependencies/poetry.lock python_files: - lib/py_dev_dependencies/devtools/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_edge_device.yml b/.github/workflows/test-lib-py_edge_device.yml index 81b6a6ab..3c5a09a0 100644 --- a/.github/workflows/test-lib-py_edge_device.yml +++ b/.github/workflows/test-lib-py_edge_device.yml @@ -157,12 +157,11 @@ jobs: files_yaml: | pyproject_toml: - lib/py_edge_device/pyproject.toml - - lib/py_edge_device/poetry.lock python_files: - lib/py_edge_device/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_edge_interface.yml b/.github/workflows/test-lib-py_edge_interface.yml index 08039009..08d9c603 100644 --- a/.github/workflows/test-lib-py_edge_interface.yml +++ b/.github/workflows/test-lib-py_edge_interface.yml @@ -156,12 +156,11 @@ jobs: files_yaml: | pyproject_toml: - lib/py_edge_interface/pyproject.toml - - lib/py_edge_interface/poetry.lock python_files: - lib/py_edge_interface/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_edge_server.yml b/.github/workflows/test-lib-py_edge_server.yml index 1ff1fa02..7ecc2543 100644 --- a/.github/workflows/test-lib-py_edge_server.yml +++ b/.github/workflows/test-lib-py_edge_server.yml @@ -159,12 +159,11 @@ jobs: files_yaml: | pyproject_toml: - lib/py_edge_server/pyproject.toml - - lib/py_edge_server/poetry.lock python_files: - lib/py_edge_server/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-lib-py_monorepo_manager.yml b/.github/workflows/test-lib-py_monorepo_manager.yml index e4a9daa7..188ae66d 100644 --- a/.github/workflows/test-lib-py_monorepo_manager.yml +++ b/.github/workflows/test-lib-py_monorepo_manager.yml @@ -156,12 +156,11 @@ jobs: files_yaml: | pyproject_toml: - lib/py_monorepo_manager/pyproject.toml - - lib/py_monorepo_manager/poetry.lock python_files: - lib/py_monorepo_manager/monorepo_manager/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-services-api.yml b/.github/workflows/test-services-api.yml index 82c7e9a8..5fd9ab1f 100644 --- a/.github/workflows/test-services-api.yml +++ b/.github/workflows/test-services-api.yml @@ -181,12 +181,11 @@ jobs: files_yaml: | pyproject_toml: - services/api/pyproject.toml - - services/api/poetry.lock python_files: - services/api/carlos/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/.github/workflows/test-services-device.yml b/.github/workflows/test-services-device.yml index 13a0d17f..23e170d9 100644 --- a/.github/workflows/test-services-device.yml +++ b/.github/workflows/test-services-device.yml @@ -157,12 +157,11 @@ jobs: files_yaml: | pyproject_toml: - services/device/pyproject.toml - - services/device/poetry.lock python_files: - services/device/device/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1 diff --git a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 index 9bfb6967..b4de160f 100644 --- a/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 +++ b/lib/py_monorepo_manager/monorepo_manager/language/python/templates/github-action-python.yml.jinja2 @@ -132,12 +132,11 @@ jobs: files_yaml: | pyproject_toml: - {{ project.path_from_root }}/pyproject.toml - - {{ project.path_from_root }}/poetry.lock python_files: - {{ project.path_from_root }}/{{ project.root_package_name }}/**/*.py - name: Test - Version bump # This step will fail if there are python files changed but the version in pyproject.toml is not updated - if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_all_changed_files_count != '2') && !cancelled() + if: (steps.detect-changed-files.outputs.python_files_any_changed == 'true') && (steps.detect-changed-files.outputs.pyproject_toml_any_changed == 'false') && !cancelled() run: | echo "No changes in pyproject.toml but there are changes in python files. Please update the version in pyproject.toml if the code changes. Otherwise the automatic update of the carlos device may fail." exit 1