diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9e322af..b7e794da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,13 +88,7 @@ jobs: git commit -m initial pip install . pip install .[dev] - - - name: pylint checks - if: ${{ contains (matrix.copier_config.name, 'Base') }} - run: | - cd ../test/${{ matrix.copier_config.foldername }} - python -m pylint --recursive=y ./src/ --rcfile=./src/.pylintrc - + - name: black checks uses: psf/black@stable with: diff --git a/python-project-template/.github/workflows/{% if mypy_type_checking != 'none' %}type-checking.yml{% endif %}.jinja b/python-project-template/.github/workflows/code_style.yml.jinja similarity index 57% rename from python-project-template/.github/workflows/{% if mypy_type_checking != 'none' %}type-checking.yml{% endif %}.jinja rename to python-project-template/.github/workflows/code_style.yml.jinja index 7e8bea46..398cb69f 100644 --- a/python-project-template/.github/workflows/{% if mypy_type_checking != 'none' %}type-checking.yml{% endif %}.jinja +++ b/python-project-template/.github/workflows/code_style.yml.jinja @@ -1,7 +1,7 @@ -# This workflow will install Python dependencies, then perform static type checking analysis. +# This workflow will install Python dependencies, then perform static analysis for code style and type checking. # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: mypy Type checking +name: Code Style analysis on: push: @@ -33,11 +33,31 @@ jobs: pip install . pip install .[dev] if [ -f requirements.txt ]; then pip install -r requirements.txt; fi +{%- if mypy_type_checking == 'basic' -%} - name: Analyze code with mypy -{% if mypy_type_checking == 'basic' %} run: | mypy ./src ./tests --ignore-missing-imports -{% elif mypy_type_checking == 'strict' %} +{%- elif mypy_type_checking == 'strict' -%} + - name: Analyze code with mypy run: | mypy ./src ./tests --strict -{% endif -%} +{%- endif -%} +{%- if 'black' in enforce_style -%} + - name: Analyze code for black formatting + run: | + black --check . +{%- endif -%} +{%- if 'pylint' in enforce_style -%} + - name: Analyze code with pylint + run: | + pylint -rn -sn --recursive=y ./src --rcfile=./src/.pylintrc + pylint -rn -sn --recursive=y ./tests --rcfile=./tests/.pylintrc +{%- if include_benchmarks %} + pylint -rn -sn --recursive=y ./benchmarks --rcfile=./tests/.pylintrc +{%- endif -%} +{%- endif -%} +{%- if 'ruff' in enforce_style -%} + - name: Analyze code with ruff + ruff format --check + ruff check +{%- endif -%} \ No newline at end of file diff --git a/python-project-template/.github/workflows/smoke-test.yml.jinja b/python-project-template/.github/workflows/smoke-test.yml.jinja index 709a5d86..9ccdec28 100644 --- a/python-project-template/.github/workflows/smoke-test.yml.jinja +++ b/python-project-template/.github/workflows/smoke-test.yml.jinja @@ -45,6 +45,7 @@ jobs: - name: Send failure email {%- endif %} {%- if 'slack' in failure_notification %} +{%- raw %} - name: Send status to Slack app if: ${{ failure() && github.event_name != 'workflow_dispatch' }} # Only post if the workflow failed and was not manually started. Customize this as necessary./ id: slack @@ -83,4 +84,5 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # Here is where the webhook URL is provided SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK +{%- endraw %} {%- endif %}