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

upgrade template v6.1.0 #4

Merged
merged 9 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: v5.3.2-4-gfcbfe6f
_commit: v6.1.0
_src_path: gh:eccenca/cmem-plugin-template
author_mail: [email protected]
author_name: Hannes Hartmann
Expand Down
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

12 changes: 2 additions & 10 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,13 @@ jobs:
run: |
poetry self add "poetry-dynamic-versioning[plugin]"

- name: bandit
run: |
task check:bandit

- name: flake8
run: |
task check:flake8

- name: mypy
run: |
task check:mypy

- name: pylint
- name: ruff
run: |
task check:pylint
task check:ruff

- name: pytest
env:
Expand Down
30 changes: 4 additions & 26 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,15 @@ stages:
- build
- publish

bandit:
ruff:
stage: test
script:
- task check:bandit
- task check:ruff
artifacts:
when: always
reports:
junit:
- dist/junit-bandit.xml

flake8:
stage: test
script:
- task check:flake8
artifacts:
when: always
reports:
junit:
- dist/junit-flake8.xml
- dist/junit-ruff.xml

mypy:
stage: test
Expand All @@ -49,16 +39,6 @@ mypy:
junit:
- dist/junit-mypy.xml

pylint:
stage: test
script:
- task check:pylint
artifacts:
when: always
reports:
junit:
- dist/junit-pylint.xml

pytest:
stage: test
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
Expand Down Expand Up @@ -86,7 +66,6 @@ safety:
build:
stage: build
needs:
- bandit
- mypy
- pytest
- safety
Expand All @@ -102,8 +81,7 @@ pypi:
# publishing only available on a tag
stage: publish
needs:
- flake8
- pylint
- ruff
- build
allow_failure: true
when: manual
Expand Down
46 changes: 33 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,37 @@
repos:
- repo: local
hooks:
- id: pylint
name: pylint
entry: poetry run pylint
exclude: '^tests/.*$'
language: system
types: [python]
- repo: local
hooks:
- id: forbidden-files
name: forbidden files
entry: found copier update rejection files; review them and remove them
language: fail
files: "\\.rej$"

- id: ruff
name: check:ruff
entry: task check:ruff
language: python
types_or: [python, pyi]
pass_filenames: false

- id: poetry-check
name: poetry-check
description: run poetry check to validate config
entry: poetry check
language: python
pass_filenames: false
files: ^(.*/)?pyproject\.toml$

- id: poetry-lock
name: poetry-lock
description: run poetry lock to update lock file
entry: poetry lock
language: python
pass_filenames: false
files: ^(.*/)?(poetry\.lock|pyproject\.toml)$

- id: poetry-install
name: poetry-install
description: >
run poetry install to install dependencies from the lock file
entry: poetry install
language: python
pass_filenames: false
stages: [post-checkout, post-merge]
always_run: true

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/)

## [Unreleased]

### Changed

- upgrade template to 6.1

## [2.1.0] 2023-10-29

### Added
Expand Down
71 changes: 30 additions & 41 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,19 @@ tasks:
cmds:
- poetry install

python:format:
desc: Format Python files
format:fix:
desc: Format Python files and fix obvious issues
<<: *preparation
cmds:
- poetry run black .
- poetry run ruff format tests {{.PACKAGE}}
- poetry run ruff check tests {{.PACKAGE}} --fix-only

format:fix-unsafe:
desc: Format Python files and fix 'unsafe' issues
<<: *preparation
cmds:
- poetry run ruff format tests {{.PACKAGE}}
- poetry run ruff check tests {{.PACKAGE}} --fix-only --unsafe-fixes

clean:
desc: Removes dist, *.pyc and some caches
Expand All @@ -83,18 +91,16 @@ tasks:

check:
desc: Run whole test suite incl. unit and integration tests
deps:
- check:linters
- check:pytest
cmds:
- task: check:linters
- task: check:pytest

check:linters:
desc: Run all linter and static code analysis tests
deps:
- check:bandit
- check:flake8
- check:mypy
- check:pylint
- check:safety
cmds:
- task: check:ruff
- task: check:mypy
- task: check:safety

check:pytest:
desc: Run unit and integration tests
Expand Down Expand Up @@ -125,60 +131,40 @@ tasks:
BADGE_COVERAGE: ./{{.DIST_DIR}}/badge-coverage.svg
BADGE_TESTS: ./{{.DIST_DIR}}/badge-tests.svg

check:pylint:
desc: Find code smells, errors and style issues
<<: *preparation
cmds:
- poetry run pylint --exit-zero {{.PACKAGE}}
- poetry run pylint {{.PACKAGE}} {{.XML_PARAMS}}
vars:
FORMAT: --output-format=pylint_junit.JUnitReporter
JUNIT_FILE: ./{{.DIST_DIR}}/junit-pylint.xml
XML_PARAMS: --output={{.JUNIT_FILE}} {{.FORMAT}}

check:mypy:
desc: Find type errors
desc: Complain about typing errors
<<: *preparation
cmds:
- poetry run mypy -p tests -p {{.PACKAGE}} --junit-xml {{.JUNIT_FILE}}
vars:
JUNIT_FILE: ./{{.DIST_DIR}}/junit-mypy.xml

check:safety:
desc: Scan dependencies for vulnerabilities
desc: Complain about vulnerabilities in dependencies
<<: *preparation
cmds:
# ignore 39611 pyyaml - dev dependency only
# ignore 51358 safety - dev dependency only
# ignore 61489 pillow - dev dependency only
- poetry run safety check -i 39611 -i 51358 -i 61489

check:bandit:
desc: Find common security issues
<<: *preparation
cmds:
- poetry run bandit --exit-zero -r {{.PACKAGE}}
- poetry run bandit --format xml -r {{.PACKAGE}} -o {{.JUNIT_FILE}}
vars:
JUNIT_FILE: ./{{.DIST_DIR}}/junit-bandit.xml

check:flake8:
desc: Enforce standard source code style guide
check:ruff:
desc: Complain about everything else
<<: *preparation
cmds:
- poetry run flake8 --exit-zero tests {{.PACKAGE}} {{.XML_PARAMS}}
- poetry run flake8 --show-source tests {{.PACKAGE}}
- poetry run ruff check --exit-zero tests {{.PACKAGE}} {{.XML_PARAMS}}
- poetry run ruff check --show-source tests {{.PACKAGE}}
- poetry run ruff format --check tests {{.PACKAGE}}
vars:
JUNIT_FILE: ./{{.DIST_DIR}}/junit-flake8.xml
XML_PARAMS: --format junit-xml --output-file {{.JUNIT_FILE}}
JUNIT_FILE: ./{{.DIST_DIR}}/junit-ruff.xml
XML_PARAMS: --output-format junit --output-file {{.JUNIT_FILE}}

# }}}
# {{{ build and deploy tasks

deploy:
desc: Install plugin package in Corporate Memory
deps:
- clean
- build
cmds:
- cmemc admin workspace python install dist/*.tar.gz
Expand All @@ -187,6 +173,9 @@ tasks:
build:
desc: Build a tarball and a wheel package
<<: *preparation
deps:
- clean
- poetry:check
cmds:
- poetry build

Expand Down
1 change: 1 addition & 0 deletions cmem_plugin_mattermost/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""mattermost - main package"""
1 change: 1 addition & 0 deletions cmem_plugin_mattermost/workflow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""workflow main package"""
Loading
Loading