From 7585ce2a19f81fb1a6bcc42b3a6bb5f0fe2065b9 Mon Sep 17 00:00:00 2001 From: hasansezertasan Date: Thu, 18 Jan 2024 11:55:48 +0300 Subject: [PATCH] Test Suite and Dependabot! --- .github/dependabot.yml | 6 +++++ .github/workflows/test.yml | 55 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..55dbe85 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b9daacb --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,55 @@ +name: Test Suite +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + workflow_dispatch: +concurrency: + group: test-${{ github.head_ref }} + cancel-in-progress: true +env: + PYTHONUNBUFFERED: "1" + FORCE_COLOR: "1" +jobs: + run: + name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root --without dev # --no-root is required to avoid installing the project itself + - name: Install project + run: poetry install --no-interaction --without dev + - name: Run static analysis + run: | + black --check . + isort --check . + ruff --check . + - name: Run tests with ${{ matrix.python-version }} + run: | + source .venv/bin/activate + pytest tests -v -s