-
Notifications
You must be signed in to change notification settings - Fork 23
139 lines (123 loc) · 3.61 KB
/
build_with_latest_direct_deps.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# 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 ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:9.6
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.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- 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.8"
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 = "*"
[tool.poetry.group.dev.dependencies]
flake8 = "*"
pytest = "*"
sqlalchemy-utils = "*"
pytest-mock = "*"
pytest-cov = "*"
[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