From bb6c9f4ac6c2cd3626b2b27c7b52ec95284513c7 Mon Sep 17 00:00:00 2001 From: Ivan Stasevich Date: Thu, 19 Sep 2024 00:12:23 +0300 Subject: [PATCH 1/3] Fix .example.env --- .example.env | 1 - 1 file changed, 1 deletion(-) diff --git a/.example.env b/.example.env index 31473de..412bafc 100644 --- a/.example.env +++ b/.example.env @@ -15,7 +15,6 @@ YANDEX_SSO_ENABLED=0 YANDEX_CLIENT_ID="YOUR_YANDEX_CLIENT_ID" YANDEX_CLIENT_SECRET="YOUR_YANDEX_CLIENT_SECRET" TELEGRAM_SSO_ENABLED=0 -TELEGRAM_BOT_USERNAME="YOUR_TELEGRAM_BOT_USERNAME" TELEGRAM_BOT_TOKEN="YOUR_TELEGRAM_BOT_TOKEN" MAIL_ENABLED=0 From 7eb19dc57bbe7f38b8dc0a4d063ed9b3743ed045 Mon Sep 17 00:00:00 2001 From: Ivan Stasevich Date: Thu, 19 Sep 2024 14:48:15 +0300 Subject: [PATCH 2/3] Add CodeQL analysis & CI --- .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE/bug_report.md | 38 ++++++++++++++ .github/ISSUE_TEMPLATE/feaure_request.md | 20 +++++++ .github/workflows/codeql.yml | 67 ++++++++++++++++++++++++ .github/workflows/fastapi_ci.yml | 43 +++++++++++++++ .pre-commit-config.yaml | 10 ++++ 6 files changed, 179 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feaure_request.md create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/fastapi_ci.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..673a029 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +everysoftware diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..dd84ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feaure_request.md b/.github/ISSUE_TEMPLATE/feaure_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feaure_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..b71fd26 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,67 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: CodeQL + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '41 22 * * 3' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/fastapi_ci.yml b/.github/workflows/fastapi_ci.yml new file mode 100644 index 0000000..fe967f3 --- /dev/null +++ b/.github/workflows/fastapi_ci.yml @@ -0,0 +1,43 @@ +name: FastAPI CI + +on: + push: + branches: [ "*" ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:latest + env: + POSTGRES_DB: app + POSTGRES_USER: postgres + POSTGRES_PASSWORD: changethis + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - uses: actions/checkout@v3 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: 3.12 + - name: Install dependencies + run: | + pip install poetry + poetry config virtualenvs.create false + poetry install + - name: Lint + run: | + poetry run ruff check app + poetry run ruff format app + poetry run mypy app + - name: Test + run: | + poetry run pytest -s -v diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ab7f4fc..38c73e1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,15 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks +# Quick Start: +# +# pip install pre-commit +# pre-commit install && pre-commit install -t pre-push +# pre-commit run --all-files +# +# To Skip Checks: +# +# git commit --no-verify + default_language_version: python: python3.12 repos: From 74882f90ebae1647e5bf6c29d6d97f7134a078f8 Mon Sep 17 00:00:00 2001 From: Ivan Stasevich Date: Thu, 19 Sep 2024 14:52:51 +0300 Subject: [PATCH 3/3] Delete CodeQL --- .github/workflows/codeql.yml | 67 ------------------------------------ 1 file changed, 67 deletions(-) delete mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index b71fd26..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,67 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: CodeQL - -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - schedule: - - cron: '41 22 * * 3' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: [ 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2