Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a GitHub actions to pull requests #5

Open
heyodai opened this issue Nov 8, 2023 · 0 comments
Open

Create a GitHub actions to pull requests #5

heyodai opened this issue Nov 8, 2023 · 0 comments

Comments

@heyodai
Copy link
Owner

heyodai commented Nov 8, 2023

Ideas from ChatGPT:

  1. Linting: Beyond formatting, linting helps catch potential errors and enforces coding standards. Tools like flake8 or pylint can be used alongside black and isort.
  2. Static Analysis: Tools like mypy for type checking or bandit for finding common security issues can catch errors that are not detected by linters.
  3. Code Coverage: Ensure that your tests cover a high percentage of your codebase with tools like coverage.py. This can be integrated to fail the build if the coverage falls below a certain threshold.
  4. Dependency Checks: Use tools like pip-audit for Python to check for known vulnerabilities in your project dependencies.
  5. Code Quality Metrics: Consider integrating a tool like SonarCloud or CodeClimate to keep track of technical debt and code complexity.
  6. Documentation Checks: If you have project documentation (for example, with Sphinx), ensure it builds correctly and detect broken links.
  7. Performance Benchmarking: If your project's performance is crucial, incorporate benchmarks to detect performance regressions.

Here's a sample snippet for a GitHub Action workflow including some of these suggestions:

name: Python CI

on:
  pull_request:
  push:
    branches:
      - main
    paths:
      - '**.py'

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.8'

    - name: Install dependencies
      run: |
        pip install -r requirements.txt
        pip install black isort flake8 mypy coverage

    - name: Check code formatting with black
      run: black --check .

    - name: Sort import statements with isort
      run: isort --check-only .

    - name: Lint with flake8
      run: flake8 .

    - name: Static type-checking with mypy
      run: mypy .

    - name: Run pytest with coverage
      run: |
        coverage run -m pytest
        coverage report --fail-under=80

    - name: Check for security issues with bandit
      run: bandit -r .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant