11 # use minimum supported rust version for most steps
13 image: clux/muslrust:1.57.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.61-buster
30 - rustup component add clippy
31 - cargo clippy --workspace --tests --all-targets --all-features -- -D warnings -D deprecated -D clippy::perf -D clippy::complexity -D clippy::dbg_macro
32 - cargo clippy --workspace -- -D clippy::unwrap_used
35 image: clux/muslrust:1.57.0
37 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
38 LEMMY_CONFIG_LOCATION: ../../config/config.hjson
43 - apt-get -y install --no-install-recommends postgresql-client
44 - cargo test --workspace --no-fail-fast
46 - name: check defaults.hjson updated
47 image: clux/muslrust:1.57.0
49 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
50 - diff config/defaults.hjson config/defaults_current.hjson
52 - name: check with different features
53 image: clux/muslrust:1.57.0
55 - cargo install cargo-workspaces
56 - cargo workspaces exec cargo check --no-default-features
57 - cargo workspaces exec cargo check --all-features
60 image: clux/muslrust:1.57.0
63 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
65 - name: run federation tests
68 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
69 DO_WRITE_HOSTS_FILE: 1
71 - apk add bash curl postgresql-client
72 - bash api_tests/prepare-drone-federation-test.sh
80 dockerfile: docker/dev/Dockerfile
82 from_secret: docker_username
84 from_secret: docker_password
85 repo: dessalines/lemmy
92 - name: publish release docker image
95 dockerfile: docker/prod/Dockerfile
97 from_secret: docker_username
99 from_secret: docker_password
100 repo: dessalines/lemmy
102 auto_tag_suffix: linux-amd64
107 - name: publish release docker manifest
108 image: plugins/manifest
111 from_secret: docker_username
113 from_secret: docker_password
114 target: "dessalines/lemmy:${DRONE_TAG}"
115 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
124 - name: publish latest release docker manifest
125 image: plugins/manifest
128 from_secret: docker_username
130 from_secret: docker_password
131 target: "dessalines/lemmy:latest"
132 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
141 # using https://github.com/pksunkara/cargo-workspaces
142 - name: publish to crates.io
143 image: rustlang/rust:nightly
146 from_secret: cargo_api_token
148 - cargo install cargo-workspaces
149 - cp -r migrations crates/db_schema/
150 - cargo login "$CARGO_TOKEN"
151 - cargo workspaces publish --from-git --allow-dirty --allow-branch "${DRONE_TAG}" --yes custom "${DRONE_TAG}"
158 image: postgres:12-alpine
161 POSTGRES_PASSWORD: password
174 image: rust:1.57-slim
177 - chown 1000:1000 . -R
179 - apt install --no-install-recommends --yes git
182 - git submodule update --recursive --remote
184 # TODO temporarily disable arm tests
186 # image: rust:1.57-slim
188 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
189 # LEMMY_CONFIG_LOCATION: ../../config/config.hjson
191 # RUST_TEST_THREADS: 1
194 # - apt-get -y install --no-install-recommends postgresql-client libssl-dev pkg-config libpq-dev
195 # - cargo test --workspace --no-fail-fast
198 # TODO temporarily disable arm tests
199 # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
200 # - name: cargo build
201 # image: rust:1.57-slim
204 # - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
206 # - mv target/debug/lemmy_server target/lemmy_server
208 # TODO temporarily disable arm tests
209 # - name: run federation tests
210 # image: node:16-slim
212 # LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
213 # DO_WRITE_HOSTS_FILE: 1
215 # - mkdir -p /usr/share/man/man1 /usr/share/man/man7
217 # - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
218 # - bash api_tests/prepare-drone-federation-test.sh
223 - name: publish release docker image
224 image: plugins/docker
226 dockerfile: docker/prod/Dockerfile.arm
228 from_secret: docker_username
230 from_secret: docker_password
231 repo: dessalines/lemmy
233 auto_tag_suffix: linux-arm64
238 - name: publish release docker manifest
239 image: plugins/manifest
242 from_secret: docker_username
244 from_secret: docker_password
245 target: "dessalines/lemmy:${DRONE_TAG}"
246 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
255 - name: publish latest release docker manifest
256 image: plugins/manifest
259 from_secret: docker_username
261 from_secret: docker_password
262 target: "dessalines/lemmy:latest"
263 template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
272 # TODO temporarily disable arm tests
275 # image: postgres:12-alpine
277 # POSTGRES_USER: lemmy
278 # POSTGRES_PASSWORD: password