mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
94 lines
3.4 KiB
YAML
94 lines
3.4 KiB
YAML
---
|
|
priviliged: true # Needed for Docker in Docker
|
|
kind: pipeline
|
|
name: default
|
|
steps:
|
|
# Run Mypy/Flake8/black linters before any further work is done
|
|
- name: lint
|
|
image: python:3
|
|
commands:
|
|
- pip install -U pip
|
|
- pip install mypy flake8 black
|
|
- black --check .
|
|
- flake8 activitypub.py
|
|
- mypy --ignore-missing-imports .
|
|
|
|
# Build the container images we need for the test suite
|
|
- name: build_containers
|
|
image: docker:dind
|
|
environment:
|
|
DOCKER_HOST: tcp://docker:2375
|
|
commands:
|
|
- 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
|
|
|
|
# Run poussetaches (will be shared by the two microblog.pub instances) "in the background"
|
|
- name: run_poussetaches
|
|
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
|
|
|
|
# Run MongoDB (will be shared by the two microblog.pub instances) "in the background"
|
|
- name: run_mongodb
|
|
image: docker:dind
|
|
detach: true
|
|
environment:
|
|
DOCKER_HOST: tcp://docker:2375
|
|
commands:
|
|
- docker run -p 27017:27017 --net fede --name mongo mongo
|
|
|
|
# Run a first microblog.pub instance "in the background"
|
|
- name: microblogpub_instance1
|
|
image: docker:dind
|
|
detach: true
|
|
environment:
|
|
DOCKER_HOST: tcp://docker:2375
|
|
MICROBLOGPUB_DEBUG: 1
|
|
MICROBLOGPUB_POUSSETACHES_HOST: http://poussetaches:7991
|
|
MICROBLOGPUB_INTERNAL_HOST: http://instance1_web:5005
|
|
MICROBLOGPUB_MONGODB_HOST: mongo:27017
|
|
POUSSETACHES_AUTH_KEY: lol
|
|
commands:
|
|
- sleep 5
|
|
- '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'
|
|
|
|
# Run the second microblog.pub instance "in the background"
|
|
- name: microblogpub_instance2
|
|
image: docker:dind
|
|
detach: true
|
|
environment:
|
|
DOCKER_HOST: tcp://docker:2375
|
|
MICROBLOGPUB_DEBUG: 1
|
|
MICROBLOGPUB_POUSSETACHES_HOST: http://poussetaches:7991
|
|
MICROBLOGPUB_INTERNAL_HOST: http://instance2_web:5005
|
|
MICROBLOGPUB_MONGODB_HOST: mongo:27017
|
|
POUSSETACHES_AUTH_KEY: lol
|
|
commands:
|
|
- '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'
|
|
|
|
# Run some tests against the two instances to ensure federation is working
|
|
- name: federation_test
|
|
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
|
|
|
|
# Setup the services needed to do some "Docker in Docker" (or dind)
|
|
services:
|
|
- name: docker
|
|
image: docker:dind
|
|
privileged: true
|
|
---
|
|
kind: signature
|
|
hmac: a29b3d3699c86cf0fb857e3b412353230ba64544356a9b42b37c5a83e36f5170
|
|
|
|
...
|