]> Untitled Git - lemmy.git/blob - .drone.yml
Merge pull request #1536 from LemmyNet/change_preferred_to_display_name
[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       LEMMY_CONFIG_LOCATION: ../../config/config.hjson
33       RUST_BACKTRACE: 1
34       RUST_TEST_THREADS: 1
35     commands:
36       - sudo apt-get update
37       - sudo apt-get -y install --no-install-recommends espeak postgresql-client
38       - cargo test --workspace --no-fail-fast
39
40   - name: cargo build
41     image: ekidd/rust-musl-builder:1.50.0
42     commands:
43       - cargo build
44       - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
45
46   - name: run federation tests
47     image: node:15-alpine3.12
48     environment:
49       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
50       DO_WRITE_HOSTS_FILE: 1
51     commands:
52       - apk add bash curl postgresql-client
53       - bash api_tests/prepare-drone-federation-test.sh
54       - cd api_tests/
55       - yarn
56       - yarn api-test
57
58   - name: make release build and push to docker hub
59     image: plugins/docker
60     settings:
61       dockerfile: docker/prod/Dockerfile
62       username:
63         from_secret: docker_username
64       password:
65         from_secret: docker_password
66       repo: dessalines/lemmy
67       auto_tag: true
68       auto_tag_suffix: linux-amd64
69     when:
70       ref:
71       - refs/tags/*
72
73   - name: push to docker manifest
74     image: plugins/manifest
75     settings: 
76       username:
77         from_secret: docker_username
78       password:
79         from_secret: docker_password
80       target: "dessalines/lemmy:${DRONE_TAG}"
81       template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
82       platforms:
83         - linux/amd64
84         - linux/arm64
85       ignore_missing: 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.50-slim-buster
109     environment:
110       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
111       LEMMY_CONFIG_LOCATION: ../../config/config.hjson
112       RUST_BACKTRACE: 1
113       RUST_TEST_THREADS: 1
114     commands:
115       - apt-get update
116       - apt-get -y install --no-install-recommends espeak postgresql-client libssl-dev pkg-config libpq-dev
117       - cargo test --workspace --no-fail-fast
118       - cargo build
119
120   # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
121   - name: cargo build
122     image: rust:1.50-slim-buster
123     commands:
124       - apt-get update
125       - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
126       - cargo build
127       - mv target/debug/lemmy_server target/lemmy_server
128
129   - name: run federation tests
130     image: node:15-buster-slim
131     environment:
132       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
133       DO_WRITE_HOSTS_FILE: 1
134     commands:
135       - mkdir -p /usr/share/man/man1 /usr/share/man/man7
136       - apt-get update
137       - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
138       - bash api_tests/prepare-drone-federation-test.sh
139       - cd api_tests/
140       - yarn
141       - yarn api-test
142
143   - name: make release build and push to docker hub
144     image: plugins/docker
145     settings:
146       dockerfile: docker/prod/Dockerfile.arm
147       username:
148         from_secret: docker_username
149       password:
150         from_secret: docker_password
151       repo: dessalines/lemmy
152       auto_tag: true
153       auto_tag_suffix: linux-arm64
154     when:
155       ref:
156         - refs/tags/*
157
158   - name: push to docker manifest
159     image: plugins/manifest
160     settings: 
161       username:
162         from_secret: docker_username
163       password:
164         from_secret: docker_password
165       target: "dessalines/lemmy:${DRONE_TAG}"
166       template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
167       platforms:
168         - linux/amd64
169         - linux/arm64
170       ignore_missing: true
171     when:
172       ref:
173       - refs/tags/*
174
175 services:
176   - name: database
177     image: postgres:12-alpine
178     environment:
179       POSTGRES_USER: lemmy
180       POSTGRES_PASSWORD: password