Update tests suite

This commit is contained in:
Alex Root Junior 2023-01-08 21:43:11 +02:00
parent de27ed8ff5
commit 9833dbed8a
No known key found for this signature in database
GPG key ID: 074C1D455EBEA4AC

View file

@ -8,11 +8,7 @@ on:
- ".github/workflows/tests.yml"
- "aiogram/**"
- "tests/**"
- ".coveragerc"
- ".flake8"
- "codecov.yaml"
- "mypy.ini"
- "poetry.lock"
- "pyproject.toml"
pull_request:
branches:
@ -21,11 +17,6 @@ on:
- ".github/workflows/tests.yml"
- "aiogram/**"
- "tests/**"
- ".coveragerc"
- ".flake8"
- "codecov.yaml"
- "mypy.ini"
- "poetry.lock"
- "pyproject.toml"
jobs:
@ -74,24 +65,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install and configure Poetry
uses: snok/install-poetry@v1
if: "env.IS_PYPY == 'false' || env.IS_WINDOWS == 'false'"
with:
version: 1.2.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install and configure Poetry (PyPy on Windows)
if: "env.IS_PYPY == 'true' && env.IS_WINDOWS == 'true'"
run: |
set -eu
pip install "poetry==1.2.1"
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config installer.parallel true
- name: Setup redis
if: ${{ env.IS_WINDOWS == 'false' }}
uses: shogo82148/actions-setup-redis@v1
@ -99,32 +72,34 @@ jobs:
redis-version: 6
- name: Load cached venv
id: cached-poetry-dependencies
id: cached-pip-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ secrets.CACHE_VERSION }}
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}-${{ secrets.CACHE_VERSION }}
- name: Install project dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
if: steps.cached-pip-dependencies.outputs.cache-hit != 'true'
run: |
flags=""
[[ "$IS_PYPY" == "false" ]] && flags="$flags -E fast"
poetry install --no-interaction -E redis -E proxy -E i18n $flags
virtualenv .venv
source .venv/bin/activate
extras="redis,proxy,i18n,test"
[[ "$IS_PYPY" == "false" ]] && extras="$extras,fast"
pip install -e .[$extras]
- name: Lint code
if: "env.IS_PYPY == 'false'"
run: |
poetry run flake8 aiogram
poetry run mypy aiogram
poetry run black --check --diff aiogram tests
ruff --format=github aiogram examples
mypy aiogram
black --check --diff aiogram tests
- name: Run tests
run: |
flags=""
[[ "$IS_PYPY" == "false" ]] && flags="$flags --cov=aiogram --cov-config .coveragerc --cov-report=xml"
[[ "$IS_WINDOWS" == "false" ]] && flags="$flags --redis redis://localhost:6379/0"
poetry run pytest $flags
pytest $flags
- name: Upload coverage data
if: "env.IS_PYPY == 'false'"