diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index ce0233d..57abd8b 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -1,25 +1,33 @@ -name: Run Linters +name: Linters -on: [push, pull_request] +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] jobs: - mypy: + black: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Run MyPy python type checker - uses: jpetrucciani/mypy-check@master - with: - path: 'lnbits' - + - uses: actions/checkout@v2 + - run: sudo apt-get install python3-venv + - run: python3 -m venv venv + - run: ./venv/bin/pip install black + - run: make checkblack prettier: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Check JS code formatting convention - uses: creyD/prettier_action@v2.2 - with: - dry: True - prettier_options: --write lnbits/static/js/** lnbits/core/static/js/** lnbits/extensions/*/templates/** + - uses: actions/checkout@v2 + - run: npm install + - run: make checkprettier + mypy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: sudo apt-get install python3-venv + - run: sudo apt-get install libev-dev + - run: python3 -m venv venv + - run: ./venv/bin/pip install -r requirements.txt + - run: ./venv/bin/pip install mypy + - run: make mypy diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 415fd15..e271512 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8] + python-version: [3.8] steps: - uses: actions/checkout@v2 diff --git a/Makefile b/Makefile index b96d1ed..fd8c70d 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,20 @@ -all: prettier mypy black +all: format check + +format: prettier black + +check: mypy checkprettier checkblack prettier: $(shell find lnbits -name "*.js" -name ".html") ./node_modules/.bin/prettier --write lnbits/static/js/*.js lnbits/core/static/js/*.js lnbits/extensions/*/templates/*/*.html ./lnbits/core/templates/core/*.html lnbits/templates/*.html lnbits/extensions/*/static/js/*.js +black: $(shell find lnbits -name "*.py") + ./venv/bin/black --line-length 120 lnbits + mypy: $(shell find lnbits -name "*.py") - mypy lnbits + ./venv/bin/mypy lnbits -black: $(shell find lnbits -name "*.py") - black lnbits +checkprettier: $(shell find lnbits -name "*.js" -name ".html") + ./node_modules/.bin/prettier --check lnbits/static/js/*.js lnbits/core/static/js/*.js lnbits/extensions/*/templates/*/*.html ./lnbits/core/templates/core/*.html lnbits/templates/*.html lnbits/extensions/*/static/js/*.js + +checkblack: $(shell find lnbits -name "*.py") + ./venv/bin/black --check --line-length 120 lnbits diff --git a/package.json b/package.json index d2b6560..835ff77 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,5 @@ { "devDependencies": { "prettier": "^2.0.5" - }, - "scripts": { - "lint": "prettier --write lnbits/static/js/** lnbits/core/static/js/** lnbits/extensions/*/templates/**" } }