microblog.pub/.drone.yml

96 lines
3.4 KiB
YAML
Raw Permalink Normal View History

2019-04-12 13:21:11 -05:00
---
2019-04-12 14:39:21 -05:00
priviliged: true # Needed for Docker in Docker
2019-04-12 02:38:33 -05:00
kind: pipeline
name: default
steps:
2019-04-12 14:39:21 -05:00
# Run Mypy/Flake8/black linters before any further work is done
- name: lint
2019-04-12 13:21:11 -05:00
image: python:3
2019-04-12 02:31:39 -05:00
commands:
2019-04-12 13:21:11 -05:00
- pip install -U pip
- pip install mypy flake8 black
2019-04-13 03:00:56 -05:00
- black --check .
2019-04-22 15:41:58 -05:00
- flake8
# - mypy --ignore-missing-imports .
2019-04-22 15:41:58 -05:00
- mypy --ignore-missing-imports setup_wizard
2019-04-11 15:35:52 -05:00
2019-04-12 14:39:21 -05:00
# Build the container images we need for the test suite
- name: build_containers
2019-04-12 02:31:39 -05:00
image: docker:dind
environment:
2019-04-12 02:40:43 -05:00
DOCKER_HOST: tcp://docker:2375
2019-04-12 02:31:39 -05:00
commands:
2019-04-12 13:21:11 -05:00
- apk update && apk upgrade && apk add --no-cache bash git openssh curl
- docker network create fede
- docker pull mongo
2019-08-01 14:00:58 -05:00
- docker pull poussetaches/poussetaches
2019-04-12 13:21:11 -05:00
- docker build . -t microblogpub:latest
2019-04-12 14:39:21 -05:00
# Run poussetaches (will be shared by the two microblog.pub instances) "in the background"
- name: run_poussetaches
2019-04-12 13:21:11 -05:00
image: docker:dind
detach: true
environment:
DOCKER_HOST: tcp://docker:2375
POUSSETACHES_AUTH_KEY: lol
commands:
2019-08-01 14:00:58 -05:00
- docker run -p 7991:7991 --net fede -e POUSSETACHES_AUTH_KEY --name poussetaches poussetaches/poussetaches
2019-04-12 02:48:32 -05:00
2019-04-12 14:39:21 -05:00
# Run MongoDB (will be shared by the two microblog.pub instances) "in the background"
- name: run_mongodb
2019-04-12 13:21:11 -05:00
image: docker:dind
detach: true
2019-04-12 02:48:32 -05:00
environment:
DOCKER_HOST: tcp://docker:2375
commands:
2019-04-12 13:21:11 -05:00
- docker run -p 27017:27017 --net fede --name mongo mongo
2019-04-12 02:48:32 -05:00
2019-04-12 14:39:21 -05:00
# Run a first microblog.pub instance "in the background"
2019-04-12 13:21:11 -05:00
- name: microblogpub_instance1
2019-04-12 02:31:39 -05:00
image: docker:dind
detach: true
environment:
2019-04-12 02:40:43 -05:00
DOCKER_HOST: tcp://docker:2375
2019-04-12 13:21:11 -05:00
MICROBLOGPUB_DEBUG: 1
2019-04-12 14:10:10 -05:00
MICROBLOGPUB_POUSSETACHES_HOST: http://poussetaches:7991
MICROBLOGPUB_INTERNAL_HOST: http://instance1_web:5005
2019-04-12 13:21:11 -05:00
MICROBLOGPUB_MONGODB_HOST: mongo:27017
POUSSETACHES_AUTH_KEY: lol
2019-04-12 02:31:39 -05:00
commands:
2019-04-12 13:21:11 -05:00
- sleep 5
2019-04-12 14:20:14 -05:00
- 'docker run -p 5006:5005 --net fede -v "`pwd`/tests/fixtures/instance1/config:/app/config" -e MICROBLOGPUB_DEBUG -e MICROBLOGPUB_INTERNAL_HOST -e MICROBLOGPUB_MONGODB_HOST -e MICROBLOGPUB_POUSSETACHES_HOST -e POUSSETACHES_AUTH_KEY --name instance1_web microblogpub'
2019-04-11 15:07:44 -05:00
2019-04-12 14:39:21 -05:00
# Run the second microblog.pub instance "in the background"
2019-04-12 13:21:11 -05:00
- name: microblogpub_instance2
image: docker:dind
detach: true
environment:
DOCKER_HOST: tcp://docker:2375
MICROBLOGPUB_DEBUG: 1
2019-04-12 14:10:10 -05:00
MICROBLOGPUB_POUSSETACHES_HOST: http://poussetaches:7991
MICROBLOGPUB_INTERNAL_HOST: http://instance2_web:5005
2019-04-12 13:21:11 -05:00
MICROBLOGPUB_MONGODB_HOST: mongo:27017
POUSSETACHES_AUTH_KEY: lol
2019-04-12 02:31:39 -05:00
commands:
2019-04-12 14:20:14 -05:00
- 'docker run -p 5007:5005 --net fede -v "`pwd`/tests/fixtures/instance2/config:/app/config" -e MICROBLOGPUB_DEBUG -e MICROBLOGPUB_INTERNAL_HOST -e MICROBLOGPUB_MONGODB_HOST -e MICROBLOGPUB_POUSSETACHES_HOST -e POUSSETACHES_AUTH_KEY --name instance2_web microblogpub'
2019-04-12 13:21:11 -05:00
2019-04-12 14:39:21 -05:00
# Run some tests against the two instances to ensure federation is working
- name: federation_test
2019-04-12 13:21:11 -05:00
image: python:3
commands:
- pip install -U pip
- pip install -r dev-requirements.txt
# Federation tests (with two local instances)
- python -m pytest -v -s --ignore data -k federatio
2019-04-12 02:31:39 -05:00
2019-04-12 14:39:21 -05:00
# Setup the services needed to do some "Docker in Docker" (or dind)
2019-04-12 02:31:39 -05:00
services:
2019-04-12 02:35:56 -05:00
- name: docker
image: docker:dind
privileged: true
2019-04-12 13:21:11 -05:00
---
kind: signature
hmac: 9fc3e2eb3b237ab868843f94221124cdc397c454de798b9bcc43c8896615826a
2019-04-12 13:21:11 -05:00
...