From 5b386d0819acb198e1014ad6d95ea429bd2bdf41 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 29 May 2024 11:29:35 -0400 Subject: [PATCH] improve project --- .github/dependabot.yml | 6 +++- .github/workflows/black.yml | 32 +++++++++---------- .github/workflows/flake8.yml | 30 ++++++++--------- .github/workflows/pytest.yml | 28 ++++++++++++++++ jira/client.py | 1 - .../installation_store/installation_store.py | 1 - requirements.txt | 10 +++--- tests/functions/test_create_issue.py | 2 +- tests/mock_installation_store.py | 2 +- 9 files changed, 71 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/pytest.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8ee200b..82ba215 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,4 +6,8 @@ updates: interval: "monthly" labels: - "pip" - - "dependencies" \ No newline at end of file + - "dependencies" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 5f8d919..702633a 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -2,7 +2,7 @@ name: Formatting validation using black on: push: - branches: [ main ] + branches: [main] pull_request: jobs: @@ -11,19 +11,19 @@ jobs: timeout-minutes: 5 strategy: matrix: - python-version: ['3.9'] - + python-version: ["3.12"] + steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install -U pip - pip install -r requirements.txt - - name: Format with black - run: | - black . - if git status --porcelain | grep .; then git --no-pager diff; exit 1; fi \ No newline at end of file + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install -U pip + pip install -r requirements.txt + - name: Format with black + run: | + black . + if git status --porcelain | grep .; then git --no-pager diff; exit 1; fi diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 7b0863c..8e85fa7 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -2,7 +2,7 @@ name: Linting validation using flake8 on: push: - branches: [ main ] + branches: [main] pull_request: jobs: @@ -11,18 +11,18 @@ jobs: timeout-minutes: 5 strategy: matrix: - python-version: ['3.9'] - + python-version: ["3.12"] + steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install -U pip - pip install -r requirements.txt - - name: Lint with flake8 - run: | - flake8 *.py + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install -U pip + pip install -r requirements.txt + - name: Lint with flake8 + run: | + flake8 *.py diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..c2a314e --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,28 @@ +name: Linting validation using flake8 + +on: + push: + branches: [main] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 5 + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install -U pip + pip install -r requirements.txt + - name: Test with pytest + run: | + pytest . diff --git a/jira/client.py b/jira/client.py index 5f8f21a..5098ef0 100644 --- a/jira/client.py +++ b/jira/client.py @@ -8,7 +8,6 @@ class JiraClient: - def __init__( self, token: Optional[str] = None, diff --git a/oauth/installation_store/installation_store.py b/oauth/installation_store/installation_store.py index e0e7fe9..edc7297 100644 --- a/oauth/installation_store/installation_store.py +++ b/oauth/installation_store/installation_store.py @@ -4,7 +4,6 @@ class InstallationStore: - def save(self, installation: JiraInstallation): """Saves an installation data""" raise NotImplementedError() diff --git a/requirements.txt b/requirements.txt index e121f7c..efae1be 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ slack-cli-hooks slack-bolt==1.19.0rc1 -pytest -flake8==7.0.0 -black==23.12.1 -requests==2.31.0 -Flask==3.0.3 +pytest==8.2 +flake8==7.0 +black==24.4 +requests==2.32 +Flask==3.0 diff --git a/tests/functions/test_create_issue.py b/tests/functions/test_create_issue.py index 3d66c07..5575056 100644 --- a/tests/functions/test_create_issue.py +++ b/tests/functions/test_create_issue.py @@ -1,7 +1,7 @@ -from datetime import datetime import json import logging import os +from datetime import datetime from unittest.mock import MagicMock, patch import requests diff --git a/tests/mock_installation_store.py b/tests/mock_installation_store.py index c49cb57..1d51e42 100644 --- a/tests/mock_installation_store.py +++ b/tests/mock_installation_store.py @@ -1,5 +1,5 @@ -from logging import Logger import logging +from logging import Logger from typing import Dict, Optional from oauth.installation_store.installation_store import InstallationStore