11 # use minimum supported rust version for most steps
13 image: clux/muslrust:1.59.0
18 - git submodule update --recursive --remote
19 - chown 1000:1000 . -R
21 - name: check formatting
22 image: rustdocker/rust:nightly
24 - /root/.cargo/bin/cargo fmt -- --check
26 # latest rust for clippy to get extra checks
28 image: rust:1.64-buster
31 - apt-get -y install protobuf-compiler libprotobuf-dev
32 - rustup component add clippy
33 - cargo clippy --workspace --tests --all-targets --all-features -- -D warnings -D deprecated -D clippy::perf -D clippy::complexity -D clippy::dbg_macro
34 - cargo clippy --workspace --all-features -- -D clippy::unwrap_used
37 image: clux/muslrust:1.59.0
39 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
40 LEMMY_CONFIG_LOCATION: ../../config/config.hjson
45 - apt-get -y install --no-install-recommends postgresql-client protobuf-compiler libprotobuf-dev
46 - cargo test --workspace --no-fail-fast --all-features
48 - name: check defaults.hjson updated
49 image: clux/muslrust:1.59.0
51 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
52 - diff config/defaults.hjson config/defaults_current.hjson
54 - name: check with different features
55 image: clux/muslrust:1.59.0
57 - cargo install cargo-workspaces
58 - cargo workspaces exec cargo check --no-default-features
59 - cargo workspaces exec cargo check --all-features
62 image: clux/muslrust:1.59.0
65 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
67 - name: run federation tests
70 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
71 DO_WRITE_HOSTS_FILE: 1
73 - apk add bash curl postgresql-client
74 - bash api_tests/prepare-drone-federation-test.sh
82 dockerfile: docker/dev/Dockerfile
84 from_secret: docker_username
86 from_secret: docker_password
87 repo: dessalines/lemmy
94 - name: publish release docker image
97 dockerfile: docker/prod/Dockerfile
99 from_secret: docker_username
101 from_secret: docker_password
102 repo: dessalines/lemmy
104 auto_tag_suffix: linux-amd64
109 - name: publish release docker manifest
110 image: plugins/manifest
113 from_secret: docker_username
115 from_secret: docker_password
116 target: "dessalines/lemmy:${DRONE_TAG}"
117 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
126 - name: publish latest release docker manifest
127 image: plugins/manifest
130 from_secret: docker_username
132 from_secret: docker_password
133 target: "dessalines/lemmy:latest"
134 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
143 # using https://github.com/pksunkara/cargo-workspaces
144 - name: publish to crates.io
145 image: rustlang/rust:nightly
148 from_secret: cargo_api_token
150 - cargo install cargo-workspaces
151 - cp -r migrations crates/db_schema/
152 - cargo login "$CARGO_TOKEN"
153 - cargo workspaces publish --from-git --allow-dirty --allow-branch "${DRONE_TAG}" --yes custom "${DRONE_TAG}"
160 image: postgres:14-alpine
163 POSTGRES_PASSWORD: password
176 image: rust:1.57-slim
179 - chown 1000:1000 . -R
181 - apt install --no-install-recommends --yes git
184 - git submodule update --recursive --remote
186 # TODO temporarily disable arm tests
188 # image: rust:1.57-slim
190 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
191 # LEMMY_CONFIG_LOCATION: ../../config/config.hjson
193 # RUST_TEST_THREADS: 1
196 # - apt-get -y install --no-install-recommends postgresql-client libssl-dev pkg-config libpq-dev
197 # - cargo test --workspace --no-fail-fast
200 # TODO temporarily disable arm tests
201 # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
202 # - name: cargo build
203 # image: rust:1.57-slim
206 # - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
208 # - mv target/debug/lemmy_server target/lemmy_server
210 # TODO temporarily disable arm tests
211 # - name: run federation tests
212 # image: node:16-slim
214 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
215 # DO_WRITE_HOSTS_FILE: 1
217 # - mkdir -p /usr/share/man/man1 /usr/share/man/man7
219 # - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
220 # - bash api_tests/prepare-drone-federation-test.sh
225 - name: publish release docker image
226 image: plugins/docker
228 dockerfile: docker/prod/Dockerfile.arm
230 from_secret: docker_username
232 from_secret: docker_password
233 repo: dessalines/lemmy
235 auto_tag_suffix: linux-arm64
240 - name: publish release docker manifest
241 image: plugins/manifest
244 from_secret: docker_username
246 from_secret: docker_password
247 target: "dessalines/lemmy:${DRONE_TAG}"
248 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
257 - name: publish latest release docker manifest
258 image: plugins/manifest
261 from_secret: docker_username
263 from_secret: docker_password
264 target: "dessalines/lemmy:latest"
265 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
274 # TODO temporarily disable arm tests
277 # image: postgres:12-alpine
279 # POSTGRES_USER: lemmy
280 # POSTGRES_PASSWORD: password