From 15ec09af058910e64daeedb2d4ef9004911761c6 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Thu, 28 Apr 2022 12:03:13 +0300 Subject: [PATCH] Some automated testing. - pre-commit config. - CI pipeline to build the package, validate with twine, install it and check the executable script. - Add a badge to the README. --- .gitlab-ci.yml | 14 ++++++++++ .pre-commit-config.yaml | 59 +++++++++++++++++++++++++++++++++++++++++ README.rst | 4 +++ 3 files changed, 77 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 .pre-commit-config.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..84079cd --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,14 @@ +--- +include: + - project: shore/ci-stuff + file: templates/pre-commit.yml + - project: shore/ci-stuff + file: templates/python.yml + +variables: + SKIP_PYPI_UPLOAD: 1 + +install wheel: + extends: .install-wheel + script: + - sampleproject diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..eaafb92 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,59 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks.git + rev: v4.0.1 + hooks: + - id: check-merge-conflict + - id: check-toml + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + exclude: \.diff$ + + - repo: https://github.com/codespell-project/codespell.git + rev: v2.1.0 + hooks: + - id: codespell + + - repo: https://github.com/amperser/proselint.git + rev: 0.10.2 + hooks: + - id: proselint + types: [plain-text] + exclude: LICENSE + + - repo: https://gitlab.com/devopshq/gitlab-ci-linter.git + rev: v1.0.2 + hooks: + - id: gitlab-ci-linter + args: + - "--server" + - https://git.shore.co.il + + - repo: https://git.shore.co.il/nimrod/yamltool.git + rev: v0.1.2 + hooks: + - id: yamltool + + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.26.3 + hooks: + - id: yamllint + + - repo: https://github.com/Lucas-C/pre-commit-hooks-markup.git + rev: v1.0.1 + hooks: + - id: rst-linter + + - repo: https://github.com/myint/rstcheck.git + rev: master + hooks: + - id: rstcheck + + - repo: https://github.com/ambv/black.git + rev: 22.3.0 + hooks: + - id: black + args: + - | + --line-length=79 diff --git a/README.rst b/README.rst index 34fe6d1..de4bf1f 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,10 @@ Sample Python project ##################### +.. image:: https://git.shore.co.il/nimrod/samplepyproject/badges/main/pipeline.svg + :target: https://git.shore.co.il/nimrod/samplepyproject/-/commits/main + :alt: pipeline status + A sample Python project. Meant as an instruction on creating a modern Python package with just the standard Python tooling (setuptools, wheel) and without additional tools like `Poetry <https://python-poetry.org/>`_, `Flit -- GitLab