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
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::style -D clippy::correctness -D clippy::suspicious
36 -D clippy::dbg_macro -D clippy::inefficient_to_string
37 -D clippy::items-after-statements -D clippy::implicit_clone
38 -D clippy::wildcard_imports -D clippy::cast_lossless
39 -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
40 -D clippy::unused_self
41 - cargo clippy --workspace --all-features -- -D clippy::unwrap_used
44 image: clux/muslrust:1.64.0
46 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
47 LEMMY_CONFIG_LOCATION: ../../config/config.hjson
53 - apt-get -y install --no-install-recommends postgresql-client protobuf-compiler libprotobuf-dev
54 - cargo test --workspace --no-fail-fast --all-features
56 - name: check defaults.hjson updated
57 image: clux/muslrust:1.64.0
61 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
62 - diff config/defaults.hjson config/defaults_current.hjson
64 - name: check with different features
65 image: clux/muslrust:1.64.0
69 - cargo install cargo-workspaces
70 - cargo workspaces exec cargo check --no-default-features
71 - cargo workspaces exec cargo check --all-features
73 - name: lemmy_api_common doesnt depend on diesel
74 image: rust:1.64-buster
76 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
79 image: clux/muslrust:1.64.0
84 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
86 - name: run federation tests
89 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
90 DO_WRITE_HOSTS_FILE: 1
92 - apk add bash curl postgresql-client
93 - bash api_tests/prepare-drone-federation-test.sh
101 dockerfile: docker/prod/Dockerfile
103 from_secret: docker_username
105 from_secret: docker_password
106 repo: dessalines/lemmy
113 - name: publish release docker image
114 image: plugins/docker
116 dockerfile: docker/prod/Dockerfile
118 from_secret: docker_username
120 from_secret: docker_password
121 repo: dessalines/lemmy
123 auto_tag_suffix: linux-amd64
128 - name: publish release docker manifest
129 image: plugins/manifest
132 from_secret: docker_username
134 from_secret: docker_password
135 target: "dessalines/lemmy:${DRONE_TAG}"
136 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
145 - name: publish latest release docker manifest
146 image: plugins/manifest
149 from_secret: docker_username
151 from_secret: docker_password
152 target: "dessalines/lemmy:latest"
153 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
162 # using https://github.com/pksunkara/cargo-workspaces
163 - name: publish to crates.io
164 image: rustlang/rust:nightly
167 from_secret: cargo_api_token
169 - cargo install cargo-workspaces
170 - cp -r migrations crates/db_schema/
171 - cargo login "$CARGO_TOKEN"
172 - cargo workspaces publish --from-git --allow-dirty --allow-branch "${DRONE_TAG}" --yes custom "${DRONE_TAG}"
179 image: postgres:14-alpine
182 POSTGRES_PASSWORD: password
195 image: rust:1.57-slim
198 - chown 1000:1000 . -R
200 - apt install --no-install-recommends --yes git
203 - git submodule update --recursive --remote
205 # TODO temporarily disable arm tests
207 # image: rust:1.57-slim
209 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
210 # LEMMY_CONFIG_LOCATION: ../../config/config.hjson
212 # RUST_TEST_THREADS: 1
215 # - apt-get -y install --no-install-recommends postgresql-client libssl-dev pkg-config libpq-dev
216 # - cargo test --workspace --no-fail-fast
219 # TODO temporarily disable arm tests
220 # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
221 # - name: cargo build
222 # image: rust:1.57-slim
225 # - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
227 # - mv target/debug/lemmy_server target/lemmy_server
229 # TODO temporarily disable arm tests
230 # - name: run federation tests
231 # image: node:16-slim
233 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
234 # DO_WRITE_HOSTS_FILE: 1
236 # - mkdir -p /usr/share/man/man1 /usr/share/man/man7
238 # - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
239 # - bash api_tests/prepare-drone-federation-test.sh
244 - name: publish release docker image
245 image: plugins/docker
247 dockerfile: docker/prod/Dockerfile.arm
249 from_secret: docker_username
251 from_secret: docker_password
252 repo: dessalines/lemmy
254 auto_tag_suffix: linux-arm64
259 - name: publish release docker manifest
260 image: plugins/manifest
263 from_secret: docker_username
265 from_secret: docker_password
266 target: "dessalines/lemmy:${DRONE_TAG}"
267 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
276 - name: publish latest release docker manifest
277 image: plugins/manifest
280 from_secret: docker_username
282 from_secret: docker_password
283 target: "dessalines/lemmy:latest"
284 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
293 # TODO temporarily disable arm tests
296 # image: postgres:12-alpine
298 # POSTGRES_USER: lemmy
299 # POSTGRES_PASSWORD: password