diff --git a/.github/workflows/build-tests.yml b/.github/workflows/build-tests.yml new file mode 100644 index 0000000..4eebdac --- /dev/null +++ b/.github/workflows/build-tests.yml @@ -0,0 +1,15 @@ +name: Build Tests + +on: + pull_request: + branches: [dev, master, main] + workflow_dispatch: + +jobs: + build: + uses: OpenVoiceOS/gh-automations/.github/workflows/build-tests.yml@dev + secrets: inherit + with: + python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' + install_extras: 'test' + test_path: 'test' diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml deleted file mode 100644 index 9829ee7..0000000 --- a/.github/workflows/build_tests.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Run Build Tests -on: - push: - branches: - - master - pull_request: - branches: - - dev - workflow_dispatch: - -jobs: - build_tests: - strategy: - max-parallel: 2 - matrix: - python-version: [ 3.7, 3.8, 3.9, "3.10" ] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install python3-dev swig libssl-dev - - name: Build Source Packages - run: | - python setup.py sdist - - name: Build Distribution Packages - run: | - python setup.py bdist_wheel - - name: Install skill - run: | - pip install . - - uses: pypa/gh-action-pip-audit@v1.0.0 - with: - # Ignore setuptools vulnerability we can't do much about - ignore-vulns: | - GHSA-r9hx-vwmv-q579 \ No newline at end of file diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..1542881 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,17 @@ +name: Code Coverage + +on: + pull_request: + branches: [dev] + workflow_dispatch: + +jobs: + coverage: + uses: OpenVoiceOS/gh-automations/.github/workflows/coverage.yml@dev + secrets: inherit + with: + python_version: '3.11' + coverage_source: 'ovos_skill_volume' + test_path: 'test/' + install_extras: '' + min_coverage: 0 diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml new file mode 100644 index 0000000..8757eee --- /dev/null +++ b/.github/workflows/license_check.yml @@ -0,0 +1,11 @@ +name: License Check + +on: + pull_request: + branches: [dev] + workflow_dispatch: + +jobs: + license_check: + uses: OpenVoiceOS/gh-automations/.github/workflows/license-check.yml@dev + secrets: inherit diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml deleted file mode 100644 index 2724941..0000000 --- a/.github/workflows/license_tests.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Run License Tests -on: - push: - branches: - - master - pull_request: - branches: - - dev - workflow_dispatch: - -jobs: - license_tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.14" - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install python3-dev swig libssl-dev - - name: Install core repo - run: | - pip install . - - name: Get explicit and transitive dependencies - run: | - pip freeze > requirements-all.txt - - name: Check python - id: license_check_report - uses: pilosus/action-pip-license-checker@v0.5.0 - with: - requirements: 'requirements-all.txt' - fail: 'Copyleft,Other,Error' - fails-only: true - exclude: '^(tqdm|ovos-skill-volume).*' - exclude-license: '^(Mozilla).*$' - - name: Print report - if: ${{ always() }} - run: echo "${{ steps.license_check_report.outputs.report }}" \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..9a6b7a5 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,14 @@ +name: Lint + +on: + pull_request: + branches: [dev, master, main] + workflow_dispatch: + +jobs: + lint: + uses: OpenVoiceOS/gh-automations/.github/workflows/lint.yml@dev + secrets: inherit + with: + ruff: true + pre_commit: false # set true if .pre-commit-config.yaml exists diff --git a/.github/workflows/ovoscope.yml b/.github/workflows/ovoscope.yml new file mode 100644 index 0000000..0f48332 --- /dev/null +++ b/.github/workflows/ovoscope.yml @@ -0,0 +1,15 @@ +name: Skill End-to-End Tests (ovoscope) + +on: + pull_request: + branches: [dev, master, main] + workflow_dispatch: + +jobs: + ovoscope: + uses: OpenVoiceOS/gh-automations/.github/workflows/ovoscope.yml@dev + secrets: inherit + with: + python_version: '3.11' + install_extras: 'test' + test_path: 'test/end2end/' diff --git a/.github/workflows/pip_audit.yml b/.github/workflows/pip_audit.yml new file mode 100644 index 0000000..bb3ca4d --- /dev/null +++ b/.github/workflows/pip_audit.yml @@ -0,0 +1,11 @@ +name: PIP Audit + +on: + pull_request: + branches: [dev] + workflow_dispatch: + +jobs: + pip_audit: + uses: OpenVoiceOS/gh-automations/.github/workflows/pip-audit.yml@dev + secrets: inherit diff --git a/.github/workflows/publish_stable.yml b/.github/workflows/publish_stable.yml index 8ab3842..bd3f099 100644 --- a/.github/workflows/publish_stable.yml +++ b/.github/workflows/publish_stable.yml @@ -1,58 +1,23 @@ -name: Stable Release +name: Publish Stable Release + on: - push: - branches: [master] workflow_dispatch: + push: + branches: [master, main] + +permissions: + contents: write # required for version bump commit and release tag jobs: publish_stable: - uses: TigreGotico/gh-automations/.github/workflows/publish-stable.yml@master - secrets: inherit + if: github.actor != 'github-actions[bot]' + uses: OpenVoiceOS/gh-automations/.github/workflows/publish-stable.yml@dev + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + MATRIX_TOKEN: ${{ secrets.MATRIX_TOKEN }} with: - branch: 'master' version_file: 'version.py' - setup_py: 'setup.py' + publish_pypi: true 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@v6 - with: - ref: master - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.14" - - 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}} - - - 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@v6 - 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 + sync_dev: true + notify_matrix: true diff --git a/.github/workflows/release-preview.yml b/.github/workflows/release-preview.yml new file mode 100644 index 0000000..30d37b0 --- /dev/null +++ b/.github/workflows/release-preview.yml @@ -0,0 +1,14 @@ +name: Release Preview + +on: + pull_request: + branches: [dev] + workflow_dispatch: + +jobs: + release_preview: + uses: OpenVoiceOS/gh-automations/.github/workflows/release-preview.yml@dev + secrets: inherit + with: + package_name: 'ovos_skill_volume' + version_file: 'version.py' diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml index e272ec5..8223526 100644 --- a/.github/workflows/release_workflow.yml +++ b/.github/workflows/release_workflow.yml @@ -1,133 +1,28 @@ name: Release Alpha and Propose Stable on: + workflow_dispatch: pull_request: types: [closed] branches: [dev] - workflow_dispatch: - -jobs: - - translations: - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v6 - with: - ref: dev - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.14" - - name: Sync translations by gitlocalize-app[bot] - run: | - python scripts/sync_translations.py - - - name: Commit to dev - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Update translations - branch: dev +permissions: + contents: write + pull-requests: write +jobs: publish_alpha: - needs: translations - uses: TigreGotico/gh-automations/.github/workflows/publish-alpha.yml@master - secrets: inherit + if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' + uses: OpenVoiceOS/gh-automations/.github/workflows/publish-alpha.yml@dev + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + MATRIX_TOKEN: ${{ secrets.MATRIX_TOKEN }} with: branch: 'dev' version_file: '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@v6 - - 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@v6 - with: - ref: dev - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.14" - - 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 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@v6 - with: - ref: dev - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: '3.14' - - - 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 - + propose_release: true + changelog_max_issues: 50 + publish_pypi: true + notify_matrix: true diff --git a/.github/workflows/repo-health.yml b/.github/workflows/repo-health.yml new file mode 100644 index 0000000..04f4f64 --- /dev/null +++ b/.github/workflows/repo-health.yml @@ -0,0 +1,13 @@ +name: Repo Health + +on: + pull_request: + branches: [dev, master, main] + workflow_dispatch: + +jobs: + repo_health: + uses: OpenVoiceOS/gh-automations/.github/workflows/repo-health.yml@dev + secrets: inherit + with: + version_file: 'version.py' diff --git a/.github/workflows/skill-check.yml b/.github/workflows/skill-check.yml new file mode 100644 index 0000000..ebcfd68 --- /dev/null +++ b/.github/workflows/skill-check.yml @@ -0,0 +1,15 @@ +name: Skill Check + +on: + pull_request: + branches: [dev, master, main] + workflow_dispatch: + +jobs: + skill_check: + uses: OpenVoiceOS/gh-automations/.github/workflows/skill-check.yml@dev + secrets: inherit + with: + fail_on_missing_en_us: true + fail_on_invalid_skill_json: false + skip_if_not_skill: true diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml deleted file mode 100644 index 2f4cf76..0000000 --- a/.github/workflows/unit_tests.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Run UnitTests -on: - pull_request: - branches: - - dev - paths-ignore: - - 'version.py' - - 'requirements.txt' - - 'examples/**' - - '.github/**' - - '.gitignore' - - 'LICENSE' - - 'CHANGELOG.md' - - 'MANIFEST.in' - - 'readme.md' - - 'scripts/**' - push: - branches: - - master - paths-ignore: - - 'version.py' - - 'requirements.txt' - - 'examples/**' - - '.github/**' - - '.gitignore' - - 'LICENSE' - - 'CHANGELOG.md' - - 'MANIFEST.in' - - 'readme.md' - - 'scripts/**' - workflow_dispatch: - -jobs: - unit_tests: - strategy: - max-parallel: 2 - matrix: - python-version: [ 3.7, 3.8, 3.9, "3.10" ] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - name: Set up python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install python3-dev - python -m pip install build wheel - - name: Install core repo - run: | - pip install . - - name: Install test dependencies - run: | - pip install pytest pytest-timeout pytest-cov - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install libfann-dev - - name: Install ovos dependencies - run: | - pip install ovos-plugin-manager ovos-core[skills_lgpl]>=0.0.5a28 - - name: Run unittests - run: | - pytest --cov=ovos-skill-template-repo --cov-report xml test/unittests - # NOTE: additional pytest invocations should also add the --cov-append flag - # or they will overwrite previous invocations' coverage reports - # (for an example, see OVOS Skill Manager's workflow) - - name: Upload coverage - env: - CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} - uses: codecov/codecov-action@v2 diff --git a/scripts/sync_translations.py b/scripts/sync_translations.py deleted file mode 100644 index 342b469..0000000 --- a/scripts/sync_translations.py +++ /dev/null @@ -1,78 +0,0 @@ -"""this script should run in every PR originated from @gitlocalize-app -TODO - before PR merge -""" - -import json -from os.path import dirname -import os - -locale = f"{dirname(dirname(__file__))}/locale" -tx = f"{dirname(dirname(__file__))}/translations" - - -for lang in os.listdir(tx): - intents = f"{tx}/{lang}/intents.json" - dialogs = f"{tx}/{lang}/dialogs.json" - vocs = f"{tx}/{lang}/vocabs.json" - regexes = f"{tx}/{lang}/regexes.json" - - if os.path.isfile(intents): - with open(intents) as f: - data = json.load(f) - for fid, samples in data.items(): - if samples: - samples = list(set([s.strip() for s in samples - if s and s.strip() != "[UNUSED]"])) # s may be None - if fid.startswith("/"): - p = f"{locale}/{lang.lower()}{fid}" - else: - p = f"{locale}/{lang.lower()}/{fid}" - os.makedirs(os.path.dirname(p), exist_ok=True) - with open(f"{locale}/{lang.lower()}/{fid}", "w") as f: - f.write("\n".join(sorted(samples))) - - if os.path.isfile(dialogs): - with open(dialogs) as f: - data = json.load(f) - for fid, samples in data.items(): - if samples: - samples = list(set([s.strip() for s in samples - if s and s.strip() != "[UNUSED]"])) # s may be None - if fid.startswith("/"): - p = f"{locale}/{lang.lower()}{fid}" - else: - p = f"{locale}/{lang.lower()}/{fid}" - os.makedirs(os.path.dirname(p), exist_ok=True) - with open(f"{locale}/{lang.lower()}/{fid}", "w") as f: - f.write("\n".join(sorted(samples))) - - if os.path.isfile(vocs): - with open(vocs) as f: - data = json.load(f) - for fid, samples in data.items(): - if samples: - samples = list(set([s.strip() for s in samples - if s and s.strip() != "[UNUSED]"])) # s may be None - if fid.startswith("/"): - p = f"{locale}/{lang.lower()}{fid}" - else: - p = f"{locale}/{lang.lower()}/{fid}" - os.makedirs(os.path.dirname(p), exist_ok=True) - with open(f"{locale}/{lang.lower()}/{fid}", "w") as f: - f.write("\n".join(sorted(samples))) - - if os.path.isfile(regexes): - with open(regexes) as f: - data = json.load(f) - for fid, samples in data.items(): - if samples: - samples = list(set([s.strip() for s in samples - if s and s.strip() != "[UNUSED]"])) # s may be None - if fid.startswith("/"): - p = f"{locale}/{lang.lower()}{fid}" - else: - p = f"{locale}/{lang.lower()}/{fid}" - os.makedirs(os.path.dirname(p), exist_ok=True) - with open(f"{locale}/{lang.lower()}/{fid}", "w") as f: - f.write("\n".join(sorted(samples))) -