12 image: clux/muslrust:1.56.0
15 - chown 1000:1000 . -R
18 - git submodule update --recursive --remote
20 - name: check formatting
21 image: rustdocker/rust:nightly
23 - /root/.cargo/bin/cargo fmt -- --check
26 image: clux/muslrust:1.56.0
28 - rustup component add clippy
29 - cargo clippy --workspace --tests --all-targets --all-features -- -D warnings -D deprecated -D clippy::perf -D clippy::complexity -D clippy::dbg_macro
30 - cargo clippy --workspace -- -D clippy::unwrap_used
33 image: clux/muslrust:1.56.0
35 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
36 LEMMY_CONFIG_LOCATION: ../../config/config.hjson
41 - apt-get -y install --no-install-recommends postgresql-client
42 - cargo test --workspace --no-fail-fast
44 - name: check defaults.hjson updated
45 image: clux/muslrust:1.56.0
47 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
48 - diff config/defaults.hjson config/defaults_current.hjson
51 image: clux/muslrust:1.56.0
54 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
56 - name: run federation tests
59 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
60 DO_WRITE_HOSTS_FILE: 1
62 - apk add bash curl postgresql-client
63 - bash api_tests/prepare-drone-federation-test.sh
68 - name: publish release docker image
71 dockerfile: docker/prod/Dockerfile
73 from_secret: docker_username
75 from_secret: docker_password
76 repo: dessalines/lemmy
78 auto_tag_suffix: linux-amd64
83 - name: publish release docker manifest
84 image: plugins/manifest
87 from_secret: docker_username
89 from_secret: docker_password
90 target: "dessalines/lemmy:${DRONE_TAG}"
91 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
100 - name: publish latest release docker manifest
101 image: plugins/manifest
104 from_secret: docker_username
106 from_secret: docker_password
107 target: "dessalines/lemmy:latest"
108 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
117 # using https://github.com/pksunkara/cargo-workspaces
118 - name: publish to crates.io
119 image: rustlang/rust:nightly
122 from_secret: cargo_api_token
124 - cargo install cargo-workspaces
125 - cp -r migrations crates/db_schema/
126 - cargo login "$CARGO_TOKEN"
127 - cargo workspaces publish --from-git --allow-dirty --allow-branch "${DRONE_TAG}" --yes custom "${DRONE_TAG}"
134 image: postgres:12-alpine
137 POSTGRES_PASSWORD: password
150 image: rust:1.56-slim
153 - chown 1000:1000 . -R
155 - apt install --no-install-recommends --yes git
158 # TODO temporarily disable arm tests
160 # image: rust:1.56-slim
162 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
163 # LEMMY_CONFIG_LOCATION: ../../config/config.hjson
165 # RUST_TEST_THREADS: 1
168 # - apt-get -y install --no-install-recommends postgresql-client libssl-dev pkg-config libpq-dev
169 # - cargo test --workspace --no-fail-fast
172 # TODO temporarily disable arm tests
173 # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
174 # - name: cargo build
175 # image: rust:1.56-slim
178 # - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
180 # - mv target/debug/lemmy_server target/lemmy_server
182 # TODO temporarily disable arm tests
183 # - name: run federation tests
184 # image: node:16-slim
186 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
187 # DO_WRITE_HOSTS_FILE: 1
189 # - mkdir -p /usr/share/man/man1 /usr/share/man/man7
191 # - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
192 # - bash api_tests/prepare-drone-federation-test.sh
197 - name: publish release docker image
198 image: plugins/docker
200 dockerfile: docker/prod/Dockerfile.arm
202 from_secret: docker_username
204 from_secret: docker_password
205 repo: dessalines/lemmy
207 auto_tag_suffix: linux-arm64
212 - name: publish release docker manifest
213 image: plugins/manifest
216 from_secret: docker_username
218 from_secret: docker_password
219 target: "dessalines/lemmy:${DRONE_TAG}"
220 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
229 - name: publish latest release docker manifest
230 image: plugins/manifest
233 from_secret: docker_username
235 from_secret: docker_password
236 target: "dessalines/lemmy:latest"
237 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
246 # TODO temporarily disable arm tests
249 # image: postgres:12-alpine
251 # POSTGRES_USER: lemmy
252 # POSTGRES_PASSWORD: password