Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add black and flake8 linters to travis (tox)

NyanKiyoshi3bde96a504e6
diff --git a/.github/main.workflow b/.github/main.workflow
deleted file mode 100644
index 6e5c93259f..0000000000
--- a/.github/main.workflow
+++ /dev/null
@@ -1,30 +0,0 @@
-workflow "Linters" {
- on = "push"
- resolves = ["Black Linter", "Flake8 Linter"]
-}
-
-action "Build" {
- uses = "jefftriplett/python-actions@ba888adab5b57956dce82b7dfc06e87b65090a6d"
- args = "pip install flake8 black"
- env = {
- VENV_DIR = "/opt/"
- }
-}
-
-action "Black Linter" {
- uses = "jefftriplett/python-actions@ba888adab5b57956dce82b7dfc06e87b65090a6d"
- args = "black --check saleor tests"
- needs = ["Build"]
- env = {
- VENV_DIR = "/opt/"
- }
-}
-
-action "Flake8 Linter" {
- uses = "jefftriplett/python-actions@ba888adab5b57956dce82b7dfc06e87b65090a6d"
- args = "flake8 saleor tests"
- needs = ["Build"]
- env = {
- VENV_DIR = "/opt/"
- }
-}
diff --git a/.travis.yml b/.travis.yml
index bffb128c3c..a59c7d24a7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,15 +9,22 @@ cache:
pip: true
directories:
- node_modules
+ - $HOME/.cache/pip
install:
- pip install -U pip setuptools wheel
- pip install tox-travis
- - nvm install 10
- - npm i
- - npm run build-assets --production
- - npm run build-emails
+ - >
+ if [ ! -z "$DJANGO" ]; then
+ nvm install 10 \
+ && npm i \
+ && npm run build-assets --production \
+ && npm run build-emails
+ fi
script:
- - npm run test
+ - >
+ if [ ! -z "$DJANGO" ]; then
+ npm run test
+ fi
- tox
env:
global:
@@ -28,6 +35,11 @@ env:
- DJANGO="master"
matrix:
fast_finish: true
+ include:
+ - env: TOXENV=black
+ python: "3.6"
+ - env: TOXENV=flake8
+ python: "3.6"
allow_failures:
- python: "3.6"
env: DJANGO="master"
diff --git a/tox.ini b/tox.ini
index 5f8e50570d..ed7085895b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,7 +3,7 @@ envlist = py{36,37}-django{22,_master}
skipsdist = True
[testenv]
-passenv =
+passenv =
CODECOV_* TOXENV CI TRAVIS TRAVIS_*
DATABASE_URL SECRET_KEY
deps =
@@ -16,6 +16,20 @@ commands =
pytest --cov --cov-report=
codecov
+[testenv:black]
+basepython = python3.6
+deps =
+ black>=19.3b0
+commands =
+ black --check saleor tests
+
+[testenv:flake8]
+basepython = python3.6
+deps =
+ flake8>=3.7.0
+commands =
+ flake8 saleor tests
+
[travis]
python =
3.6: py36