Sfoglia il codice sorgente

Added separate lint step

Nuwan Goonasekera 5 anni fa
parent
commit
5fc83a1d44
2 ha cambiato i file con 33 aggiunte e 3 eliminazioni
  1. 27 0
      .github/workflows/integration.yaml
  2. 6 3
      tox.ini

+ 27 - 0
.github/workflows/integration.yaml

@@ -6,9 +6,36 @@ on: [push, pull_request]
 jobs:
   # Set the job key. The key is displayed as the job name
   # when a job name is not provided
+  lint:
+    name: Lint code
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: [ '3.8' ]
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+
+      - uses: actions/setup-python@v2
+        with:
+           python-version: ${{ matrix.python-version }}
+
+      - name: Cache pip dir
+        uses: actions/cache@v2
+        with:
+          path: ~/.cache/pip
+          key: pip-cache-${{ matrix.python-version }}-${{ hashFiles('**/setup.py', '**/requirements.txt') }}
+
+      - name: Install required packages
+        run: pip install tox
+
+      - name: Run tox
+        run: tox -e lint
+
   integration:
     # Name the Job
     name: Run mock integration tests
+    needs: lint
     # Set the type of machine to run on
     runs-on: ubuntu-latest
     strategy:

+ 6 - 3
tox.ini

@@ -6,11 +6,10 @@
 # running the tests.
 
 [tox]
-envlist = {py3.8,pypy}-{aws,azure,gcp,openstack,mock}
+envlist = {py3.8,pypy}-{aws,azure,gcp,openstack,mock},lint
 
 [testenv]
-commands = flake8 cloudbridge tests setup.py
-           # see setup.cfg for options sent to nosetests and coverage
+commands = # see setup.cfg for options sent to nosetests and coverage
            nosetests -v --nocapture --nologcapture --logging-format='%(asctime)s [%(levelname)s] %(name)s: %(message)s' {posargs}
 setenv =
     MOTO_AMIS_PATH=./tests/fixtures/custom_amis.json
@@ -31,3 +30,7 @@ passenv =
 deps =
     -rrequirements.txt
     coverage
+
+[testenv:lint]
+commands = flake8 cloudbridge tests setup.py
+deps = flake8