mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2026-10-29 01:26:08 +03:00
It works! So, yes, need refs/remotes/origin/ prepended to the base_ref, which will always be a branch for a PR. * Remove debug lines (set -x, etc). * No need for pytest here as yet. * Fall back to requirements.txt if no requirements-dev.txt.
53 lines
1.6 KiB
YAML
53 lines
1.6 KiB
YAML
# This workflow will:
|
|
#
|
|
# * install Python dependencies
|
|
# * lint with a single version of Python
|
|
#
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
|
|
name: PR-Checks
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ develop ]
|
|
|
|
jobs:
|
|
flake8:
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
|
- name: Checkout commits
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Checkout base ref
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{github.base_ref}}
|
|
fetch-depth: 0
|
|
- name: Checkout head of PR
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{github.head_ref}}
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python 3.7
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.7
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install flake8
|
|
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; elif [ -f requirements.txt ]; then pip install -r requirements.txt ; fi
|
|
|
|
- name: Lint with flake8
|
|
env:
|
|
BASE_REF: ${{github.base_ref}}
|
|
|
|
run: |
|
|
# stop the build if there are Python syntax errors or undefined names, ignore existing
|
|
git diff "refs/remotes/origin/${BASE_REF}" -- | 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
|
|
git diff "refs/remotes/origin/${BASE_REF}" -- | flake8 . --count --exit-zero --statistics --diff
|