Skip to content

Attempt to decrease cognitive complexity even more #245

Attempt to decrease cognitive complexity even more

Attempt to decrease cognitive complexity even more #245

Workflow file for this run

name: main
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: set up poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: configure gitlab auth
run: poetry config http-basic.gitlab __token__ ${{ secrets.GITLAB_PYPI_TOKEN }}
- name: install dependencies
run: poetry install --no-interaction
- name: run isort before black
run: |
poetry run isort . --check-only # Run isort first
poetry run black . --check # Then black
poetry run flake8 .
bandit:
name: bandit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: set up poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: configure gitlab auth
run: poetry config http-basic.gitlab __token__ ${{ secrets.GITLAB_PYPI_TOKEN }}
- name: install dependencies
run: poetry install --no-interaction
- name: bandit
run: poetry run bandit -r -c pyproject.toml . --skip B105,B106,B101
cognitive:
name: cognitive
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: set up poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: configure gitlab auth
run: poetry config http-basic.gitlab __token__ ${{ secrets.GITLAB_PYPI_TOKEN }}
- name: install dependencies
run: poetry install --no-interaction
- name: cognitive
run: poetry run flake8 . --max-cognitive-complexity=5 --ignore=E501
pydocstyle:
name: pydocstyle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: set up poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: configure gitlab auth
run: poetry config http-basic.gitlab __token__ ${{ secrets.GITLAB_PYPI_TOKEN }}
- name: install dependencies
run: poetry install --no-interaction
- name: pydocstyle
run: poetry run pydocstyle .
test:
name: test
runs-on: ubuntu-latest
needs: [bandit, cognitive, lint, pydocstyle]
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: set up poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: configure gitlab auth
run: poetry config http-basic.gitlab __token__ ${{ secrets.GITLAB_PYPI_TOKEN }}
- name: install dependencies
run: poetry install --no-interaction
- name: test
run: poetry run pytest
release:
name: tag, changelog, release, publish
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: set up poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: configure gitlab auth
run: poetry config http-basic.gitlab __token__ ${{ secrets.GITLAB_PYPI_TOKEN }}
- name: install dependencies
run: poetry install --no-interaction
- name: version
uses: paulhatch/semantic-version@v5.0.0
id: version
with:
major_pattern: "(feat!)"
minor_pattern: "(feat)"
- name: create changelog text
id: changelog
uses: loopwerk/tag-changelog@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
exclude_types: other,doc,chore
- name: Create release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version_tag }}
release_name: Release ${{ steps.version.outputs.version_tag }}
body: ${{ steps.changelog.outputs.changes }}
- name: create changelog pull request
uses: peter-evans/create-pull-request@v2
with:
commit-message: "Release ${{ steps.version.outputs.version_tag }} [skip ci]"
labels: release, bot
title: "Release ${{ steps.version.outputs.version_tag }}"
body: |
# Release ${{ steps.version.outputs.version_tag }}
Merge this PR to update your version and changelog!
## Included Pull Requests
${{ steps.changelog.outputs.changes }}