version: 2
jobs:
    test-python37:
        docker:
            - image: python:3.7-alpine
            - image: postgres:11.0
              environment:
                  POSTGRES_DB: 'localizedfields'
                  POSTGRES_USER: 'localizedfields'
                  POSTGRES_PASSWORD: 'localizedfields'
        steps:
            - checkout
            - run:
                name: Install packages
                command: apk add postgresql-libs gcc musl-dev postgresql-dev git

            - run:
                name: Install Python packages
                command: pip install -r requirements/test.txt

            - run:
                name: Run tests
                command: tox -e 'py37-dj{20,21,22}'
                environment:
                    DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields'

            - store_test_results:
                path: reports

    lint:
        docker:
            - image: python:3.7-alpine
        steps:
            - checkout
            - run:
                name: Install packages
                command: apk add postgresql-libs gcc musl-dev postgresql-dev git

            - run:
                name: Install Python packages
                command: pip install -r requirements/test.txt

            - run:
                name: Verify formatting / linting
                command: python setup.py verify


workflows:
    version: 2
    build:
        jobs:
            - test-python37
            - lint

version: 2
jobs:
    test-python37:
        docker:
            - image: python:3.7-alpine
            - image: postgres:11.0
              environment:
                  POSTGRES_DB: 'localizedfields'
                  POSTGRES_USER: 'localizedfields'
                  POSTGRES_PASSWORD: 'localizedfields'
        steps:
            - checkout
            - run:
                name: Install packages
                command: apk add postgresql-libs gcc musl-dev postgresql-dev git

            - run:
                name: Install Python packages
                command: pip install -r requirements/test.txt

            - run:
                name: Run tests
                command: tox -e 'py37-dj{20,21,22}'
                environment:
                    DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields'

            - store_test_results:
                path: reports

    analysis:
        docker:
            - image: python:3.7-alpine
        steps:
            - checkout
            - run:
                name: Install packages
                command: apk add postgresql-libs gcc musl-dev postgresql-dev git

            - run:
                name: Install Python packages
                command: pip install -r requirements/test.txt

            - run:
                name: Verify formatting / linting
                command: python setup.py verify


workflows:
    version: 2
    build:
        jobs:
            - test-python37
            - analysis

Rename lint job to analysis
Rename lint job to analysis
