From fa67b3ecd60ece794daa0d1a241e6cf2c7227e3d Mon Sep 17 00:00:00 2001 From: scragly <29337040+scragly@users.noreply.github.com> Date: Sat, 21 Sep 2019 14:31:25 +1000 Subject: Change CI DB setup to use docker. --- azure-pipelines.yml | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'azure-pipelines.yml') diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5a42085e..b3d4e6da 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,6 +16,15 @@ jobs: versionSpec: '3.7.x' addToPath: true + - task: DockerCompose@0 + displayName: 'Setup Database' + inputs: + action: Run a specific service + dockerComposeFile: docker-compose.yml + projectName: pydis_web + serviceName: postgres + ports: '7777:5432' + - script: | pip install pipenv pipenv install --dev --system @@ -25,21 +34,6 @@ jobs: - script: flake8 --format junit-xml --output-file TEST-lint.xml displayName: 'Run Linter' - - script: | - curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - - sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' - sudo apt-get update -y - sudo apt-get install -y postgresql-11 - displayName: 'Install PostgreSQL' - - - script: | - echo "$USER_CREATE_COMMAND;" > pgscript.sql - echo "CREATE DATABASE pysite OWNER pysite;" >> pgscript.sql - sudo su postgres -c "psql < pgscript.sql" - env: - USER_CREATE_COMMAND: CREATE USER pysite WITH PASSWORD 'pysite' CREATEDB - displayName: 'Setup Database' - - script: | python3 manage.py makemigrations --check python3 manage.py migrate @@ -49,7 +43,7 @@ jobs: --no-input env: CI: azure - DATABASE_URL: postgres://pysite:pysite@localhost/pysite + DATABASE_URL: postgres://pysite:pysite@localhost:7777/pysite displayName: 'Run Tests' - script: coverage report -m && coverage xml @@ -78,7 +72,7 @@ jobs: - task: Docker@2 displayName: 'Build & Push Container' inputs: - containerRegistry: 'DockerHubV2' + containerRegistry: 'DockerHub' repository: 'pythondiscord/site' command: 'buildAndPush' Dockerfile: 'docker/app/Dockerfile' -- cgit v1.2.3