11 # use minimum supported rust version for most steps
18 - git submodule update --recursive --remote
21 image: clux/muslrust:1.67.0
23 # store cargo data in repo folder so that it gets cached between steps
26 # need make existing toolchain available
28 - rustup toolchain install nightly
29 - rustup component add rustfmt --toolchain nightly
30 - cargo +nightly fmt -- --check
34 image: clux/muslrust:1.67.0
38 # latest rust for clippy to get extra checks
39 # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
40 - rustup component add clippy
41 - cargo clippy --workspace --tests --all-targets --all-features --
42 -D warnings -D deprecated -D clippy::perf -D clippy::complexity
43 -D clippy::style -D clippy::correctness -D clippy::suspicious
44 -D clippy::dbg_macro -D clippy::inefficient_to_string
45 -D clippy::items-after-statements -D clippy::implicit_clone
46 -D clippy::wildcard_imports -D clippy::cast_lossless
47 -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
48 -D clippy::unused_self
49 -A clippy::uninlined_format_args
50 - cargo clippy --workspace --all-features -- -D clippy::unwrap_used
53 image: clux/muslrust:1.67.0
57 - cargo check --package lemmy_utils
58 - cargo check --package lemmy_db_schema
59 - cargo check --package lemmy_db_views
60 - cargo check --package lemmy_db_views_actor
61 - cargo check --package lemmy_db_views_moderator
62 - cargo check --package lemmy_api_common
63 - cargo check --package lemmy_api
64 - cargo check --package lemmy_api_crud
65 - cargo check --package lemmy_apub
66 - cargo check --package lemmy_routes
67 - cargo check --workspace --no-default-features
68 - cargo check --workspace --all-features
70 - name: lemmy_api_common doesnt depend on diesel
71 image: clux/muslrust:1.67.0
75 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
77 - name: check defaults.hjson updated
78 image: clux/muslrust:1.67.0
82 - export LEMMY_CONFIG_LOCATION=./config/config.hjson
83 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
84 - diff config/defaults.hjson config/defaults_current.hjson
87 image: clux/muslrust:1.67.0
89 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
94 - export LEMMY_CONFIG_LOCATION=../../config/config.hjson
95 - cargo test --workspace --no-fail-fast
98 image: clux/muslrust:1.67.0
103 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
105 - name: run federation tests
108 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
109 DO_WRITE_HOSTS_FILE: 1
111 - apk add bash curl postgresql-client
112 - bash api_tests/prepare-drone-federation-test.sh
117 - name: nightly build
118 image: plugins/docker
120 dockerfile: docker/prod/Dockerfile
122 from_secret: docker_username
124 from_secret: docker_password
125 repo: dessalines/lemmy
126 add_host: github.com:140.82.112.3,static.crates.io:18.154.227.73,crates.io:108.138.64.68,dl-cdn.alpinelinux.org:146.75.30.133
133 - name: publish release docker image
134 image: plugins/docker
136 dockerfile: docker/prod/Dockerfile
138 from_secret: docker_username
140 from_secret: docker_password
141 repo: dessalines/lemmy
142 add_host: github.com:140.82.112.3,static.crates.io:18.154.227.73,crates.io:108.138.64.68,dl-cdn.alpinelinux.org:146.75.30.133
144 auto_tag_suffix: linux-amd64
149 - name: publish release docker manifest
150 image: plugins/manifest
153 from_secret: docker_username
155 from_secret: docker_password
156 target: "dessalines/lemmy:${DRONE_TAG}"
157 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
166 - name: publish latest release docker manifest
167 image: plugins/manifest
170 from_secret: docker_username
172 from_secret: docker_password
173 target: "dessalines/lemmy:latest"
174 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
183 # using https://github.com/pksunkara/cargo-workspaces
184 - name: publish to crates.io
185 image: clux/muslrust:1.67.0
188 from_secret: cargo_api_token
190 - cargo install cargo-workspaces
191 - cp -r migrations crates/db_schema/
192 - cargo login "$CARGO_TOKEN"
193 - cargo workspaces publish --from-git --allow-dirty --no-verify --allow-branch "${DRONE_TAG}" --yes custom "${DRONE_TAG}"
198 - name: Notify on failure
202 - "curl -d'Drone build failed: ${DRONE_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
209 image: postgres:15-alpine
212 POSTGRES_PASSWORD: password
225 image: rust:1.57-slim
229 - apt install --no-install-recommends --yes git
232 - git submodule update --recursive --remote
234 # TODO temporarily disable arm tests
236 # image: rust:1.57-slim
238 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
239 # LEMMY_CONFIG_LOCATION: ../../config/config.hjson
241 # RUST_TEST_THREADS: 1
244 # - apt-get -y install --no-install-recommends postgresql-client libssl-dev pkg-config libpq-dev
245 # - cargo test --workspace --no-fail-fast
248 # TODO temporarily disable arm tests
249 # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
250 # - name: cargo build
251 # image: rust:1.57-slim
254 # - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
256 # - mv target/debug/lemmy_server target/lemmy_server
258 # TODO temporarily disable arm tests
259 # - name: run federation tests
260 # image: node:16-slim
262 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
263 # DO_WRITE_HOSTS_FILE: 1
265 # - mkdir -p /usr/share/man/man1 /usr/share/man/man7
267 # - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
268 # - bash api_tests/prepare-drone-federation-test.sh
273 - name: publish release docker image
274 image: plugins/docker
276 dockerfile: docker/prod/Dockerfile.arm
278 from_secret: docker_username
280 from_secret: docker_password
281 repo: dessalines/lemmy
283 auto_tag_suffix: linux-arm64
288 - name: publish release docker manifest
289 image: plugins/manifest
292 from_secret: docker_username
294 from_secret: docker_password
295 target: "dessalines/lemmy:${DRONE_TAG}"
296 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
305 - name: publish latest release docker manifest
306 image: plugins/manifest
309 from_secret: docker_username
311 from_secret: docker_password
312 target: "dessalines/lemmy:latest"
313 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
322 # TODO temporarily disable arm tests
325 # image: postgres:12-alpine
327 # POSTGRES_USER: lemmy
328 # POSTGRES_PASSWORD: password