From ce75d719c5bb119aefc31059e31dcad95b9eb5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Wed, 8 Jan 2020 13:40:37 +0100 Subject: [PATCH] action-pylint initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- Dockerfile | 23 ++++++++++++++++++++++ README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ entrypoint.sh | 4 ++++ requirements.txt | 6 ++++++ 4 files changed, 83 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100755 entrypoint.sh create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dc7d6af --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM konstruktoid/alpine + +LABEL "com.github.actions.name"="Konstruktoid Python linting" +LABEL "com.github.actions.description"="Python linting using black and flake8" +LABEL "com.github.actions.icon"="mic" +LABEL "com.github.actions.color"="purple" + +LABEL "repository"="https://github.com/konstruktoid/action-pylint" +LABEL "homepage"="https://github.com/konstruktoid/action-pylint" +LABEL "maintainer"="Thomas Sjögren " + +COPY requirements.txt /requirements.txt + +RUN apk update && \ + apk upgrade && \ + apk --update add gcc musl-dev python3-dev python3 && \ + pip3 install --upgrade pip && \ + pip3 install -r /requirements.txt && \ + apk del gcc musl-dev python3-dev && \ + rm -rf /var/cache/apk/ + +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..8f02fd6 --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ += Python linting and testing using black and flake8 + +A GitHub action that checks Python code using [black](https://github.com/psf/black) +and [flake8](https://gitlab.com/pycqa/flake8). + +== Tools installed + +``` +black +flake8 +flake8-bandit +flake8-bugbear +flake8-deprecated +flake8-executable +``` + +== Github Actions configuration examples + +```sh +on: [push, pull_request] +name: Python Linting +jobs: + PythonLinting: + name: Python linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Konstruktoid Python linting + uses: konstruktoid/action-pylint@master +``` + +``` +workflow "Python Linting" { + on = "push" + resolves = ["python-linting"] +} + +action "python-linting" { + uses = "konstruktoid/action-pylint@master" +} +``` + +== Script + +```sh +#!/bin/sh -l + +black --quiet --check . +flake8 . +``` diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..695b684 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh -l + +black --quiet --check . +flake8 . diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a5781fd --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +black +flake8 +flake8-bandit +flake8-bugbear +flake8-deprecated +flake8-executable