]> Untitled Git - lemmy.git/blob - .drone.yml
Merge branch 'move_views_to_diesel' into remove_travis_and_federation_docker
[lemmy.git] / .drone.yml
1 ---
2 kind: pipeline
3 name: amd64
4
5 platform:
6   os: linux
7   arch: amd64
8
9 steps:
10   - name: fetch git submodules
11     image: node:15-alpine3.12
12     commands:
13       - apk add git
14       - git submodule update --init --recursive --remote
15       - find docs/
16
17   - name: chown repo
18     image: ekidd/rust-musl-builder:1.47.0
19     user: root
20     commands:
21       - chown 1000:1000 . -R
22
23   - name: check documentation build
24     image: ekidd/rust-musl-builder:1.47.0
25     commands:
26       - cargo install mdbook --git https://github.com/Ruin0x11/mdBook.git --branch localization --rev d06249b
27       - mdbook build docs/
28
29   - name: check formatting
30     image: rustdocker/rust:nightly
31     commands:
32       - /root/.cargo/bin/cargo fmt -- --check
33
34   - name: cargo clippy
35     image: ekidd/rust-musl-builder:1.47.0
36     commands:
37       - cargo clippy --workspace --tests --all-targets --all-features -- -D warnings -D deprecated -D clippy::perf -D clippy::complexity -D clippy::dbg_macro
38
39   - name: cargo test
40     image: ekidd/rust-musl-builder:1.47.0
41     environment:
42       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
43       RUST_BACKTRACE: 1
44       RUST_TEST_THREADS: 1
45     commands:
46       - sudo apt-get update
47       - sudo apt-get -y install --no-install-recommends espeak postgresql-client
48       - cargo test --workspace --no-fail-fast
49
50   - name: cargo build
51     image: ekidd/rust-musl-builder:1.47.0
52     commands:
53       - cargo build
54       - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
55
56   - name: run federation tests
57     image: node:15-alpine3.12
58     environment:
59       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
60       DO_WRITE_HOSTS_FILE: 1
61     commands:
62       - apk add bash curl postgresql-client
63       - bash api_tests/prepare-drone-federation-test.sh
64       - cd api_tests/
65       - yarn
66       - yarn api-test
67
68   - name: make release build and push to docker hub
69     image: plugins/docker
70     settings:
71       dockerfile: docker/prod/Dockerfile
72       username:
73         from_secret: docker_username
74       password:
75         from_secret: docker_password
76       repo: dessalines/lemmy
77       auto_tag: true
78     when:
79       ref:
80       - refs/tags/*
81
82 services:
83   - name: database
84     image: postgres:12-alpine
85     environment:
86       POSTGRES_USER: lemmy
87       POSTGRES_PASSWORD: password
88
89 ---
90 kind: pipeline
91 name: arm64
92
93 platform:
94   os: linux
95   arch: arm64
96
97 steps:
98
99   - name: cargo test
100     image: rust:1.47-slim-buster
101     environment:
102       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
103       RUST_BACKTRACE: 1
104       RUST_TEST_THREADS: 1
105     commands:
106       - apt-get update
107       - apt-get -y install --no-install-recommends espeak postgresql-client libssl-dev pkg-config libpq-dev
108       - cargo test --workspace --no-fail-fast
109       - cargo build
110
111   # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
112   - name: cargo build
113     image: rust:1.47-slim-buster
114     commands:
115       - apt-get update
116       - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
117       - cargo build
118       - mv target/debug/lemmy_server target/lemmy_server
119
120   - name: run federation tests
121     image: node:15-buster-slim
122     environment:
123       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
124       DO_WRITE_HOSTS_FILE: 1
125     commands:
126       - mkdir -p /usr/share/man/man1 /usr/share/man/man7
127       - apt-get update
128       - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
129       - bash api_tests/prepare-drone-federation-test.sh
130       - cd api_tests/
131       - yarn
132       - yarn api-test
133
134   - name: make release build and push to docker hub
135     image: plugins/docker
136     settings:
137       dockerfile: docker/prod/Dockerfile.arm
138       username:
139         from_secret: docker_username
140       password:
141         from_secret: docker_password
142       repo: dessalines/lemmy
143       auto_tag: true
144       auto_tag_suffix: arm64
145     when:
146       ref:
147         - refs/tags/*
148
149 services:
150   - name: database
151     image: postgres:12-alpine
152     environment:
153       POSTGRES_USER: lemmy
154       POSTGRES_PASSWORD: password