From f944ce39a78e6eb5cf9f5cb0cb16fca627fb2d9e Mon Sep 17 00:00:00 2001 From: Benex254 Date: Tue, 6 Aug 2024 21:22:45 +0300 Subject: [PATCH] chore: add test workflow on push and pull request --- .github/workflows/test.yml | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6454be0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +name: Test Workflow +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.10, 3.11] # List the Python versions you want to test + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install poetry + uses: abatilo/actions-poetry@v2 + - name: Setup a local virtual environment (if no poetry.toml file) + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - 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 linter, formatters and sort imports + run: | + poetry run black . + poetry run ruff check . --fix + poetry run isort --profile black + - name: run type checking + run: poetry run pyright + - name: run tests + run: poetry run pytest