From f7ded87f987b98daec61f0f3103787e793fbe277 Mon Sep 17 00:00:00 2001 From: Abdel Hakim Bensiali Date: Sat, 20 Jul 2024 13:46:50 +0100 Subject: [PATCH] added github actions for unit tests --- .github/workflows/python_lib.yml | 33 +++++++++++++++++++++++++++ python/poetry.toml | 3 +++ python/src/algeria_cities/__init__.py | 3 --- 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/python_lib.yml create mode 100644 python/poetry.toml diff --git a/.github/workflows/python_lib.yml b/.github/workflows/python_lib.yml new file mode 100644 index 0000000..4acae73 --- /dev/null +++ b/.github/workflows/python_lib.yml @@ -0,0 +1,33 @@ +name: algeria-cities python lib + +on: [push] + +jobs: + ci: + run-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: action/checkout@v4 + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install poetry + uses: abatilo/actions-poetry@v2 + + - uses: actions/cache@v3 + name: Define a cache for the virtual environment based on the dependencies lock file + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + + - name: Install the project dependencies + run: poetry install + + - name: Run unittests + working-directory: ./python + run: poetry run pytest tests -s diff --git a/python/poetry.toml b/python/poetry.toml new file mode 100644 index 0000000..53b35d3 --- /dev/null +++ b/python/poetry.toml @@ -0,0 +1,3 @@ +[virtualenvs] +create = true +in-project = true diff --git a/python/src/algeria_cities/__init__.py b/python/src/algeria_cities/__init__.py index 0804b3b..e69de29 100644 --- a/python/src/algeria_cities/__init__.py +++ b/python/src/algeria_cities/__init__.py @@ -1,3 +0,0 @@ - -def main(): - print("hello world")