12 image: clux/muslrust:1.56.0
15 - chown 1000:1000 . -R
18 - name: check formatting
19 image: rustdocker/rust:nightly
21 - /root/.cargo/bin/cargo fmt -- --check
24 image: clux/muslrust:1.56.0
26 - rustup component add clippy
27 - cargo clippy --workspace --tests --all-targets --all-features -- -D warnings -D deprecated -D clippy::perf -D clippy::complexity -D clippy::dbg_macro
28 - cargo clippy --workspace -- -D clippy::unwrap_used
31 image: clux/muslrust:1.56.0
33 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
34 LEMMY_CONFIG_LOCATION: ../../config/config.hjson
39 - apt-get -y install --no-install-recommends postgresql-client
40 - cargo test --workspace --no-fail-fast
42 - name: check defaults.hjson updated
43 image: clux/muslrust:1.56.0
45 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
46 - diff config/defaults.hjson config/defaults_current.hjson
49 image: clux/muslrust:1.56.0
52 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
54 - name: run federation tests
57 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
58 DO_WRITE_HOSTS_FILE: 1
60 - apk add bash curl postgresql-client
61 - bash api_tests/prepare-drone-federation-test.sh
66 - name: publish release docker image
69 dockerfile: docker/prod/Dockerfile
71 from_secret: docker_username
73 from_secret: docker_password
74 repo: dessalines/lemmy
76 auto_tag_suffix: linux-amd64
81 - name: publish release docker manifest
82 image: plugins/manifest
85 from_secret: docker_username
87 from_secret: docker_password
88 target: "dessalines/lemmy:${DRONE_TAG}"
89 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
98 - name: publish latest release docker manifest
99 image: plugins/manifest
102 from_secret: docker_username
104 from_secret: docker_password
105 target: "dessalines/lemmy:latest"
106 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
115 # using https://github.com/pksunkara/cargo-workspaces
116 - name: publish to crates.io
117 image: rustlang/rust:nightly
120 from_secret: cargo_api_token
122 - cargo install cargo-workspaces
123 - cp -r migrations crates/db_schema/
124 - cargo login "$CARGO_TOKEN"
125 - cargo workspaces publish --from-git --allow-dirty --allow-branch "${DRONE_TAG}" --yes custom "${DRONE_TAG}"
132 image: postgres:12-alpine
135 POSTGRES_PASSWORD: password
148 image: rust:1.56-slim
151 - chown 1000:1000 . -R
153 - apt install --no-install-recommends --yes git
156 # TODO temporarily disable arm tests
158 # image: rust:1.56-slim
160 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
161 # LEMMY_CONFIG_LOCATION: ../../config/config.hjson
163 # RUST_TEST_THREADS: 1
166 # - apt-get -y install --no-install-recommends postgresql-client libssl-dev pkg-config libpq-dev
167 # - cargo test --workspace --no-fail-fast
170 # TODO temporarily disable arm tests
171 # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
172 # - name: cargo build
173 # image: rust:1.56-slim
176 # - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
178 # - mv target/debug/lemmy_server target/lemmy_server
180 # TODO temporarily disable arm tests
181 # - name: run federation tests
182 # image: node:16-slim
184 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
185 # DO_WRITE_HOSTS_FILE: 1
187 # - mkdir -p /usr/share/man/man1 /usr/share/man/man7
189 # - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
190 # - bash api_tests/prepare-drone-federation-test.sh
195 - name: publish release docker image
196 image: plugins/docker
198 dockerfile: docker/prod/Dockerfile.arm
200 from_secret: docker_username
202 from_secret: docker_password
203 repo: dessalines/lemmy
205 auto_tag_suffix: linux-arm64
210 - name: publish release docker manifest
211 image: plugins/manifest
214 from_secret: docker_username
216 from_secret: docker_password
217 target: "dessalines/lemmy:${DRONE_TAG}"
218 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
227 - name: publish latest release docker manifest
228 image: plugins/manifest
231 from_secret: docker_username
233 from_secret: docker_password
234 target: "dessalines/lemmy:latest"
235 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
244 # TODO temporarily disable arm tests
247 # image: postgres:12-alpine
249 # POSTGRES_USER: lemmy
250 # POSTGRES_PASSWORD: password