From a2cd1ff36708a48938e811255729665783fcd359 Mon Sep 17 00:00:00 2001
From: Felix Ableitner <me@nutomic.com>
Date: Thu, 10 Dec 2020 13:00:31 +0100
Subject: [PATCH] set DATABASE_URL, run diesel migration, separate steps

---
 .drone.yml | 40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)

diff --git a/.drone.yml b/.drone.yml
index 08c065c4..cb244f20 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -2,23 +2,45 @@ kind: pipeline
 name: default
 
 steps:
-  - name: cargo test
-    # needed because it doesnt work as root, and drone clones as root without an easy way to change it 
+  - name: install deps
+    # 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:
+      - apt-get -y update
+      - apt-get -y install --no-install-recommends espeak postgresql-client
+
+  - name: cargo check
+    image: ekidd/rust-musl-builder:experimental-stable
+    user: root
+    commands:
+      - cargo check --all
+
+  - name: cargo clippy
+    image: ekidd/rust-musl-builder:experimental-stable
+    user: root
+    commands:
+      - cargo clippy
+
+  - name: check documentation build
+    image: ekidd/rust-musl-builder:experimental-stable
+    user: root
+    commands:
+      - mdbook build docs/
+
+  - 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
     commands:
-      - apt-get -y update
-      - apt-get -y install --no-install-recommends espeak postgresql-client
-      - psql $LEMMY_DATABASE_URL -c "\l"
-      #- cargo check --all
-      #- cargo clippy
-      #- cargo test --workspace --no-fail-fast
-      #- mdbook build docs/
+      - diesel migration run
+      - cargo test --workspace --no-fail-fast
       
   - name: run federation tests
     image: docker/compose:alpine-1.27.4
-- 
2.44.1