lemmy/.drone.yml

128 lines
3.7 KiB
YAML

kind: pipeline
name: default
steps:
- name: cargo check
# we need to use this experimental image because the normal rust-musl-builder doesnt
# allow building as root (and drone doesnt have an easy way to git clone as non-root)
# https://github.com/emk/rust-musl-builder/issues/96
image: ekidd/rust-musl-builder:experimental-stable
user: root
commands:
- cargo check --all
# just to disable this temporarily
when:
ref:
- refs/tags/*
- name: cargo clippy
image: ekidd/rust-musl-builder:experimental-stable
user: root
commands:
- cargo clippy
# just to disable this temporarily
when:
ref:
- refs/tags/*
- name: check documentation build
image: ekidd/rust-musl-builder:experimental-stable
user: root
commands:
- mdbook build docs/
- name: install diesel cli
image: ekidd/rust-musl-builder:experimental-stable
user: root
volumes:
- name: dieselcli
path: /dieselcli
commands:
- cargo install diesel_cli --no-default-features --features postgres
- mv /root/.cargo/bin/diesel /dieselcli/diesel
- name: cargo test
image: ekidd/rust-musl-builder:experimental-stable
user: root
environment:
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
RUST_BACKTRACE: 1
RUST_TEST_THREADS: 1
volumes:
- name: dieselcli
path: /dieselcli
commands:
- apt-get -y update
- apt-get -y install --no-install-recommends espeak postgresql-client
- /dieselcli/diesel migration run
- cargo test --workspace --no-fail-fast
# just to disable this temporarily
when:
ref:
- refs/tags/*
- name: run federation tests
image: ekidd/rust-musl-builder:experimental-stable
user: root
environment:
LEMMY_JWT_SECRET: changeme
LEMMY_FEDERATION__ENABLED: true
LEMMY_TLS_ENABLED: false
LEMMY_SETUP__ADMIN_PASSWORD: lemmy
LEMMY_RATE_LIMIT__POST: 99999
LEMMY_RATE_LIMIT__REGISTER: 99999
LEMMY_CAPTCHA__ENABLED: false
RUST_BACKTRACE: 1
RUST_LOG: debug
LEMMY_HOSTNAME: lemmy-alpha:8541
LEMMY_DATABASE_URL: postgres://lemmy:password@postgres_alpha:5432/lemmy
LEMMY_FEDERATION__ALLOWED_INSTANCES: lemmy-beta,lemmy-gamma,lemmy-delta,lemmy-epsilon
LEMMY_SETUP__ADMIN_USERNAME: lemmy_alpha
LEMMY_SETUP__SITE_NAME: lemmy-alpha
commands:
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- sudo apt-get update
- apt-get -y install --no-install-recommends yarn
- mkdir -p volumes/pictrs_{alpha,beta,gamma,delta,epsilon}
- chown -R 991:991 volumes/pictrs_{alpha,beta,gamma,delta,epsilon}
- LEMMY_PORT=8541 cargo run &
- LEMMY_PORT=8551 cargo run &
- cd api_tests/
- yarn
- yarn api-test
- name: create docker tags
image: plugins/docker
user: root
commands:
# TODO: remove newline, add `latest` (eg `0.9.1,latest`)
- git describe > .tags
when:
ref:
- refs/tags/*
- name: make release build and push to docker hub
image: plugins/docker
settings:
dockerfile: docker/prod/Dockerfile
#username: kevinbacon
#password: pa55word
repo: dessalines/lemmy
when:
ref:
- refs/tags/*
services:
- name: database
image: postgres:12-alpine
environment:
POSTGRES_USER: lemmy
POSTGRES_PASSWORD: password
detach: true
volumes:
- name: dieselcli
temp: {}