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"
7 # Broken for cron jobs currently, see
8 # https://github.com/woodpecker-ci/woodpecker/issues/1716
11 # image: woodpeckerci/plugin-git
14 # submodule_update_remote: true
22 - git submodule update
25 image: tmknom/prettier:3.0.0
27 - prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations'
30 image: meltwater/drone-cache:v1
35 from_secret: MINIO_ENDPOINT
37 from_secret: MINIO_WRITE_USER
39 from_secret: MINIO_WRITE_PASSWORD
41 from_secret: MINIO_BUCKET
43 cache_key: "rust-cache"
48 - "api_tests/node_modules"
50 [MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
53 image: tamasfe/taplo:0.8.1
55 - taplo format --check
58 image: *muslrust_image
60 # store cargo data in repo folder so that it gets cached between steps
63 # need make existing toolchain available
65 - rustup toolchain install nightly-2023-07-10
66 - rustup component add rustfmt --toolchain nightly-2023-07-10
67 - cargo +nightly-2023-07-10 fmt -- --check
69 # platform: linux/amd64
72 image: *muslrust_image
76 # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
77 - rustup component add clippy
78 - cargo clippy --workspace --tests --all-targets --features console --
79 -D warnings -D deprecated -D clippy::perf -D clippy::complexity
80 -D clippy::style -D clippy::correctness -D clippy::suspicious
81 -D clippy::dbg_macro -D clippy::inefficient_to_string
82 -D clippy::items-after-statements -D clippy::implicit_clone
83 -D clippy::cast_lossless -D clippy::manual_string_new
84 -D clippy::redundant_closure_for_method_calls
85 -D clippy::unused_self
86 -A clippy::uninlined_format_args
88 -D clippy::explicit_into_iter_loop
89 -D clippy::explicit_iter_loop
90 -D clippy::needless_collect
91 -D clippy::unwrap_used
92 -D clippy::indexing_slicing
94 # platform: linux/amd64
96 # make sure api builds with default features (used by other crates relying on lemmy api)
97 check_api_common_default_features:
98 image: *muslrust_image
102 - cargo check --package lemmy_api_common
104 # platform: linux/amd64
106 lemmy_api_common_doesnt_depend_on_diesel:
107 image: *muslrust_image
111 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
113 # platform: linux/amd64
115 lemmy_api_common_works_with_wasm:
116 image: *muslrust_image
120 - "rustup target add wasm32-unknown-unknown"
121 - "cargo check --target wasm32-unknown-unknown -p lemmy_api_common"
123 check_defaults_hjson_updated:
124 image: *muslrust_image
128 - export LEMMY_CONFIG_LOCATION=./config/config.hjson
129 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
130 - diff config/defaults.hjson config/defaults_current.hjson
132 # platform: linux/amd64
135 image: willsquire/diesel-cli
138 DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
140 - diesel migration run
141 - diesel print-schema --config-file=diesel.toml > tmp.schema
142 - diff tmp.schema crates/db_schema/src/schema.rs
145 image: *muslrust_image
147 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
151 - export LEMMY_CONFIG_LOCATION=../../config/config.hjson
152 - cargo test --workspace --no-fail-fast
154 # platform: linux/amd64
157 image: *muslrust_image
162 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
164 # platform: linux/amd64
166 run_federation_tests:
169 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
170 DO_WRITE_HOSTS_FILE: "1"
172 - apk add bash curl postgresql-client
173 - bash api_tests/prepare-drone-federation-test.sh
178 # platform: linux/amd64
181 image: meltwater/drone-cache:v1
186 from_secret: MINIO_ENDPOINT
188 from_secret: MINIO_WRITE_USER
190 from_secret: MINIO_WRITE_PASSWORD
192 from_secret: MINIO_BUCKET
193 cache_key: "rust-cache"
199 - "api_tests/node_modules"
201 [MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
203 publish_release_docker:
204 image: woodpeckerci/plugin-docker-buildx
205 secrets: [docker_username, docker_password]
207 repo: dessalines/lemmy
208 dockerfile: docker/Dockerfile
209 platforms: linux/amd64
211 - RUST_RELEASE_MODE=release
217 image: woodpeckerci/plugin-docker-buildx
218 secrets: [docker_username, docker_password]
220 repo: dessalines/lemmy
221 dockerfile: docker/Dockerfile
222 platforms: linux/amd64
224 - RUST_RELEASE_MODE=release
233 - "curl -d'Lemmy CI build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
237 notify_on_tag_deploy:
241 - "curl -d'lemmy:${CI_COMMIT_TAG} deployed' ntfy.sh/lemmy_drone_ci"
247 image: postgres:15.2-alpine
250 POSTGRES_PASSWORD: password
252 # platform: linux/amd64