1 # TODO: The when: platform conditionals aren't working currently
2 # See https://github.com/woodpecker-ci/woodpecker/issues/1677
5 - &muslrust_image "clux/muslrust:1.70.0"
16 # config files and scripts used by ci
19 - "scripts/update_config_defaults.sh"
23 # Broken for cron jobs currently, see
24 # https://github.com/woodpecker-ci/woodpecker/issues/1716
27 # image: woodpeckerci/plugin-git
30 # submodule_update_remote: true
38 - git submodule update
41 image: tmknom/prettier:3.0.0
43 - prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations'
46 image: meltwater/drone-cache:v1
51 from_secret: MINIO_ENDPOINT
53 from_secret: MINIO_WRITE_USER
55 from_secret: MINIO_WRITE_PASSWORD
57 from_secret: MINIO_BUCKET
59 cache_key: "rust-cache"
64 - "api_tests/node_modules"
66 [MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
67 when: *slow_check_paths
70 image: tamasfe/taplo:0.8.1
72 - taplo format --check
75 image: *muslrust_image
77 # store cargo data in repo folder so that it gets cached between steps
80 # need make existing toolchain available
82 - rustup toolchain install nightly-2023-07-10
83 - rustup component add rustfmt --toolchain nightly-2023-07-10
84 - cargo +nightly-2023-07-10 fmt -- --check
86 # make sure api builds with default features (used by other crates relying on lemmy api)
87 check_api_common_default_features:
88 image: *muslrust_image
92 - cargo check --package lemmy_api_common
93 when: *slow_check_paths
95 lemmy_api_common_doesnt_depend_on_diesel:
96 image: *muslrust_image
100 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
101 when: *slow_check_paths
103 lemmy_api_common_works_with_wasm:
104 image: *muslrust_image
108 - "rustup target add wasm32-unknown-unknown"
109 - "cargo check --target wasm32-unknown-unknown -p lemmy_api_common"
110 when: *slow_check_paths
112 check_defaults_hjson_updated:
113 image: *muslrust_image
117 - export LEMMY_CONFIG_LOCATION=./config/config.hjson
118 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
119 - diff config/defaults.hjson config/defaults_current.hjson
120 when: *slow_check_paths
123 image: willsquire/diesel-cli
126 DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
128 - diesel migration run
129 - diesel print-schema --config-file=diesel.toml > tmp.schema
130 - diff tmp.schema crates/db_schema/src/schema.rs
131 when: *slow_check_paths
133 check_diesel_migration_revertable:
134 image: willsquire/diesel-cli
137 DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
139 - diesel migration run
140 - diesel migration redo
141 when: *slow_check_paths
144 image: *muslrust_image
148 # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
149 - rustup component add clippy
150 - cargo clippy --workspace --tests --all-targets --features console --
151 -D warnings -D deprecated -D clippy::perf -D clippy::complexity
152 -D clippy::style -D clippy::correctness -D clippy::suspicious
153 -D clippy::dbg_macro -D clippy::inefficient_to_string
154 -D clippy::items-after-statements -D clippy::implicit_clone
155 -D clippy::cast_lossless -D clippy::manual_string_new
156 -D clippy::redundant_closure_for_method_calls
157 -D clippy::unused_self
158 -A clippy::uninlined_format_args
160 -D clippy::explicit_into_iter_loop
161 -D clippy::explicit_iter_loop
162 -D clippy::needless_collect
163 -D clippy::unwrap_used
164 -D clippy::indexing_slicing
165 when: *slow_check_paths
168 image: *muslrust_image
170 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
174 - export LEMMY_CONFIG_LOCATION=../../config/config.hjson
175 - cargo test --workspace --no-fail-fast
176 when: *slow_check_paths
179 image: *muslrust_image
184 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
185 when: *slow_check_paths
187 run_federation_tests:
190 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
191 DO_WRITE_HOSTS_FILE: "1"
193 - apk add bash curl postgresql-client
194 - bash api_tests/prepare-drone-federation-test.sh
198 when: *slow_check_paths
201 image: meltwater/drone-cache:v1
206 from_secret: MINIO_ENDPOINT
208 from_secret: MINIO_WRITE_USER
210 from_secret: MINIO_WRITE_PASSWORD
212 from_secret: MINIO_BUCKET
213 cache_key: "rust-cache"
219 - "api_tests/node_modules"
221 [MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
222 when: *slow_check_paths
224 publish_release_docker:
225 image: woodpeckerci/plugin-docker-buildx
226 secrets: [docker_username, docker_password]
228 repo: dessalines/lemmy
229 dockerfile: docker/Dockerfile
230 platforms: linux/amd64
232 - RUST_RELEASE_MODE=release
238 image: woodpeckerci/plugin-docker-buildx
239 secrets: [docker_username, docker_password]
241 repo: dessalines/lemmy
242 dockerfile: docker/Dockerfile
243 platforms: linux/amd64
245 - RUST_RELEASE_MODE=release
254 - "curl -d'Lemmy CI build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
258 notify_on_tag_deploy:
262 - "curl -d'lemmy:${CI_COMMIT_TAG} deployed' ntfy.sh/lemmy_drone_ci"
268 image: postgres:15.2-alpine
271 POSTGRES_PASSWORD: password