update reqs #553
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | |
services: | |
postgres: | |
image: debezium/postgres:16 | |
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 |