Skip to content

Merge pull request #36 from openstates/events-media-validation-fix-no… #244

Merge pull request #36 from openstates/events-media-validation-fix-no…

Merge pull request #36 from openstates/events-media-validation-fix-no… #244

Workflow file for this run

name: Test Python
on:
push:
branches:
- "**"
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: 'v3test'
POSTGRES_PASSWORD: 'v3test'
POSTGRES_DB: 'v3test'
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
# Python & dependency installation
- uses: actions/checkout@v3
- name: setup Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: install Poetry
uses: snok/[email protected]
- name: cache Poetry virtualenv
uses: actions/cache@v2
id: cache
with:
path: ~/.virtualenvs/
key: poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ hashFiles('**/poetry.lock') }}
- name: set poetry config path
run: poetry config virtualenvs.path ~/.virtualenvs
- name: install dependencies
run: poetry install
# if: steps.cache.outputs.cache-hit != 'true'
- name: lint with black
run: poetry run black --diff --check .
- name: lint with flake8
run: poetry run flake8 api --show-source --statistics
- name: pytest
run: poetry run pytest
env:
PYTHONPATH: scripts
DATABASE_URL: postgresql://v3test:v3test@localhost/v3test