Skip to content

Commit

Permalink
Add multi Python version on update workflow (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
nycholas committed Nov 19, 2022
1 parent 8628023 commit a72a0c4
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 14 deletions.
58 changes: 56 additions & 2 deletions .github/workflows/on_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion bin/docker-compose-it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion bin/docker-compose-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@ exclude = '''
| htmldoc
)/
| settings.py
)
'''
6 changes: 3 additions & 3 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ 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"

# 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
# ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 11 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,6 +31,7 @@ commands =
pytype

[testenv:security]
basepython=python3.10
deps =
bandit==1.7.4
safety==2.1.1
Expand All @@ -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

0 comments on commit a72a0c4

Please sign in to comment.