Skip to content

RHINENG-14556 remove old code to keep the new service independent #749

RHINENG-14556 remove old code to keep the new service independent

RHINENG-14556 remove old code to keep the new service independent #749

# This workflow will install Python dependencies,
# run tests and lint with a single version of Python
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: (Non blocking) Test on latest direct Python dependencies
on:
push:
branches: [ main, pcp-zeroconf ]
pull_request:
branches: [ main, pcp-zeroconf ]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
ports:
- 15432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: 'ros_db_test'
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
zookeeper:
image: confluentinc/cp-zookeeper
env:
ZOOKEEPER_CLIENT_PORT: 32181
ZOOKEEPER_SERVER_ID: 1
kafka:
image: confluentinc/cp-kafka
ports:
- 29092:29092
- 9092:9092
env:
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_BROKER_ID: 1
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:32181
KAFKA_AUTO_CREATE_TOPICS_ENABLE: true
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.11
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Get pip version
run: |
pip --version
- name: Install poetry
run: |
pip install poetry
- name: Update all dependencies to latest
run: |
echo "`cat <<EOF
[tool.poetry]
name = "ros-backend"
version = "2.4.0"
description = "Backend for Resource Optimization"
readme = "README.md"
authors = []
[tool.poetry.dependencies]
python = "~=3.11"
Flask = "*"
gunicorn = "*"
flask-restful = "*"
Flask-SQLAlchemy = "*"
sqlalchemy = "*"
psycopg2-binary = "*"
flask-migrate = "*"
flask-cors = "*"
confluent-kafka = "*"
requests = "*"
insights-core = "*"
pydash = "*"
app-common-python = "*"
prometheus-client = "*"
prometheus-flask-exporter = "*"
pyyaml = "*"
watchtower = "*"
boto3 = "*"
botocore = "*"
flask-caching = "*"
flask-unleash = "*"
[tool.poetry.group.dev.dependencies]
flake8 = "*"
pytest = "*"
sqlalchemy-utils = "*"
pytest-mock = "*"
pytest-cov = "*"
logstash_formatter = "*"
pytest_mock_resources = "*"
python-on-whales = "*"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
EOF`" > pyproject.toml
rm -rf poetry.lock
poetry install
- name: Show all installed packages
run: |
poetry run pip list
- name: Lint with flake8
run: |
pip install flake8
flake8 .
- name: Test with pytest
run: |
pip install pytest pytest-cov
poetry run pytest --cov=ros tests
env:
DB_NAME: ros_db_test
DB_HOST: localhost
DB_PORT: 15432
DB_USER: postgres
DB_PASSWORD: postgres
- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
verbose: true
flags: unittests