]> Untitled Git - lemmy.git/blob - .drone.yml
Merge pull request #1352 from LemmyNet/ci-on-arm
[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: create docker tags
69     image: node:15-alpine3.12
70     commands:
71       - echo "$(git describe),latest" > .tags
72     when:
73       ref:
74       - refs/tags/*
75
76   - name: make release build and push to docker hub
77     image: plugins/docker
78     settings:
79       dockerfile: docker/prod/Dockerfile
80       username:
81         from_secret: docker_username
82       password:
83         from_secret: docker_password
84       repo: dessalines/lemmy
85       auto_tag: true
86     when:
87       ref:
88       - refs/tags/*
89
90 services:
91   - name: database
92     image: postgres:12-alpine
93     environment:
94       POSTGRES_USER: lemmy
95       POSTGRES_PASSWORD: password
96
97 ---
98 kind: pipeline
99 name: arm64
100
101 platform:
102   os: linux
103   arch: arm64
104
105 steps:
106
107   - name: cargo test
108     image: rust:1.47-slim-buster
109     environment:
110       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
111       RUST_BACKTRACE: 1
112       RUST_TEST_THREADS: 1
113     commands:
114       - apt-get update
115       - apt-get -y install --no-install-recommends espeak postgresql-client libssl-dev pkg-config libpq-dev
116       - cargo test --workspace --no-fail-fast
117       - cargo build
118
119   # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
120   - name: cargo build
121     image: rust:1.47-slim-buster
122     commands:
123       - apt-get update
124       - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
125       - cargo build
126       - mv target/debug/lemmy_server target/lemmy_server
127
128   - name: run federation tests
129     image: node:15-buster-slim
130     environment:
131       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
132       DO_WRITE_HOSTS_FILE: 1
133     commands:
134       - mkdir -p /usr/share/man/man1 /usr/share/man/man7
135       - apt-get update
136       - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
137       - bash api_tests/prepare-drone-federation-test.sh
138       - cd api_tests/
139       - yarn
140       - yarn api-test
141
142   - name: create docker tags
143     image: node:15-buster-slim
144     commands:
145       - echo "$(git describe),latest" > .tags
146     when:
147       ref:
148         - refs/tags/*
149
150   - name: make release build and push to docker hub
151     image: plugins/docker
152     settings:
153       dockerfile: docker/prod/Dockerfile.arm
154       username:
155         from_secret: docker_username
156       password:
157         from_secret: docker_password
158       repo: dessalines/lemmy
159     when:
160       ref:
161         - refs/tags/*
162
163 services:
164   - name: database
165     image: postgres:12-alpine
166     environment:
167       POSTGRES_USER: lemmy
168       POSTGRES_PASSWORD: password