11 # use minimum supported rust version for most steps
13 image: clux/muslrust:1.64.0
17 - git submodule update --recursive --remote
18 - chown 1000:1000 . -R
20 - name: check formatting
21 image: rustdocker/rust:nightly
23 - /root/.cargo/bin/cargo fmt -- --check
25 # latest rust for clippy to get extra checks
26 # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
28 image: rust:1.65-buster
33 - apt-get install -y --no-install-recommends protobuf-compiler libprotobuf-dev
34 - rustup component add clippy
35 - cargo clippy --workspace --tests --all-targets --all-features --
36 -D warnings -D deprecated -D clippy::perf -D clippy::complexity
37 -D clippy::style -D clippy::correctness -D clippy::suspicious
38 -D clippy::dbg_macro -D clippy::inefficient_to_string
39 -D clippy::items-after-statements -D clippy::implicit_clone
40 -D clippy::wildcard_imports -D clippy::cast_lossless
41 -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
42 -D clippy::unused_self
43 - cargo clippy --workspace --all-features -- -D clippy::unwrap_used
46 image: clux/muslrust:1.64.0
48 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
49 LEMMY_CONFIG_LOCATION: ../../config/config.hjson
55 - apt-get -y install --no-install-recommends postgresql-client protobuf-compiler libprotobuf-dev
56 - cargo test --workspace --no-fail-fast --all-features
58 - name: check defaults.hjson updated
59 image: clux/muslrust:1.64.0
63 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
64 - diff config/defaults.hjson config/defaults_current.hjson
66 - name: check with different features
67 image: clux/muslrust:1.64.0
71 - cargo install cargo-workspaces
72 - cargo workspaces exec cargo check --no-default-features
73 - cargo workspaces exec cargo check --all-features
75 - name: lemmy_api_common doesnt depend on diesel
76 image: rust:1.64-buster
78 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
81 image: clux/muslrust:1.64.0
86 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
88 - name: run federation tests
91 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
92 DO_WRITE_HOSTS_FILE: 1
94 - apk add bash curl postgresql-client
95 - bash api_tests/prepare-drone-federation-test.sh
100 - name: nightly build
101 image: plugins/docker
103 dockerfile: docker/prod/Dockerfile
105 from_secret: docker_username
107 from_secret: docker_password
108 repo: dessalines/lemmy
115 - name: publish release docker image
116 image: plugins/docker
118 dockerfile: docker/prod/Dockerfile
120 from_secret: docker_username
122 from_secret: docker_password
123 repo: dessalines/lemmy
125 auto_tag_suffix: linux-amd64
130 - name: publish release docker manifest
131 image: plugins/manifest
134 from_secret: docker_username
136 from_secret: docker_password
137 target: "dessalines/lemmy:${DRONE_TAG}"
138 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
147 - name: publish latest release docker manifest
148 image: plugins/manifest
151 from_secret: docker_username
153 from_secret: docker_password
154 target: "dessalines/lemmy:latest"
155 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
164 # using https://github.com/pksunkara/cargo-workspaces
165 - name: publish to crates.io
166 image: rustlang/rust:nightly
169 from_secret: cargo_api_token
171 - cargo install cargo-workspaces
172 - cp -r migrations crates/db_schema/
173 - cargo login "$CARGO_TOKEN"
174 - cargo workspaces publish --from-git --allow-dirty --allow-branch "${DRONE_TAG}" --yes custom "${DRONE_TAG}"
181 image: postgres:14-alpine
184 POSTGRES_PASSWORD: password
197 image: rust:1.57-slim
200 - chown 1000:1000 . -R
202 - apt install --no-install-recommends --yes git
205 - git submodule update --recursive --remote
207 # TODO temporarily disable arm tests
209 # image: rust:1.57-slim
211 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
212 # LEMMY_CONFIG_LOCATION: ../../config/config.hjson
214 # RUST_TEST_THREADS: 1
217 # - apt-get -y install --no-install-recommends postgresql-client libssl-dev pkg-config libpq-dev
218 # - cargo test --workspace --no-fail-fast
221 # TODO temporarily disable arm tests
222 # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
223 # - name: cargo build
224 # image: rust:1.57-slim
227 # - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
229 # - mv target/debug/lemmy_server target/lemmy_server
231 # TODO temporarily disable arm tests
232 # - name: run federation tests
233 # image: node:16-slim
235 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
236 # DO_WRITE_HOSTS_FILE: 1
238 # - mkdir -p /usr/share/man/man1 /usr/share/man/man7
240 # - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
241 # - bash api_tests/prepare-drone-federation-test.sh
246 - name: publish release docker image
247 image: plugins/docker
249 dockerfile: docker/prod/Dockerfile.arm
251 from_secret: docker_username
253 from_secret: docker_password
254 repo: dessalines/lemmy
256 auto_tag_suffix: linux-arm64
261 - name: publish release docker manifest
262 image: plugins/manifest
265 from_secret: docker_username
267 from_secret: docker_password
268 target: "dessalines/lemmy:${DRONE_TAG}"
269 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
278 - name: publish latest release docker manifest
279 image: plugins/manifest
282 from_secret: docker_username
284 from_secret: docker_password
285 target: "dessalines/lemmy:latest"
286 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
295 # TODO temporarily disable arm tests
298 # image: postgres:12-alpine
300 # POSTGRES_USER: lemmy
301 # POSTGRES_PASSWORD: password