From 5a38f11c478a28aacebe52e4288d976a94b3e0cd Mon Sep 17 00:00:00 2001 From: Jake Herbst Date: Thu, 12 May 2022 09:11:17 -0400 Subject: [PATCH] Adding python flak8 linting to CI for .py files only --- .github/workflows/python-ci.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/python-ci.yml diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml new file mode 100644 index 0000000..e918979 --- /dev/null +++ b/.github/workflows/python-ci.yml @@ -0,0 +1,33 @@ +name: Python CI + +on: + pull_request: + branches: + - main + paths: + - '**.py' + +jobs: + python-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + # This is a bit heavy handed, but we need `origin/main` to get a ref to diff against + fetch-depth: 0 + + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: '3.9.x' + cache: 'pip' + architecture: 'x64' + + - name: Install flake8 + run: pip install flake8 + + - name: Run Flake8 Lint + run: | + DIFF="$(git --no-pager diff -u $(git merge-base HEAD origin/main) -- '**/*.py')" + echo "$DIFF" | flake8 --diff