Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
relative_files = true
34 changes: 17 additions & 17 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@ on:
workflow_dispatch:

jobs:
py_build_tests:
uses: neongeckocom/.github/.github/workflows/python_build_tests.yml@master
with:
test_manifest: true
manifest_ignored: "test/**,scripts/**,CHANGELOG.md"
pip_audit:
build_tests:
strategy:
max-parallel: 2
matrix:
python-version: ["3.10"]
python-version: ["3.10", "3.11"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install skill
- name: Install Build Tools
run: |
pip install .
- uses: pypa/gh-action-pip-audit@v1.0.7
with:
# Ignore setuptools vulnerability we can't do much about
# Ignore numpy vulnerability affecting latest version for Py3.7
ignore-vulns: |
GHSA-r9hx-vwmv-q579
GHSA-fpfv-jqm9-f5jm
PYSEC-2022-43012
python -m pip install build wheel uv
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt install python3-dev
- name: Build Source Packages
run: |
python setup.py sdist
- name: Build Distribution Packages
run: |
python setup.py bdist_wheel
- name: Install package
run: |
uv pip install --system .
36 changes: 36 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# .github/workflows/coverage.yml
name: Post coverage comment

on:
workflow_run:
workflows: ["Run Tests"]
types:
- completed

jobs:
test:
name: Run tests & display coverage
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
permissions:
# Gives the action the necessary permissions for publishing new
# comments in pull requests.
pull-requests: write
# Gives the action the necessary permissions for editing existing
# comments (to avoid publishing multiple comments in the same PR)
contents: write
# Gives the action the necessary permissions for looking up the
# workflow that launched this workflow, and download the related
# artifact that contains the comment to be published
actions: read
steps:
# DO NOT run actions/checkout here, for security reasons
# For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
- name: Post comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
# Update those if you changed the default values:
# COMMENT_ARTIFACT_NAME: python-coverage-comment-action
# COMMENT_FILENAME: python-coverage-comment-action.txt
47 changes: 47 additions & 0 deletions .github/workflows/gh_pages_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Coverage to gh-pages

on:
push:
branches:
- dev
workflow_dispatch:

permissions:
contents: write # Required to push to gh-pages

jobs:
test-and-publish-coverage:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
sudo apt-get update
sudo apt install python3-dev swig libssl-dev portaudio19-dev libpulse-dev libfann-dev
python -m pip install build wheel uv
uv pip install --system -r test/requirements.txt

- name: Install repo
run: |
uv pip install --system .

- name: Run tests and collect coverage
run: |
coverage run -m pytest test/
coverage html
rm ./htmlcov/.gitignore

- name: Deploy coverage report to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./htmlcov
publish_branch: gh-pages
2 changes: 1 addition & 1 deletion .github/workflows/publish_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
secrets: inherit
with:
branch: 'master'
version_file: 'version.py'
version_file: 'ovos_skill_hello_world/version.py'
setup_py: 'setup.py'
publish_release: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
secrets: inherit
with:
branch: 'dev'
version_file: 'version.py'
version_file: 'ovos_skill_hello_world/version.py'
setup_py: 'setup.py'
update_changelog: true
publish_prerelease: true
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Run Tests
on:
pull_request:
branches:
- dev
push:
branches:
- dev
workflow_dispatch:

jobs:
unit_tests:
runs-on: ubuntu-latest
permissions:
# Gives the action the necessary permissions for publishing new
# comments in pull requests.
pull-requests: write
# Gives the action the necessary permissions for pushing data to the
# python-coverage-comment-action branch, and for editing existing
# comments (to avoid publishing multiple comments in the same PR)
contents: write
timeout-minutes: 35
steps:
- uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt install python3-dev swig libssl-dev portaudio19-dev libpulse-dev libfann-dev
python -m pip install build wheel uv
uv pip install --system -r test/requirements.txt
- name: Install repo
run: |
uv pip install --system .

- name: Run tests
run: |
pytest --cov=ovos_skill_hello_world --cov-report xml test/

- name: Coverage comment
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}

- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v4
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
# If you use a different name, update COMMENT_ARTIFACT_NAME accordingly
name: python-coverage-comment-action
# If you use a different name, update COMMENT_FILENAME accordingly
path: python-coverage-comment-action.txt
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
recursive-include locale *
recursive-include ovos_skill_hello_world/locale *
include *.txt
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ hi
hi there
hiya
howdy
how’s it going
long time no see
nice to see you
sup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
how are you
how are you doing
how has your day been
how have you been
how have you been
how’s it going
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 2 additions & 7 deletions scripts/prepare_translations.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
"""this script should run every time the contents of the locale folder change
except if PR originated from @gitlocalize-app
TODO - on commit to dev
"""

