From 801cc6d095db9a7e386f1f5b017d81140bf2ef87 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Thu, 21 May 2020 20:16:01 +0200 Subject: [PATCH] pre-commit: Configure and integrate with GitHub Actions --- .github/workflows/run_pre_commit.yml | 37 ++++++++++++++++++++++++++++ .pre-commit-config.yaml | 24 ++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .github/workflows/run_pre_commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/run_pre_commit.yml b/.github/workflows/run_pre_commit.yml new file mode 100644 index 0000000..2f30005 --- /dev/null +++ b/.github/workflows/run_pre_commit.yml @@ -0,0 +1,37 @@ +# Copyright (C) 2020 Sebastian Pipping +# Licensed under the MIT license + +name: Run pre-commit on all files + +on: +- pull_request +- push + +jobs: + run_pre_commit: + name: Run pre-commit on all files + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.8 + uses: actions/setup-python@v1.1.1 + with: + python-version: 3.8 + + - name: Install pre-commit + run: |- + pip install \ + --disable-pip-version-check \ + --user \ + --no-warn-script-location \ + pre-commit + echo "::set-env name=PATH::${HOME}/.local/bin:${PATH}" + + - name: Install pre-commit hooks + run: |- + pre-commit install --install-hooks + + - name: Run pre-commit on all files + run: |- + pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..43c452e --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +# Copyright (C) 2020 Sebastian Pipping +# Licensed under the MIT license + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.1.0 + hooks: + - id: check-yaml + - id: check-merge-conflict + - id: end-of-file-fixer + exclude: '^easy_select2/static/easy_select2/vendor/' + - id: trailing-whitespace + + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.1 + hooks: + - id: flake8 + args: ['--show-source'] + exclude: '^(docs/source/|sampleproject/demoapp/migrations/)' + + - repo: https://github.com/pre-commit/mirrors-isort + rev: v4.3.21 + hooks: + - id: isort