From b1d24537400a62335225ce4125236a7e27631f9b Mon Sep 17 00:00:00 2001 From: Yuval Goldberg Date: Thu, 22 Oct 2020 01:37:37 +0300 Subject: [PATCH] Add PYTHON variable to Makefile --- .github/workflows/tests.yaml | 38 +++++++++++++++++------------------- Makefile | 10 +++++++--- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d66144a..49d0e4c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -4,31 +4,29 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/dev-requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/dev-requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- - - name: Install Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: | - pip install -r dev-requirements.txt + - name: Install Dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: make deps - - name: Linter - run: make lint + - name: Linter + run: make lint - - name: Test - run: make test + - name: Test + run: make test diff --git a/Makefile b/Makefile index e5dca74..eb91e5e 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,15 @@ IGNORE_ERRORS = E501,F401,F403,F405 PKG = mathgenerator +PYTHON ?= python3 + +deps: + $(PYTHON) -m pip install --user -r dev-requirements.txt format: - python -m autopep8 --ignore=$(IGNORE_ERRORS) -ir $(PKG)/* + $(PYTHON) -m autopep8 --ignore=$(IGNORE_ERRORS) -ir $(PKG)/* lint: - python -m flake8 --ignore=$(IGNORE_ERRORS) $(PKG) + $(PYTHON) -m flake8 --ignore=$(IGNORE_ERRORS) $(PKG) test: - python -m pytest --verbose -s tests + $(PYTHON) -m pytest --verbose -s tests