ci-python.yml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. name: python
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. jobs:
  8. build:
  9. name: test
  10. runs-on: ubuntu-latest
  11. services:
  12. postgres:
  13. image: postgres:11
  14. env:
  15. POSTGRES_USER: postgres
  16. POSTGRES_PASSWORD: postgres
  17. POSTGRES_DB: postgres
  18. ports:
  19. - 5432:5432
  20. # needed because the postgres container does not provide a healthcheck
  21. options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
  22. steps:
  23. - uses: actions/checkout@v2.4.0
  24. - uses: actions/setup-python@v2
  25. with:
  26. python-version: 3.9
  27. - name: Install python dependencies
  28. working-directory: ./examples/python
  29. run: |
  30. python -m pip install --upgrade pip
  31. python -m pip install -r requirements.txt
  32. - name: Test python code
  33. working-directory: ./examples/python
  34. env:
  35. PG_USER: postgres
  36. PG_HOST: localhost
  37. PG_DATABASE: postgres
  38. PG_PASSWORD: postgres
  39. PG_PORT: ${{ job.services.postgres.ports['5432'] }}
  40. run: |
  41. pytest src/tests