microblog.pub/.drone.yml

95 lines
3.4 KiB
YAML
Raw Normal View History

2019-04-12 18:21:11 +00:00
---
2019-04-12 19:39:21 +00:00
priviliged: true # Needed for Docker in Docker
2019-04-12 07:38:33 +00:00
kind: pipeline
name: default
steps:
2019-04-12 19:39:21 +00:00
# Run Mypy/Flake8/black linters before any further work is done
- name: lint
2019-04-12 18:21:11 +00:00
image: python:3
2019-04-12 07:31:39 +00:00
commands:
2019-04-12 18:21:11 +00:00
- pip install -U pip
- pip install mypy flake8 black
2019-04-13 08:00:56 +00:00
- black --check .
2019-04-12 18:21:11 +00:00
- flake8 activitypub.py
- mypy --ignore-missing-imports .
2019-04-11 20:35:52 +00:00
2019-04-12 19:39:21 +00:00
# Build the container images we need for the test suite
- name: build_containers
2019-04-12 07:31:39 +00:00
image: docker:dind
environment:
2019-04-12 07:40:43 +00:00
DOCKER_HOST: tcp://docker:2375
2019-04-12 07:31:39 +00:00
commands:
2019-04-12 18:21:11 +00:00
- apk update && apk upgrade && apk add --no-cache bash git openssh curl
- git clone https://github.com/tsileo/poussetaches.git pt && cd pt && docker build . -t poussetaches:latest && cd - && rm -rf pt
- docker network create fede
- docker pull mongo
- docker build . -t microblogpub:latest
2019-04-12 19:39:21 +00:00
# Run poussetaches (will be shared by the two microblog.pub instances) "in the background"
- name: run_poussetaches
2019-04-12 18:21:11 +00:00
image: docker:dind
detach: true
environment:
DOCKER_HOST: tcp://docker:2375
POUSSETACHES_AUTH_KEY: lol
commands:
- docker run -p 7991:7991 --net fede -e POUSSETACHES_AUTH_KEY --name poussetaches poussetaches
2019-04-12 07:48:32 +00:00
2019-04-12 19:39:21 +00:00
# Run MongoDB (will be shared by the two microblog.pub instances) "in the background"
- name: run_mongodb
2019-04-12 18:21:11 +00:00
image: docker:dind
detach: true
2019-04-12 07:48:32 +00:00
environment:
DOCKER_HOST: tcp://docker:2375
commands:
2019-04-12 18:21:11 +00:00
- docker run -p 27017:27017 --net fede --name mongo mongo
2019-04-12 07:48:32 +00:00
2019-04-12 19:39:21 +00:00
# Run a first microblog.pub instance "in the background"
2019-04-12 18:21:11 +00:00
- name: microblogpub_instance1
2019-04-12 07:31:39 +00:00
image: docker:dind
detach: true
environment:
2019-04-12 07:40:43 +00:00
DOCKER_HOST: tcp://docker:2375
2019-04-12 18:21:11 +00:00
MICROBLOGPUB_DEBUG: 1
2019-04-12 19:10:10 +00:00
MICROBLOGPUB_POUSSETACHES_HOST: http://poussetaches:7991
MICROBLOGPUB_INTERNAL_HOST: http://instance1_web:5005
2019-04-12 18:21:11 +00:00
MICROBLOGPUB_MONGODB_HOST: mongo:27017
POUSSETACHES_AUTH_KEY: lol
2019-04-12 07:31:39 +00:00
commands:
2019-04-12 18:21:11 +00:00
- sleep 5
2019-04-12 19:20:14 +00: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 20:07:44 +00:00
2019-04-12 19:39:21 +00:00
# Run the second microblog.pub instance "in the background"
2019-04-12 18:21:11 +00:00
- name: microblogpub_instance2
image: docker:dind
detach: true
environment:
DOCKER_HOST: tcp://docker:2375
MICROBLOGPUB_DEBUG: 1
2019-04-12 19:10:10 +00:00
MICROBLOGPUB_POUSSETACHES_HOST: http://poussetaches:7991
MICROBLOGPUB_INTERNAL_HOST: http://instance2_web:5005
2019-04-12 18:21:11 +00:00
MICROBLOGPUB_MONGODB_HOST: mongo:27017
POUSSETACHES_AUTH_KEY: lol
2019-04-12 07:31:39 +00:00
commands:
2019-04-12 19:20:14 +00: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 18:21:11 +00:00
2019-04-12 19:39:21 +00:00
# Run some tests against the two instances to ensure federation is working
- name: federation_test
2019-04-12 18:21:11 +00: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 07:31:39 +00:00
2019-04-12 19:39:21 +00:00
# Setup the services needed to do some "Docker in Docker" (or dind)
2019-04-12 07:31:39 +00:00
services:
2019-04-12 07:35:56 +00:00
- name: docker
image: docker:dind
privileged: true
2019-04-12 18:21:11 +00:00
---
kind: signature
2019-04-14 18:20:37 +00:00
hmac: c9251926949e9844602715ea2c9a748817cde58d58812986e5d7286ac1b5561e
2019-04-12 18:21:11 +00:00
...