Skip to content

Commit ab4aaff

Browse files
authored
add end2end tests (#81)
* add end2end tests * drop blacklist tests, those belong in ovos-core * requirements.txt * build tests * fix coverage * fix coverage * m2v * refactor: packaging * refactor: packaging * refactor: packaging
1 parent cd052f9 commit ab4aaff

File tree

166 files changed

+356
-56
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+356
-56
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
relative_files = true

.github/workflows/build_tests.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ on:
99
workflow_dispatch:
1010

1111
jobs:
12-
py_build_tests:
13-
uses: neongeckocom/.github/.github/workflows/python_build_tests.yml@master
14-
with:
15-
test_manifest: true
16-
manifest_ignored: "test/**,scripts/**,CHANGELOG.md"
17-
pip_audit:
12+
build_tests:
1813
strategy:
1914
max-parallel: 2
2015
matrix:
21-
python-version: ["3.10"]
16+
python-version: ["3.10", "3.11"]
2217
runs-on: ubuntu-latest
2318
steps:
2419
- uses: actions/checkout@v4
2520
- name: Setup Python
2621
uses: actions/setup-python@v5
2722
with:
2823
python-version: ${{ matrix.python-version }}
29-
- name: Install skill
24+
- name: Install Build Tools
3025
run: |
31-
pip install .
32-
- uses: pypa/gh-action-pip-audit@v1.0.7
33-
with:
34-
# Ignore setuptools vulnerability we can't do much about
35-
# Ignore numpy vulnerability affecting latest version for Py3.7
36-
ignore-vulns: |
37-
GHSA-r9hx-vwmv-q579
38-
GHSA-fpfv-jqm9-f5jm
39-
PYSEC-2022-43012
26+
python -m pip install build wheel uv
27+
- name: Install System Dependencies
28+
run: |
29+
sudo apt-get update
30+
sudo apt install python3-dev
31+
- name: Build Source Packages
32+
run: |
33+
python setup.py sdist
34+
- name: Build Distribution Packages
35+
run: |
36+
python setup.py bdist_wheel
37+
- name: Install package
38+
run: |
39+
uv pip install --system .

.github/workflows/coverage.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# .github/workflows/coverage.yml
2+
name: Post coverage comment
3+
4+
on:
5+
workflow_run:
6+
workflows: ["Run Tests"]
7+
types:
8+
- completed
9+
10+
jobs:
11+
test:
12+
name: Run tests & display coverage
13+
runs-on: ubuntu-latest
14+
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
15+
permissions:
16+
# Gives the action the necessary permissions for publishing new
17+
# comments in pull requests.
18+
pull-requests: write
19+
# Gives the action the necessary permissions for editing existing
20+
# comments (to avoid publishing multiple comments in the same PR)
21+
contents: write
22+
# Gives the action the necessary permissions for looking up the
23+
# workflow that launched this workflow, and download the related
24+
# artifact that contains the comment to be published
25+
actions: read
26+
steps:
27+
# DO NOT run actions/checkout here, for security reasons
28+
# For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
29+
- name: Post comment
30+
uses: py-cov-action/python-coverage-comment-action@v3
31+
with:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
34+
# Update those if you changed the default values:
35+
# COMMENT_ARTIFACT_NAME: python-coverage-comment-action
36+
# COMMENT_FILENAME: python-coverage-comment-action.txt
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish Coverage to gh-pages
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write # Required to push to gh-pages
11+
12+
jobs:
13+
test-and-publish-coverage:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.11"
24+
25+
- name: Install dependencies
26+
run: |
27+
sudo apt-get update
28+
sudo apt install python3-dev swig libssl-dev portaudio19-dev libpulse-dev libfann-dev
29+
python -m pip install build wheel uv
30+
uv pip install --system -r test/requirements.txt
31+
32+
- name: Install repo
33+
run: |
34+
uv pip install --system .
35+
36+
- name: Run tests and collect coverage
37+
run: |
38+
coverage run -m pytest test/
39+
coverage html
40+
rm ./htmlcov/.gitignore
41+
42+
- name: Deploy coverage report to GitHub Pages
43+
uses: peaceiris/actions-gh-pages@v3
44+
with:
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
publish_dir: ./htmlcov
47+
publish_branch: gh-pages

.github/workflows/publish_stable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
secrets: inherit
1111
with:
1212
branch: 'master'
13-
version_file: 'version.py'
13+
version_file: 'ovos_skill_hello_world/version.py'
1414
setup_py: 'setup.py'
1515
publish_release: true
1616

.github/workflows/release_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
secrets: inherit
4242
with:
4343
branch: 'dev'
44-
version_file: 'version.py'
44+
version_file: 'ovos_skill_hello_world/version.py'
4545
setup_py: 'setup.py'
4646
update_changelog: true
4747
publish_prerelease: true

.github/workflows/unit_tests.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Run Tests
2+
on:
3+
pull_request:
4+
branches:
5+
- dev
6+
push:
7+
branches:
8+
- dev
9+
workflow_dispatch:
10+
11+
jobs:
12+
unit_tests:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
# Gives the action the necessary permissions for publishing new
16+
# comments in pull requests.
17+
pull-requests: write
18+
# Gives the action the necessary permissions for pushing data to the
19+
# python-coverage-comment-action branch, and for editing existing
20+
# comments (to avoid publishing multiple comments in the same PR)
21+
contents: write
22+
timeout-minutes: 35
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Set up python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.11"
29+
- name: Install System Dependencies
30+
run: |
31+
sudo apt-get update
32+
sudo apt install python3-dev swig libssl-dev portaudio19-dev libpulse-dev libfann-dev
33+
python -m pip install build wheel uv
34+
uv pip install --system -r test/requirements.txt
35+
- name: Install repo
36+
run: |
37+
uv pip install --system .
38+
39+
- name: Run tests
40+
run: |
41+
pytest --cov=ovos_skill_hello_world --cov-report xml test/
42+
43+
- name: Coverage comment
44+
id: coverage_comment
45+
uses: py-cov-action/python-coverage-comment-action@v3
46+
with:
47+
GITHUB_TOKEN: ${{ github.token }}
48+
49+
- name: Store Pull Request comment to be posted
50+
uses: actions/upload-artifact@v4
51+
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
52+
with:
53+
# If you use a different name, update COMMENT_ARTIFACT_NAME accordingly
54+
name: python-coverage-comment-action
55+
# If you use a different name, update COMMENT_FILENAME accordingly
56+
path: python-coverage-comment-action.txt

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
recursive-include locale *
1+
recursive-include ovos_skill_hello_world/locale *
22
include *.txt

locale/ca-es/dialog/hello.dialog renamed to ovos_skill_hello_world/locale/ca-es/dialog/hello.dialog

File renamed without changes.

0 commit comments

Comments
 (0)