diff options
author | 2019-09-21 14:31:25 +1000 | |
---|---|---|
committer | 2019-09-21 15:23:37 +1000 | |
commit | fa67b3ecd60ece794daa0d1a241e6cf2c7227e3d (patch) | |
tree | c3a80f71c6ebac2f153cce4853b6c56c3e113a86 | |
parent | Run tests with coverage in pipenv script (diff) |
Change CI DB setup to use docker.
-rw-r--r-- | azure-pipelines.yml | 28 | ||||
-rw-r--r-- | docker-compose.yml | 4 |
2 files changed, 13 insertions, 19 deletions
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 @@ -26,21 +35,6 @@ jobs: 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 coverage run \ @@ -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' diff --git a/docker-compose.yml b/docker-compose.yml index 0a8e6bcd..4ea110c4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: - "127.0.0.1:7777:5432" environment: POSTGRES_DB: pysite - POSTGRES_PASSWORD: supersecretpassword + POSTGRES_PASSWORD: pysite POSTGRES_USER: pysite web: @@ -32,7 +32,7 @@ services: - .:/app:ro - staticfiles:/var/www/static environment: - DATABASE_URL: postgres://pysite:supersecretpassword@postgres:5432/pysite + DATABASE_URL: postgres://pysite:pysite@postgres:5432/pysite DEBUG: "true" SECRET_KEY: suitable-for-development-only STATIC_ROOT: /var/www/static |