1 # TODO: The when: platform conditionals aren't working currently
2 # See https://github.com/woodpecker-ci/woodpecker/issues/1677
5 # use minimum supported rust version for most steps
12 - git submodule update --recursive --remote
15 image: clux/muslrust:1.67.0
17 # store cargo data in repo folder so that it gets cached between steps
20 # need make existing toolchain available
22 - rustup toolchain install nightly
23 - rustup component add rustfmt --toolchain nightly
24 - cargo +nightly fmt -- --check
26 # platform: linux/amd64
28 # check each package to make sure they compile with default features.
29 # this is required for crates.io
31 image: clux/muslrust:1.67.0
35 - cargo check --package lemmy_utils
36 - cargo check --package lemmy_db_schema
37 - cargo check --package lemmy_db_views
38 - cargo check --package lemmy_db_views_actor
39 - cargo check --package lemmy_db_views_moderator
40 - cargo check --package lemmy_api_common
41 - cargo check --package lemmy_api
42 - cargo check --package lemmy_api_crud
43 - cargo check --package lemmy_apub
44 - cargo check --package lemmy_routes
45 - cargo check --workspace
46 - cargo check --workspace --features console
47 # disabled because it takes too long with pict-rs
48 #- cargo check --workspace --all-features
50 # platform: linux/amd64
53 image: clux/muslrust:1.67.0
57 # latest rust for clippy to get extra checks
58 # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
59 - rustup component add clippy
60 - cargo clippy --workspace --tests --all-targets --features console --
61 -D warnings -D deprecated -D clippy::perf -D clippy::complexity
62 -D clippy::style -D clippy::correctness -D clippy::suspicious
63 -D clippy::dbg_macro -D clippy::inefficient_to_string
64 -D clippy::items-after-statements -D clippy::implicit_clone
65 -D clippy::wildcard_imports -D clippy::cast_lossless
66 -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
67 -D clippy::unused_self
68 -A clippy::uninlined_format_args
70 - cargo clippy --workspace --features console --
71 -D clippy::unwrap_used
72 -D clippy::indexing_slicing
74 # platform: linux/amd64
76 lemmy_api_common_doesnt_depend_on_diesel:
77 image: clux/muslrust:1.67.0
81 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
83 # platform: linux/amd64
85 check_defaults_hjson_updated:
86 image: clux/muslrust:1.67.0
90 - export LEMMY_CONFIG_LOCATION=./config/config.hjson
91 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
92 - diff config/defaults.hjson config/defaults_current.hjson
94 # platform: linux/amd64
97 image: clux/muslrust:1.67.0
99 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
101 RUST_TEST_THREADS: "1"
104 - export LEMMY_CONFIG_LOCATION=../../config/config.hjson
105 - cargo test --workspace --no-fail-fast
107 # platform: linux/amd64
110 image: clux/muslrust:1.67.0
115 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
117 # platform: linux/amd64
119 run_federation_tests:
122 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
123 DO_WRITE_HOSTS_FILE: "1"
125 - apk add bash curl postgresql-client
126 - bash api_tests/prepare-drone-federation-test.sh
131 # platform: linux/amd64
134 image: woodpeckerci/plugin-docker-buildx
136 dockerfile: docker/Dockerfile
137 build_args: RUST_RELEASE_MODE=release
139 from_secret: docker_username
141 from_secret: docker_password
142 repo: dessalines/lemmy
143 # 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
148 #platform: linux/amd64
150 publish_release_docker_image_amd:
151 image: woodpeckerci/plugin-docker-buildx
153 dockerfile: docker/Dockerfile
154 build_args: RUST_RELEASE_MODE=release
156 from_secret: docker_username
158 from_secret: docker_password
159 repo: dessalines/lemmy
160 # 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
162 # auto_tag_suffix: linux-amd64
165 #platform: linux/amd64
167 publish_release_docker_image_arm:
168 image: woodpeckerci/plugin-docker-buildx
170 dockerfile: docker/Dockerfile
171 build_args: RUST_RELEASE_MODE=release
173 from_secret: docker_username
175 from_secret: docker_password
176 repo: dessalines/lemmy
177 # 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
179 # auto_tag_suffix: linux-arm64
182 #platform: linux/arm64
184 #publish_release_docker_manifest:
185 # image: plugins/manifest
188 # from_secret: docker_username
190 # from_secret: docker_password
191 # target: "dessalines/lemmy:${CI_COMMIT_TAG}"
192 # template: "dessalines/lemmy:${CI_COMMIT_TAG}-OS-ARCH"
196 # ignore_missing: true
200 #publish_latest_release_docker_manifest:
201 # image: plugins/manifest
204 # from_secret: docker_username
206 # from_secret: docker_password
207 # target: "dessalines/lemmy:latest"
208 # template: "dessalines/lemmy:${CI_COMMIT_TAG}-OS-ARCH"
212 # ignore_missing: true
215 # #platform: linux/amd64
217 # using https://github.com/pksunkara/cargo-workspaces
218 publish_to_crates_io:
219 image: clux/muslrust:1.67.0
221 - cargo install cargo-workspaces
222 - cp -r migrations crates/db_schema/
223 - cargo login "$CARGO_TOKEN"
224 - cargo workspaces publish --from-git --allow-dirty --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes custom "${CI_COMMIT_TAG}"
225 secrets: [cargo_api_token]
228 #platform: linux/amd64
234 - "curl -d'Drone build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
238 notify_on_tag_deploy:
242 - "curl -d'lemmy:${CI_COMMIT_TAG} deployed' ntfy.sh/lemmy_drone_ci"
248 image: postgres:15-alpine
251 POSTGRES_PASSWORD: password
253 # platform: linux/amd64