diff --git a/.github/workflows/on_update.yml b/.github/workflows/on_update.yml index 98cbff14..d852b370 100644 --- a/.github/workflows/on_update.yml +++ b/.github/workflows/on_update.yml @@ -14,8 +14,62 @@ permissions: contents: read jobs: + lint: + name: Lint + runs-on: ${{ matrix.platform }} + strategy: + fail-fast: false + matrix: + platform: + - ubuntu-latest + python-version: ["3.6", "3.7", "3.8", "3.9"] + steps: + - name: Checkout source at ${{ matrix.platform }} + uses: actions/checkout@v3 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install -r requirements/base.txt -r requirements/ci.txt + - name: Run flake8 + run: | + flake8 src/ tests/ + - name: Run pylint + if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.6' }} + run: | + pylint -d unused-import,no-self-use,bad-option-value src/ tests/ + - name: Run pylint + if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version != '3.6' }} + run: | + pylint src/ tests/ + test: - name: Test, Style, Lint, Typing, Security and Docs + name: Test + runs-on: ${{ matrix.platform }} + strategy: + fail-fast: false + matrix: + platform: + - ubuntu-latest + python-version: ["3.6", "3.7", "3.8", "3.9"] + steps: + - name: Checkout source at ${{ matrix.platform }} + uses: actions/checkout@v3 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install -r requirements/base.txt -r requirements/test.txt + - name: Run py.test + run: | + py.test + + run-tox: + name: Tox | Test, Style, Lint, Typing, Security and Docs runs-on: ${{ matrix.platform }} strategy: fail-fast: false @@ -32,7 +86,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip setuptools tox + python -m pip install --upgrade pip tox - name: Run tox run: | tox -e py,py-async,style,typing,security,docs diff --git a/bin/docker-compose-it.sh b/bin/docker-compose-it.sh index fa4ffd22..61af8ccf 100755 --- a/bin/docker-compose-it.sh +++ b/bin/docker-compose-it.sh @@ -13,7 +13,7 @@ docker logs ci_it_sut_1 DOCKER_WAIT_FOR_ASYNC_SUT=$(docker wait ci_it_async_sut_1) docker logs ci_it_async_sut_1 -docker-compose -f ${DOCKER_COMPOSE_FILE_PATH} -p ci_it down +docker-compose -f ${DOCKER_COMPOSE_FILE_PATH} -p ci_it down --remove-orphans if [ ${DOCKER_WAIT_FOR_SUT} -ne 0 ]; then echo "Integration Tests for sync app failed"; exit 1; fi if [ ${DOCKER_WAIT_FOR_ASYNC_SUT} -ne 0 ]; then echo "Integration Tests for async app failed"; exit 1; fi diff --git a/bin/docker-compose-test.sh b/bin/docker-compose-test.sh index e1cacae6..6d4a179a 100755 --- a/bin/docker-compose-test.sh +++ b/bin/docker-compose-test.sh @@ -22,7 +22,7 @@ docker logs ci_python3.9_1 DOCKER_WAIT_FOR_PY310=$(docker wait ci_python3.10_1) docker logs ci_python3.10_1 -docker-compose -f ${DOCKER_COMPOSE_FILE_PATH} -p ci down +docker-compose -f ${DOCKER_COMPOSE_FILE_PATH} -p ci down --remove-orphans if [ ${DOCKER_WAIT_FOR_PY36} -ne 0 ]; then echo "Test to Python 3.6 failed"; exit 1; fi if [ ${DOCKER_WAIT_FOR_PY37} -ne 0 ]; then echo "Test to Python 3.7 failed"; exit 1; fi diff --git a/docker-compose.test.yml b/docker-compose.test.yml index ef00c01c..ab04659c 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -61,5 +61,5 @@ services: - PRAGMA_VERSION=py3.6 command: > sh -c "flake8 src/ tests/ && - pylint src/ tests/ && + pylint -d unused-import,no-self-use,bad-option-value src/ tests/ && pytest" diff --git a/pyproject.toml b/pyproject.toml index a5fada61..bdcd5aab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,5 @@ exclude = ''' | htmldoc )/ | settings.py - ) ''' diff --git a/requirements/ci.txt b/requirements/ci.txt index 4da6e09d..79b9b46e 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -7,11 +7,11 @@ pyupgrade==3.2.2;python_version>"3.6" # https://github.com/asottile/pyupgrade # ------------------------------------------------------------------------------ flake8==5.0.4 # https://github.com/PyCQA/flake8 flake8-isort==5.0.0;python_version>"3.6" # https://github.com/gforcada/flake8-isort -flake8-isort<=4.2.0;python_version<="3.6" +flake8-isort<5.0.0;python_version<="3.6" +isort>=4.2.5,<6;python_version<="3.6" # https://github.com/PyCQA/isort flake8-bugbear==22.10.27;python_version>"3.6" # https://github.com/PyCQA/flake8-bugbear flake8-bugbear<22.10;python_version<="3.6" flake8-pyi==22.10.0;python_version>"3.6" # https://github.com/ambv/flake8-pyi -flake8-pyi<20.10;python_version<="3.6" flake8-quotes==3.3.1 # https://github.com/zheller/flake8-quotes flake8-implicit-str-concat==0.3.0;python_version>"3.6" # https://github.com/keisheiled/flake8-implicit-str-concat flake8-implicit-str-concat<0.3.0;python_version<="3.6" @@ -19,7 +19,7 @@ flake8-implicit-str-concat<0.3.0;python_version<="3.6" # Code linter # ------------------------------------------------------------------------------ pylint==2.15.5;python_version>"3.6" # https://github.com/PyCQA/pylint -pylint<=2.13.9;python_version<="3.6" +pylint<2.14.0;python_version<="3.6" # Type check # ------------------------------------------------------------------------------ diff --git a/requirements/test.txt b/requirements/test.txt index f519c8ff..2eaf25c0 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -22,5 +22,5 @@ coveralls==3.3.1 # https://github.com/marketplace/coveralls # Tools # ------------------------------------------------------------------------------ requests==2.28.1;python_version>"3.6" # https://github.com/psf/requests -requests<=2.27.1;python_version<="3.6" +requests<2.28.0;python_version<="3.6" py==1.11.0 # https://github.com/pytest-dev/py diff --git a/tox.ini b/tox.ini index 62b1d11e..7a49e05a 100644 --- a/tox.ini +++ b/tox.ini @@ -12,14 +12,17 @@ skip_missing_interpreters = true deps = -r requirements/test.txt async: Flask[async] -commands = pytest -v --tb=short --basetemp={envtmpdir} {posargs} +commands = + pytest -v --tb=short --basetemp={envtmpdir} {posargs} [testenv:style] deps = pre-commit skip_install = true -commands = pre-commit run --all-files --show-diff-on-failure +commands = + pre-commit run --all-files --show-diff-on-failure [testenv:typing] +basepython=python3.10 deps = mypy==0.991 pytype==2022.10.13 @@ -28,6 +31,7 @@ commands = pytype [testenv:security] +basepython=python3.10 deps = bandit==1.7.4 safety==2.1.1 @@ -36,5 +40,8 @@ commands = bandit -r src/ [testenv:docs] -deps = -r requirements/docs.txt -commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/htmldoc +basepython=python3.10 +deps = + -r requirements/docs.txt +commands = + sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/htmldoc