-
-
Notifications
You must be signed in to change notification settings - Fork 181
79 lines (77 loc) · 2.59 KB
/
python-build.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
name: Build and Test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
services:
postgres:
image: debezium/postgres:17
env:
POSTGRES_DB: testdb
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
ports:
- 6379:6379
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.13
ports:
- 9200:9200
- 9300:9300
env:
xpack.security.enabled: false
network.host: 127.0.0.1
http.host: 0.0.0.0
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/dev.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest
pwd
pytest -x -s -vv --cov=./pgsync --cov-report=xml:tests/coverage.xml --cov-report term-missing
env:
# use postgres for the host here because we have specified a container for the job.
# If we were running the job on the VM this would be localhost
ELASTICSEARCH_HOST: localhost
ELASTICSEARCH_PORT: 9200
ELASTICSEARCH_SCHEME: http
PATH: $PATH:./bin
PG_HOST: localhost
PG_PORT: ${{ job.services.postgres.ports['5432'] }}
PG_PASSWORD: postgres
PG_USER: postgres
PYTHONPATH: $PYTHONPATH:./pgsync
LOGSTASH_HOST: localhost
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: tests/coverage.xml
flags: unittests
name: codecov-umbrella
yml: ./codecov.yml
fail_ci_if_error: false