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
31 - apt-get -y install protobuf-compiler libprotobuf-dev
32 - rustup component add clippy
33 - cargo clippy --workspace --tests --all-targets --all-features --
34 -D warnings -D deprecated -D clippy::perf -D clippy::complexity
35 -D clippy::dbg_macro -D clippy::inefficient_to_string
36 -D clippy::items-after-statements -D clippy::implicit_clone
37 -D clippy::wildcard_imports -D clippy::cast_lossless
38 -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
39 - cargo clippy --workspace --all-features -- -D clippy::unwrap_used
42 image: clux/muslrust:1.64.0
44 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
45 LEMMY_CONFIG_LOCATION: ../../config/config.hjson
50 - apt-get -y install --no-install-recommends postgresql-client protobuf-compiler libprotobuf-dev
51 - cargo test --workspace --no-fail-fast --all-features
53 - name: check defaults.hjson updated
54 image: clux/muslrust:1.64.0
56 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
57 - diff config/defaults.hjson config/defaults_current.hjson
59 - name: check with different features
60 image: clux/muslrust:1.64.0
62 - cargo install cargo-workspaces
63 - cargo workspaces exec cargo check --no-default-features
64 - cargo workspaces exec cargo check --all-features
66 - name: lemmy_api_common doesnt depend on diesel
67 image: rust:1.64-buster
69 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
72 image: clux/muslrust:1.64.0
75 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
77 - name: run federation tests
80 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
81 DO_WRITE_HOSTS_FILE: 1
83 - apk add bash curl postgresql-client
84 - bash api_tests/prepare-drone-federation-test.sh
92 dockerfile: docker/dev/Dockerfile
94 from_secret: docker_username
96 from_secret: docker_password
97 repo: dessalines/lemmy
104 - name: publish release docker image
105 image: plugins/docker
107 dockerfile: docker/prod/Dockerfile
109 from_secret: docker_username
111 from_secret: docker_password
112 repo: dessalines/lemmy
114 auto_tag_suffix: linux-amd64
119 - name: publish release docker manifest
120 image: plugins/manifest
123 from_secret: docker_username
125 from_secret: docker_password
126 target: "dessalines/lemmy:${DRONE_TAG}"
127 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
136 - name: publish latest release docker manifest
137 image: plugins/manifest
140 from_secret: docker_username
142 from_secret: docker_password
143 target: "dessalines/lemmy:latest"
144 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
153 # using https://github.com/pksunkara/cargo-workspaces
154 - name: publish to crates.io
155 image: rustlang/rust:nightly
158 from_secret: cargo_api_token
160 - cargo install cargo-workspaces
161 - cp -r migrations crates/db_schema/
162 - cargo login "$CARGO_TOKEN"
163 - cargo workspaces publish --from-git --allow-dirty --allow-branch "${DRONE_TAG}" --yes custom "${DRONE_TAG}"
170 image: postgres:14-alpine
173 POSTGRES_PASSWORD: password
186 image: rust:1.57-slim
189 - chown 1000:1000 . -R
191 - apt install --no-install-recommends --yes git
194 - git submodule update --recursive --remote
196 # TODO temporarily disable arm tests
198 # image: rust:1.57-slim
200 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
201 # LEMMY_CONFIG_LOCATION: ../../config/config.hjson
203 # RUST_TEST_THREADS: 1
206 # - apt-get -y install --no-install-recommends postgresql-client libssl-dev pkg-config libpq-dev
207 # - cargo test --workspace --no-fail-fast
210 # TODO temporarily disable arm tests
211 # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
212 # - name: cargo build
213 # image: rust:1.57-slim
216 # - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
218 # - mv target/debug/lemmy_server target/lemmy_server
220 # TODO temporarily disable arm tests
221 # - name: run federation tests
222 # image: node:16-slim
224 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
225 # DO_WRITE_HOSTS_FILE: 1
227 # - mkdir -p /usr/share/man/man1 /usr/share/man/man7
229 # - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
230 # - bash api_tests/prepare-drone-federation-test.sh
235 - name: publish release docker image
236 image: plugins/docker
238 dockerfile: docker/prod/Dockerfile.arm
240 from_secret: docker_username
242 from_secret: docker_password
243 repo: dessalines/lemmy
245 auto_tag_suffix: linux-arm64
250 - name: publish release docker manifest
251 image: plugins/manifest
254 from_secret: docker_username
256 from_secret: docker_password
257 target: "dessalines/lemmy:${DRONE_TAG}"
258 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
267 - name: publish latest release docker manifest
268 image: plugins/manifest
271 from_secret: docker_username
273 from_secret: docker_password
274 target: "dessalines/lemmy:latest"
275 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
284 # TODO temporarily disable arm tests
287 # image: postgres:12-alpine
289 # POSTGRES_USER: lemmy
290 # POSTGRES_PASSWORD: password