Remove 'version' key from docker-compose.yml
#92
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: Test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:10.8 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: 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 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Get Python Version | |
id: get-python-version | |
run: | | |
echo "::set-output name=python-version::$(python -c "import sys; print(sys.hexversion)")" | |
shell: bash | |
- name: Cache | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.cache/pip | |
src/.venv | |
key: ${{ runner.os }}-${{ steps.get-python-version.outputs.python-version }}-${{ hashFiles('Pipfile.lock') }} | |
- name: Install dependencies | |
run: | | |
cd src | |
sudo pip install pipenv | |
PIPENV_VENV_IN_PROJECT=1 pipenv sync --dev | |
- name: Linting and static analysis | |
uses: pre-commit/[email protected] | |
- name: Initialize DB | |
env: | |
DATABASE_URL: "postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres" | |
run: | | |
cd src | |
pipenv run python manage.py migrate | |
- name: Run tests | |
env: | |
DATABASE_URL: "postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres" | |
run: | | |
cd src | |
pipenv run python manage.py test |