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