Skip to content

Feat/kl/new features (#37) #271

Feat/kl/new features (#37)

Feat/kl/new features (#37) #271

Workflow file for this run

name: Tests
on: push
env:
BOT_CREDENTIALS: example.ru@6d624b45b67f843322ebaa1143132a24@7a1c7744-23c9-4ba9-a7dc-5381f090a52d
REDIS_DSN: redis://localhost:6379/0
POSTGRES_DSN: postgresql://postgres:postgres@localhost:5432/postgres
poetry_version: "1.4.0"
project_name: "async-box-bot"
PROD_SERVER_HOST: "prod.example.com"
DEV_SERVER_HOST: "dev.example.com"
BOTS_REGISTRY_URL: "registry.example.com/bots/"
jobs:
test-image:
name: Test app start
runs-on: ubuntu-20.04
services:
postgres:
image: postgres:12
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:6
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install copier
run: |
pip install copier==9.3.1
pip install copier-templates-extensions
pip install pyyaml-include==1.4.1
# hardcode pydantic version to avoid dependency conflict with copier
# pip install pydantic==1.10.2
- name: Test image
env:
REDIS_DSN: ${{ env.REDIS_DSN }}
POSTGRES_DSN: ${{ env.POSTGRES_DSN }}
run: ./.github/scripts/test_image
test-template:
name: Test template
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11" ]
services:
postgres:
image: postgres:12
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:6
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install copier
run: |
pip install copier==9.3.1
pip install copier-templates-extensions
pip install pyyaml-include==1.4.1
# hardcode pydantic version to avoid dependency conflict with copier
# pip install pydantic==1.10.2
python -m copier copy --defaults --trust . async-box-bot
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Set up cache
id: cache
uses: actions/cache@v2
with:
path: |
~/.cache/pip
${{ env.project_name }}/.venv
key: venv-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
working-directory: ${{ env.project_name }}
run: |
pip install poetry==${{ env.poetry_version }}
poetry config virtualenvs.in-project true
poetry install
- name: Run tests
env:
BOT_CREDENTIALS: example.ru@6d624b45b67f843322ebaa1143132a24@7a1c7744-23c9-4ba9-a7dc-5381f090a52d
REDIS_DSN: redis://localhost:6379/0
POSTGRES_DSN: postgresql://postgres:postgres@localhost:5432/postgres
working-directory: ${{ env.project_name }}
run: |
poetry run ./scripts/test
lint:
name: Lint
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11" ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install copier
run: |
pip install copier==9.3.1
pip install copier-templates-extensions
pip install pyyaml-include==1.4.1
# hardcode pydantic version to avoid dependency conflict with copier
# pip install pydantic==1.10.2
python -m copier copy --defaults --trust . async-box-bot
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Set up cache
id: cache
uses: actions/cache@v2
with:
path: |
~/.cache/pip
${{ env.project_name }}/.venv
key: venv-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
working-directory: ${{ env.project_name }}
run: |
pip install poetry==${{ env.poetry_version }}
poetry config virtualenvs.in-project true
poetry install
- name: Run linters
working-directory: ${{ env.project_name }}
run: |
poetry run ./scripts/lint