From e06b2acb30671894f070ada26f9caad7dc339c76 Mon Sep 17 00:00:00 2001 From: asyms Date: Fri, 22 Sep 2023 10:16:31 +0200 Subject: [PATCH] add python-test workflow and sample test --- .github/workflows/python-test.yml | 33 +++++++++++++++++++++++++++++++ tests/main/test_main_onnx.py | 9 +++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/python-test.yml create mode 100644 tests/main/test_main_onnx.py diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml new file mode 100644 index 00000000..cafa0a75 --- /dev/null +++ b/.github/workflows/python-test.yml @@ -0,0 +1,33 @@ +name: Python test + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Display Python version + run: python -c "import sys; print(sys.version)" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ruff + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with ruff + run: | + # stop the build if there are Python syntax errors or undefined names + ruff --format=github --select=E9,F63,F7,F82 --target-version=py37 . + - name: Test with pytest + run: | + pip install pytest + pytest tests/ \ No newline at end of file diff --git a/tests/main/test_main_onnx.py b/tests/main/test_main_onnx.py new file mode 100644 index 00000000..505717c0 --- /dev/null +++ b/tests/main/test_main_onnx.py @@ -0,0 +1,9 @@ +# sample test + + +def capital_case(x): + return x.capitalize() + + +def test_capital_case(): + assert capital_case("zigzag") == "Zigzag"