1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 07:47:14 +03:00

Replace python checks with jq in workflow

Also makes sure that pushes to main ARE checked
This commit is contained in:
A_D 2021-01-05 17:20:21 +02:00 committed by GitHub
parent 525f0b05e7
commit d58d831ebe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,7 @@ name: Push-Checks
on:
push:
branches: [ develop ]
branches: [ main ]
jobs:
build:
@ -27,27 +27,15 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install flake8 pytest wheel
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Lint with flake8
env:
ROOT_SHA: ${{github.base_ref}}
run: |
DATA=$(python3 <<EOF
import json
import os
with open(os.getenv('GITHUB_EVENT_PATH')) as f:
data = json.load(f)
typ = os.getenv('GITHUB_EVENT_NAME')
if 'pull_request' in typ:
print(data['base']['ref'])
elif 'push' in typ:
print(data['before'])
EOF
)
DATA=$(jq --raw-output .before $GITHUB_EVENT_PATH)
# stop the build if there are Python syntax errors or undefined names, ignore existing
git diff "$DATA" | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --diff
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide