diff --git a/.github/workflows/conventional-label.yml b/.github/workflows/conventional-label.yml deleted file mode 100644 index 9894c1b..0000000 --- a/.github/workflows/conventional-label.yml +++ /dev/null @@ -1,10 +0,0 @@ -# auto add labels to PRs -on: - pull_request_target: - types: [ opened, edited ] -name: conventional-release-labels -jobs: - label: - runs-on: ubuntu-latest - steps: - - uses: bcoe/conventional-release-labels@v1 diff --git a/.github/workflows/propose_release.yml b/.github/workflows/propose_release.yml new file mode 100644 index 0000000..7e4c96f --- /dev/null +++ b/.github/workflows/propose_release.yml @@ -0,0 +1,32 @@ +name: Propose Stable Release +on: + workflow_dispatch: + inputs: + release_type: + type: choice + description: Release Type + options: + - patch + - minor + - major +jobs: + update_version: + uses: neongeckocom/.github/.github/workflows/propose_semver_release.yml@master + with: + branch: dev + release_type: ${{ inputs.release_type }} + update_changelog: True + version_file: neon_phal_plugin_system/version.py + alpha_var: VERSION_ALPHA + build_var: VERSION_BUILD + minor_var: VERSION_MINOR + major_var: VERSION_MAJOR + pull_changes: + uses: neongeckocom/.github/.github/workflows/pull_master.yml@master + needs: update_version + with: + pr_reviewer: neonreviewers + pr_assignee: ${{ github.actor }} + pr_draft: false + pr_title: ${{ needs.update_version.outputs.version }} + pr_body: ${{ needs.update_version.outputs.changelog }} \ No newline at end of file diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml new file mode 100644 index 0000000..e4b3fa3 --- /dev/null +++ b/.github/workflows/publish_release.yml @@ -0,0 +1,12 @@ +# This workflow will generate a release distribution and upload it to PyPI + +name: Publish Build and GitHub Release +on: + push: + branches: + - master + +jobs: + build_and_publish_pypi_and_release: + uses: neongeckocom/.github/.github/workflows/publish_stable_release.yml@master + secrets: inherit diff --git a/.github/workflows/publish_stable.yml b/.github/workflows/publish_stable.yml deleted file mode 100644 index 0b55ffa..0000000 --- a/.github/workflows/publish_stable.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Stable Release -on: - push: - branches: [master] - workflow_dispatch: - -jobs: - publish_stable: - uses: TigreGotico/gh-automations/.github/workflows/publish-stable.yml@master - secrets: inherit - with: - branch: 'master' - version_file: 'ovos_PHAL_plugin_system/version.py' - setup_py: 'setup.py' - publish_release: true - - publish_pypi: - needs: publish_stable - if: success() # Ensure this job only runs if the previous job succeeds - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: dev - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: version - run: echo "::set-output name=version::$(python setup.py --version)" - id: version - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: V${{ steps.version.outputs.version }} - release_name: Release ${{ steps.version.outputs.version }} - body: | - Changes in this Release - ${{ steps.changelog.outputs.changelog }} - draft: false - prerelease: true - commitish: dev - - name: Build Distribution Packages - run: | - python setup.py sdist bdist_wheel - - name: Publish to Test PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{secrets.PYPI_TOKEN}} - - - sync_dev: - needs: publish_stable - if: success() # Ensure this job only runs if the previous job succeeds - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - ref: master - - name: Push master -> dev - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: dev \ No newline at end of file diff --git a/.github/workflows/publish_test_build.yml b/.github/workflows/publish_test_build.yml new file mode 100644 index 0000000..6465c49 --- /dev/null +++ b/.github/workflows/publish_test_build.yml @@ -0,0 +1,22 @@ +# This workflow will generate a distribution and upload it to PyPI + +name: Publish Alpha Build +on: + push: + branches: + - dev + paths-ignore: + - 'neon_phal_plugin_system/version.py' + +jobs: + publish_alpha_release: + uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master + secrets: inherit + with: + version_file: "neon_phal_plugin_system/version.py" + alpha_var: VERSION_ALPHA + build_var: VERSION_BUILD + minor_var: VERSION_MINOR + major_var: VERSION_MAJOR + publish_prerelease: true + update_changelog: true \ No newline at end of file diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml deleted file mode 100644 index 7f2cf02..0000000 --- a/.github/workflows/release_workflow.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Release Alpha and Propose Stable - -on: - pull_request: - types: [closed] - branches: [dev] - -jobs: - publish_alpha: - if: github.event.pull_request.merged == true - uses: TigreGotico/gh-automations/.github/workflows/publish-alpha.yml@master - secrets: inherit - with: - branch: 'dev' - version_file: 'ovos_PHAL_plugin_system/version.py' - setup_py: 'setup.py' - update_changelog: true - publish_prerelease: true - changelog_max_issues: 100 - - notify: - if: github.event.pull_request.merged == true - needs: publish_alpha - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Send message to Matrix bots channel - id: matrix-chat-message - uses: fadenb/matrix-chat-message@v0.0.6 - with: - homeserver: 'matrix.org' - token: ${{ secrets.MATRIX_TOKEN }} - channel: '!WjxEKjjINpyBRPFgxl:krbel.duckdns.org' - message: | - new ${{ github.event.repository.name }} PR merged! https://github.com/${{ github.repository }}/pull/${{ github.event.number }} - - publish_pypi: - needs: publish_alpha - if: success() # Ensure this job only runs if the previous job succeeds - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: dev - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: version - run: echo "::set-output name=version::$(python setup.py --version)" - id: version - - name: Build Distribution Packages - run: | - python setup.py sdist bdist_wheel - - name: Publish to Test PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{secrets.PYPI_TOKEN}} - - - propose_release: - needs: publish_alpha - if: success() # Ensure this job only runs if the previous job succeeds - runs-on: ubuntu-latest - steps: - - name: Checkout dev branch - uses: actions/checkout@v3 - with: - ref: dev - - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - - name: Get version from setup.py - id: get_version - run: | - VERSION=$(python setup.py --version) - echo "VERSION=$VERSION" >> $GITHUB_ENV - - - name: Create and push new branch - run: | - git checkout -b release-${{ env.VERSION }} - git push origin release-${{ env.VERSION }} - - - name: Open Pull Request from dev to master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Variables - BRANCH_NAME="release-${{ env.VERSION }}" - BASE_BRANCH="master" - HEAD_BRANCH="release-${{ env.VERSION }}" - PR_TITLE="Release ${{ env.VERSION }}" - PR_BODY="Human review requested!" - - # Create a PR using GitHub API - curl -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: token $GITHUB_TOKEN" \ - -d "{\"title\":\"$PR_TITLE\",\"body\":\"$PR_BODY\",\"head\":\"$HEAD_BRANCH\",\"base\":\"$BASE_BRANCH\"}" \ - https://api.github.com/repos/${{ github.repository }}/pulls - diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 3e380f3..2fa42bf 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -1,8 +1,12 @@ -name: Unit Tests +# This workflow will run unit tests + +name: Run Unit Tests on: push: workflow_dispatch: - + pull_request: + branches: + - master jobs: py_build_tests: uses: neongeckocom/.github/.github/workflows/python_build_tests.yml@master diff --git a/README.md b/README.md index 1c6ca48..ca7c77f 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,19 @@ -# ovos-PHAL-plugin - system +# neon-phal-plugin-system -Provides system specific commands to OVOS. +Provides system specific commands to Neon. The dbus interface for this plugin is not yet established. # Install -`pip install ovos-PHAL-plugin-system` +`pip install neon-phal-plugin-system` # Config -This plugin is a Admin plugin, it needs to run as root and to be explicitly enabled in mycroft.conf +This plugin is an Admin plugin, it needs to run as root and to be explicitly enabled in mycroft.conf -```javascript -{ -"PHAL": { - "admin": { - "ovos-PHAL-plugin-system": {"enabled": true} - } -} -} -``` -if not enabled (omit config above) it will be run as the regular user, you need to ensure [polkit policy](#) is set to allow usage of systemctl without sudo. Not yet implemented - - -handle bus events to interact with the OS - -```python -self.bus.on("system.ntp.sync", self.handle_ntp_sync_request) -self.bus.on("system.ssh.status", self.handle_ssh_status) -self.bus.on("system.ssh.enable", self.handle_ssh_enable_request) -self.bus.on("system.ssh.disable", self.handle_ssh_disable_request) -self.bus.on("system.reboot", self.handle_reboot_request) -self.bus.on("system.shutdown", self.handle_shutdown_request) -self.bus.on("system.factory.reset", self.handle_factory_reset_request) -self.bus.on("system.factory.reset.register", self.handle_reset_register) -self.bus.on("system.configure.language", self.handle_configure_language_request) -self.bus.on("system.mycroft.service.restart", self.handle_mycroft_restart_request) +```yaml +PHAL: + admin: + neon-phal-plugin-system: + enabled: true ``` diff --git a/ovos_PHAL_plugin_system/__init__.py b/neon_phal_plugin_system/__init__.py similarity index 97% rename from ovos_PHAL_plugin_system/__init__.py rename to neon_phal_plugin_system/__init__.py index b96cf30..e49cd71 100644 --- a/ovos_PHAL_plugin_system/__init__.py +++ b/neon_phal_plugin_system/__init__.py @@ -29,11 +29,11 @@ def validate(config=None): This allows a plugin to run platform checks""" # check if admin plugin is not enabled cfg = Configuration().get("PHAL", {}).get("admin", {}) - if cfg.get("ovos-PHAL-plugin-system", {}).get("enabled"): + if cfg.get("neon-phal-plugin-system", {}).get("enabled"): # run this plugin in admin mode (as root) return False - LOG.info("ovos-PHAL-plugin-system running as user") + LOG.info("neon-phal-plugin-system running as user") return True @@ -41,7 +41,7 @@ class SystemEventsPlugin(PHALPlugin): validator = SystemEventsValidator def __init__(self, bus=None, config=None): - super().__init__(bus=bus, name="ovos-PHAL-plugin-system", config=config) + super().__init__(bus=bus, name="neon-phal-plugin-system", config=config) self.gui = GUIInterface(bus=self.bus, skill_id=self.name, ui_directories={"qt5": join(dirname(__file__), "ui")}, config=self.config_core.get('gui')) @@ -61,10 +61,9 @@ def __init__(self, bus=None, config=None): self.bus.on("system.mycroft.service.restart", self.handle_mycroft_restart_request) self.bus.on("system.mycroft.service.restart.start", self.handle_mycroft_restarting) - self.core_service_name = config.get("core_service") or "ovos.service" + self.core_service_name = config.get("core_service") or "neon.service" # In Debian, ssh stays active, but sshd is removed when ssh is disabled self.ssh_service = config.get("ssh_service") or "sshd.service" - self.use_root = config.get("sudo", True) self.factory_reset_plugs = [] @@ -331,7 +330,7 @@ def shutdown(self): class SystemEventsAdminValidator(AdminValidator, SystemEventsValidator): @staticmethod def validate(config=None): - LOG.info("ovos-PHAL-plugin-system running as root") + LOG.info("neon-phal-plugin-system running as root") return True diff --git a/ovos_PHAL_plugin_system/ui/Reboot.qml b/neon_phal_plugin_system/ui/Reboot.qml similarity index 100% rename from ovos_PHAL_plugin_system/ui/Reboot.qml rename to neon_phal_plugin_system/ui/Reboot.qml diff --git a/ovos_PHAL_plugin_system/ui/Restart.qml b/neon_phal_plugin_system/ui/Restart.qml similarity index 100% rename from ovos_PHAL_plugin_system/ui/Restart.qml rename to neon_phal_plugin_system/ui/Restart.qml diff --git a/ovos_PHAL_plugin_system/ui/Shutdown.qml b/neon_phal_plugin_system/ui/Shutdown.qml similarity index 100% rename from ovos_PHAL_plugin_system/ui/Shutdown.qml rename to neon_phal_plugin_system/ui/Shutdown.qml diff --git a/ovos_PHAL_plugin_system/ui/Status.qml b/neon_phal_plugin_system/ui/Status.qml similarity index 100% rename from ovos_PHAL_plugin_system/ui/Status.qml rename to neon_phal_plugin_system/ui/Status.qml diff --git a/ovos_PHAL_plugin_system/ui/animations/loading.json b/neon_phal_plugin_system/ui/animations/loading.json similarity index 100% rename from ovos_PHAL_plugin_system/ui/animations/loading.json rename to neon_phal_plugin_system/ui/animations/loading.json diff --git a/ovos_PHAL_plugin_system/ui/animations/status-fail.json b/neon_phal_plugin_system/ui/animations/status-fail.json similarity index 100% rename from ovos_PHAL_plugin_system/ui/animations/status-fail.json rename to neon_phal_plugin_system/ui/animations/status-fail.json diff --git a/ovos_PHAL_plugin_system/ui/animations/status-success.json b/neon_phal_plugin_system/ui/animations/status-success.json similarity index 100% rename from ovos_PHAL_plugin_system/ui/animations/status-success.json rename to neon_phal_plugin_system/ui/animations/status-success.json diff --git a/ovos_PHAL_plugin_system/version.py b/neon_phal_plugin_system/version.py similarity index 100% rename from ovos_PHAL_plugin_system/version.py rename to neon_phal_plugin_system/version.py diff --git a/setup.py b/setup.py index d20cd1f..7d4eb80 100755 --- a/setup.py +++ b/setup.py @@ -7,8 +7,7 @@ def get_version(): """ Find the version of the package""" - version = None - version_file = os.path.join(BASEDIR, 'ovos_PHAL_plugin_system', + version_file = os.path.join(BASEDIR, 'neon_phal_plugin_system', 'version.py') major, minor, build, alpha = (None, None, None, None) with open(version_file) as f: @@ -55,20 +54,20 @@ def get_description(): long_description = f.read() return long_description -PLUGIN_ENTRY_POINT = 'ovos-PHAL-plugin-system=ovos_PHAL_plugin_system:SystemEventsPlugin' -ADMIN_ENTRY_POINT = 'ovos-PHAL-plugin-system=ovos_PHAL_plugin_system:SystemEventsAdminPlugin' +PLUGIN_ENTRY_POINT = 'neon-phal-plugin-system=neon_phal_plugin_system:SystemEventsPlugin' +ADMIN_ENTRY_POINT = 'neon-phal-plugin-system=neon_phal_plugin_system:SystemEventsAdminPlugin' setup( - name='ovos-PHAL-plugin-system', + name='neon-phal-plugin-system', version=get_version(), - description='A plugin for OpenVoiceOS hardware abstraction layer', + description='A plugin for OVOS/Neon hardware abstraction layer', long_description=get_description(), long_description_content_type="text/markdown", - url='https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system', - author='JarbasAi', - author_email='jarbasai@mailfence.com', + url='https://github.com/NeonGeckoCom/neon-phal-plugin-system', + author='NeonGecko', + author_email='developers@neon.ai', license='Apache-2.0', - packages=['ovos_PHAL_plugin_system'], - package_data={'': package_files('ovos_PHAL_plugin_system')}, + packages=['neon_phal_plugin_system'], + package_data={'': package_files('neon_phal_plugin_system')}, install_requires=required("requirements.txt"), zip_safe=True, classifiers=[