import json
from os.path import dirname
import os

locale = f"{dirname(dirname(__file__))}/locale"
tx = f"{dirname(dirname(__file__))}/translations"
locale = f"{dirname(dirname(__file__))}/ovos_skill_hello_world/locale"
tx = f"{dirname(dirname(__file__))}/ovos_skill_hello_world/translations"


for lang in os.listdir(locale):
Expand Down
8 changes: 2 additions & 6 deletions scripts/sync_translations.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
"""this script should run in every PR originated from @gitlocalize-app
TODO - before PR merge
"""

import json
from os.path import dirname
import os
from ovos_utils.bracket_expansion import expand_template
from ovos_utils.list_utils import flatten_list, deduplicate_list

locale = f"{dirname(dirname(__file__))}/locale"
tx = f"{dirname(dirname(__file__))}/translations"
locale = f"{dirname(dirname(__file__))}/ovos_skill_hello_world/locale"
tx = f"{dirname(dirname(__file__))}/ovos_skill_hello_world/translations"

for lang in os.listdir(tx):
intents = f"{tx}/{lang}/intents.json"
Expand Down
31 changes: 16 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
#!/usr/bin/env python3
import os
from setuptools import setup
from os import walk, path

from setuptools import setup

URL = "https://github.com/OpenVoiceOS/ovos-skill-hello-world"
SKILL_CLAZZ = "HelloWorldSkill" # needs to match __init__.py class name
PYPI_NAME = "ovos-skill-hello-world" # pip install PYPI_NAME
SKILL_PKG = PYPI_NAME.lower().replace('-', '_') # import name

# below derived from github url to ensure standard skill_id
SKILL_AUTHOR, SKILL_NAME = URL.split(".com/")[-1].split("/")
SKILL_PKG = SKILL_NAME.lower().replace('-', '_')
SKILL_AUTHOR, SKILL_NAME = URL.split(".com/")[-1].split("/") # derived from github url to ensure standard skill_id
PLUGIN_ENTRY_POINT = f'{SKILL_NAME.lower()}.{SKILL_AUTHOR.lower()}={SKILL_PKG}:{SKILL_CLAZZ}'


def find_resource_files():
resource_base_dirs = ("locale", )
base_dir = path.dirname(__file__)
resource_base_dirs = ("locale",)
base_dir = path.join(os.path.dirname(__file__), SKILL_PKG)
package_data = ["*.json"]

for res in resource_base_dirs:
if path.isdir(path.join(base_dir, res)):
for (directory, _, files) in walk(path.join(base_dir, res)):
res_dir = path.join(base_dir, res)
if path.isdir(res_dir):
for (directory, _, files) in walk(res_dir):
if files:
package_data.append(
path.join(directory.replace(base_dir, "").lstrip('/'),
'*'))
relative_dir = directory.replace(base_dir + os.sep, "")
package_data.append(path.join(relative_dir, "*"))
return package_data


Expand All @@ -33,7 +34,7 @@ def find_resource_files():

def get_version():
""" Find the version of this skill"""
version_file = os.path.join(os.path.dirname(__file__), 'version.py')
version_file = os.path.join(os.path.dirname(__file__), SKILL_PKG, 'version.py')
major, minor, build, alpha = (None, None, None, None)
with open(version_file) as f:
for line in f:
Expand All @@ -58,15 +59,15 @@ def get_version():
setup(
name=PYPI_NAME,
version=get_version(),
description='OVOS hello world skill plugin',
long_description=long_description,
long_description_content_type="text/markdown",
url=URL,
author=SKILL_AUTHOR,
description='OVOS hello world skill plugin',
author_email='jarbasai@mailfence.com',
license='Apache-2.0',
package_dir={SKILL_PKG: ""},
package_data={SKILL_PKG: find_resource_files()},
packages=[SKILL_PKG],
package_data={SKILL_PKG: find_resource_files()},
include_package_data=True,
keywords='ovos skill plugin',
entry_points={'ovos.plugin.skill': PLUGIN_ENTRY_POINT}
Expand Down
7 changes: 7 additions & 0 deletions test/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
coveralls>=1.8.2
flake8>=3.7.9
pytest>=5.2.4
pytest-cov>=2.8.1
cov-core>=1.15.0
ovoscope>=0.5.1,<1.0.0
ovos-core[plugins,lgpl]>=2.0.0a1
Loading
Loading