drone-ci testing
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Andrei Stoica 2023-05-15 23:24:51 -04:00
parent 01b8a2be62
commit 3359ce4cf6
2 changed files with 58 additions and 13 deletions

View File

@ -1,21 +1,65 @@
--- ---
kind: pipeline kind: pipeline
name: test name: test
environment:
project_name: rgraph
trigger:
event:
include:
- pull_request
steps: steps:
- name: db-up - name: db-up
image: compose:1.23.2 image: docker/compose:alpine-1.29.2
volumes: environment:
- name: docker_sock POSTGRES_USER:
path: /var/run/docker.sock from_secret: TESTING_USER
commands: POSTGRES_PASSWORD:
- up -p rgraph-test -f docker-compose.yaml from_secret: TESTING_PASSWORD
environment: POSTGRES_DB:
- POSTGRES_USER=${TESTING_USER} from_secret: TESTING_DB
- POSTGRES_PASSWORD=${TESTING_PASSWORD} volumes:
- POSTGRES_DB=${TESTING_DB} - name: docker_sock
secrets: [TESTING_USER, TESTING_PASSWORD, TESTING_DB] path: /var/run/docker.sock
commands:
- docker-compose -p rgraph-test up -d
- name: requirements
image: python:3.10-alpine
commands:
- python -m venv .venv
- . .venv/bin/activate
- pip install -r requirements.txt
- name: build
image: python:3.10-alpine
commands:
- . .venv/bin/activate
- pip install .
- name: test
image: python:3.10-alpine
environment:
POSTGRES_USER:
from_secret: TESTING_USER
POSTGRES_PASSWORD:
from_secret: TESTING_PASSWORD
POSTGRES_DB:
from_secret: TESTING_DB
commands:
- hostip=$(ip route show | awk '/default/ {print $3}')
- export POSTGRES_URL=$hostip
- . .venv/bin/activate
- pytest
- name: db-cleanup
image: docker/compose:alpine-1.29.2
volumes:
- name: docker_sock
path: /var/run/docker.sock
commands:
- docker-compose -p rgraph-test down
- docker volume rm rgraph-test_dbdata
volumes: volumes:
- name: docker_sock - name: docker_sock
host: host:
path: /var/run/docker.sock path: /var/run/docker.sock

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ htmlcov
*.pytest_cache/ *.pytest_cache/
*.egg-info/ *.egg-info/
dist/ dist/
build/