mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Update tests suite
This commit is contained in:
parent
de27ed8ff5
commit
9833dbed8a
1 changed files with 12 additions and 37 deletions
49
.github/workflows/tests.yml
vendored
49
.github/workflows/tests.yml
vendored
|
|
@ -8,11 +8,7 @@ on:
|
||||||
- ".github/workflows/tests.yml"
|
- ".github/workflows/tests.yml"
|
||||||
- "aiogram/**"
|
- "aiogram/**"
|
||||||
- "tests/**"
|
- "tests/**"
|
||||||
- ".coveragerc"
|
|
||||||
- ".flake8"
|
|
||||||
- "codecov.yaml"
|
- "codecov.yaml"
|
||||||
- "mypy.ini"
|
|
||||||
- "poetry.lock"
|
|
||||||
- "pyproject.toml"
|
- "pyproject.toml"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
|
|
@ -21,11 +17,6 @@ on:
|
||||||
- ".github/workflows/tests.yml"
|
- ".github/workflows/tests.yml"
|
||||||
- "aiogram/**"
|
- "aiogram/**"
|
||||||
- "tests/**"
|
- "tests/**"
|
||||||
- ".coveragerc"
|
|
||||||
- ".flake8"
|
|
||||||
- "codecov.yaml"
|
|
||||||
- "mypy.ini"
|
|
||||||
- "poetry.lock"
|
|
||||||
- "pyproject.toml"
|
- "pyproject.toml"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
@ -74,24 +65,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
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
|
- name: Setup redis
|
||||||
if: ${{ env.IS_WINDOWS == 'false' }}
|
if: ${{ env.IS_WINDOWS == 'false' }}
|
||||||
uses: shogo82148/actions-setup-redis@v1
|
uses: shogo82148/actions-setup-redis@v1
|
||||||
|
|
@ -99,32 +72,34 @@ jobs:
|
||||||
redis-version: 6
|
redis-version: 6
|
||||||
|
|
||||||
- name: Load cached venv
|
- name: Load cached venv
|
||||||
id: cached-poetry-dependencies
|
id: cached-pip-dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: .venv
|
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
|
- name: Install project dependencies
|
||||||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
if: steps.cached-pip-dependencies.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
flags=""
|
virtualenv .venv
|
||||||
[[ "$IS_PYPY" == "false" ]] && flags="$flags -E fast"
|
source .venv/bin/activate
|
||||||
poetry install --no-interaction -E redis -E proxy -E i18n $flags
|
extras="redis,proxy,i18n,test"
|
||||||
|
[[ "$IS_PYPY" == "false" ]] && extras="$extras,fast"
|
||||||
|
pip install -e .[$extras]
|
||||||
|
|
||||||
- name: Lint code
|
- name: Lint code
|
||||||
if: "env.IS_PYPY == 'false'"
|
if: "env.IS_PYPY == 'false'"
|
||||||
run: |
|
run: |
|
||||||
poetry run flake8 aiogram
|
ruff --format=github aiogram examples
|
||||||
poetry run mypy aiogram
|
mypy aiogram
|
||||||
poetry run black --check --diff aiogram tests
|
black --check --diff aiogram tests
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
flags=""
|
flags=""
|
||||||
[[ "$IS_PYPY" == "false" ]] && flags="$flags --cov=aiogram --cov-config .coveragerc --cov-report=xml"
|
[[ "$IS_PYPY" == "false" ]] && flags="$flags --cov=aiogram --cov-config .coveragerc --cov-report=xml"
|
||||||
[[ "$IS_WINDOWS" == "false" ]] && flags="$flags --redis redis://localhost:6379/0"
|
[[ "$IS_WINDOWS" == "false" ]] && flags="$flags --redis redis://localhost:6379/0"
|
||||||
poetry run pytest $flags
|
pytest $flags
|
||||||
|
|
||||||
- name: Upload coverage data
|
- name: Upload coverage data
|
||||||
if: "env.IS_PYPY == 'false'"
|
if: "env.IS_PYPY == 'false'"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue