mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
* Added support of Bot API 6.2 * Added changelog * Update tests * Update API version * Update dependencies, pre-commit config * Added pytest config
113 lines
2.9 KiB
YAML
113 lines
2.9 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev-3.x
|
|
paths:
|
|
- ".github/workflows/tests.yml"
|
|
- "aiogram/**"
|
|
- "tests/**"
|
|
- ".coveragerc"
|
|
- ".flake8"
|
|
- "codecov.yaml"
|
|
- "mypy.ini"
|
|
- "poetry.lock"
|
|
- "pyproject.toml"
|
|
pull_request:
|
|
branches:
|
|
- dev-3.x
|
|
paths:
|
|
- ".github/workflows/tests.yml"
|
|
- "aiogram/**"
|
|
- "tests/**"
|
|
- ".coveragerc"
|
|
- ".flake8"
|
|
- "codecov.yaml"
|
|
- "mypy.ini"
|
|
- "poetry.lock"
|
|
- "pyproject.toml"
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 9
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
- macos-latest
|
|
- windows-latest
|
|
python-version:
|
|
- '3.8'
|
|
- '3.9'
|
|
- '3.10'
|
|
|
|
defaults:
|
|
# Windows sucks. Force use bash instead of PowerShell
|
|
run:
|
|
shell: bash
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
|
|
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install and configure Poetry
|
|
uses: snok/install-poetry@v1
|
|
with:
|
|
version: 1.1.11
|
|
virtualenvs-create: true
|
|
virtualenvs-in-project: true
|
|
installer-parallel: true
|
|
|
|
- name: Setup redis
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
|
uses: shogo82148/actions-setup-redis@v1
|
|
with:
|
|
redis-version: 6
|
|
|
|
- name: Load cached venv
|
|
id: cached-poetry-dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: .venv
|
|
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ secrets.CACHE_VERSION }}
|
|
|
|
- name: Project dependencies
|
|
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
|
run: |
|
|
poetry install --no-interaction -E fast -E redis -E proxy -E i18n -E docs
|
|
|
|
- name: Lint code
|
|
run: |
|
|
poetry run flake8 aiogram
|
|
poetry run mypy aiogram
|
|
|
|
- name: Check code-style (Black)
|
|
run: |
|
|
poetry run black --check --diff aiogram tests
|
|
|
|
- name: Run tests (with Redis)
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
|
run: |
|
|
poetry run pytest --cov=aiogram --cov-config .coveragerc --cov-report=xml --redis redis://localhost:6379/0
|
|
|
|
- name: Run tests (without Redis)
|
|
# Redis can't be used on GitHub Windows Runners
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
run: |
|
|
poetry run pytest --cov=aiogram --cov-config .coveragerc --cov-report=xml
|
|
|
|
- uses: codecov/codecov-action@v1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
file: coverage.xml
|
|
flags: unittests
|
|
name: py-${{ matrix.python-version }}-${{ matrix.os }}
|
|
fail_ci_if_error: true
|