Skip to content

Commit

Permalink
ci(test): add main test for hm-serial (#13588)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongbo-miao authored Jan 1, 2024
1 parent 3373bc6 commit d277378
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 3 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
hm-prowler: ${{ steps.filter.outputs.hm-prowler }}
hm-pyvista-mount-saint-helens: ${{ steps.filter.outputs.hm-pyvista-mount-saint-helens }}
hm-rasa: ${{ steps.filter.outputs.hm-rasa }}
hm-serial: ${{ steps.filter.outputs.hm-serial }}
hm-spark-find-retired-people-scala: ${{ steps.filter.outputs.hm-spark-find-retired-people-scala }}
hm-spark-find-taxi-top-routes: ${{ steps.filter.outputs.hm-spark-find-taxi-top-routes }}
hm-spark-find-taxi-top-routes-sql: ${{ steps.filter.outputs.hm-spark-find-taxi-top-routes-sql }}
Expand Down Expand Up @@ -152,6 +153,9 @@ jobs:
hm-rasa:
- '.github/workflows/test.yml'
- 'hm-rasa/**'
hm-serial:
- '.github/workflows/test.yml'
- 'hm-serial/**'
hm-spark-find-retired-people-scala:
- '.github/workflows/test.yml'
- 'hm-spark/applications/find-retired-people-scala/**'
Expand Down Expand Up @@ -1320,6 +1324,38 @@ jobs:
with:
directory: reinforcement-learning/cart-pole

serial-test:
name: Serial | Test
needs: detect-changes
if: ${{ needs.detect-changes.outputs.hm-serial == 'true' }}
runs-on: ubuntu-22.04
environment: test
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Poetry
run: |
pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: hm-serial/pyproject.toml
cache: poetry
cache-dependency-path: hm-serial/poetry.lock
- name: Install dependencies
working-directory: hm-serial
run: |
poetry install --no-root
- name: Test
working-directory: hm-serial
run: |
poetry run poe test-coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
directory: hm-serial

supervision-detect-objects-test:
name: supervision (detect-objects) | Test
needs: detect-changes
Expand Down
3 changes: 3 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ pull_request_rules:
- or:
- check-success=Reinforcement Learning (cart-pole) | Test | Test
- check-skipped=Reinforcement Learning (cart-pole) | Test | Test
- or:
- check-success=Serial | Test
- check-skipped=Serial | Test
- or:
- check-success=supervision (detect-objects) | Test
- check-skipped=supervision (detect-objects) | Test
Expand Down
6 changes: 5 additions & 1 deletion hm-serial/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
poetry-env-use:
poetry env use python3.11
poetry env use python3.12
poetry-update-lock-file:
poetry lock --no-update
poetry-install:
poetry install --no-root

poetry-run-dev:
poetry run poe dev
poetry-run-test:
poetry run poe test
poetry-run-test-coverage:
poetry run poe test-coverage
154 changes: 152 additions & 2 deletions hm-serial/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions hm-serial/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ pyserial = "3.5"

[tool.poetry.group.dev.dependencies]
poethepoet = "0.24.4"
pytest = "7.4.4"
pytest-cov = "4.1.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poe.tasks]
dev = "python src/main.py"
test = "pytest --verbose --verbose"
test-coverage = "pytest --cov=. --cov-report=xml"
10 changes: 10 additions & 0 deletions hm-serial/src/main_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import unittest


class TestMain(unittest.TestCase):
def test_main(self):
self.assertTrue(True)


if __name__ == "__main__":
unittest.main()

0 comments on commit d277378

Please sign in to comment.