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.67.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
23 - git submodule update --recursive --remote
26 image: tmknom/prettier
28 - prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations'
30 # use minimum supported rust version for most steps
32 image: *muslrust_image
34 # store cargo data in repo folder so that it gets cached between steps
37 # need make existing toolchain available
39 - rustup toolchain install nightly
40 - rustup component add rustfmt --toolchain nightly
41 - cargo +nightly fmt -- --check
43 # platform: linux/amd64
45 # check each package to make sure they compile with default features.
46 # this is required for crates.io
48 image: *muslrust_image
52 - cargo check --package lemmy_utils
53 - cargo check --package lemmy_db_schema
54 - cargo check --package lemmy_db_views
55 - cargo check --package lemmy_db_views_actor
56 - cargo check --package lemmy_db_views_moderator
57 - cargo check --package lemmy_api_common
58 - cargo check --package lemmy_api
59 - cargo check --package lemmy_api_crud
60 - cargo check --package lemmy_apub
61 - cargo check --package lemmy_routes
62 - cargo check --workspace
63 - cargo check --workspace --features console
64 # disabled because it takes too long with pict-rs
65 #- cargo check --workspace --all-features
67 # platform: linux/amd64
70 image: *muslrust_image
74 # latest rust for clippy to get extra checks
75 # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
76 - rustup component add clippy
77 - cargo clippy --workspace --tests --all-targets --features console --
78 -D warnings -D deprecated -D clippy::perf -D clippy::complexity
79 -D clippy::style -D clippy::correctness -D clippy::suspicious
80 -D clippy::dbg_macro -D clippy::inefficient_to_string
81 -D clippy::items-after-statements -D clippy::implicit_clone
82 -D clippy::wildcard_imports -D clippy::cast_lossless
83 -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
84 -D clippy::unused_self
85 -A clippy::uninlined_format_args
87 - cargo clippy --workspace --features console --
88 -D clippy::unwrap_used
89 -D clippy::indexing_slicing
91 # platform: linux/amd64
93 lemmy_api_common_doesnt_depend_on_diesel:
94 image: *muslrust_image
98 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
100 # platform: linux/amd64
102 check_defaults_hjson_updated:
103 image: *muslrust_image
107 - export LEMMY_CONFIG_LOCATION=./config/config.hjson
108 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
109 - diff config/defaults.hjson config/defaults_current.hjson
111 # platform: linux/amd64
114 image: jameshiew/diesel-cli
117 DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
119 - diesel migration run
120 - diesel print-schema --config-file=diesel.toml > tmp.schema
121 - diff tmp.schema crates/db_schema/src/schema.rs
124 image: *muslrust_image
126 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
128 RUST_TEST_THREADS: "1"
131 - export LEMMY_CONFIG_LOCATION=../../config/config.hjson
132 - cargo test --workspace --no-fail-fast
134 # platform: linux/amd64
137 image: *muslrust_image
142 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
144 # platform: linux/amd64
146 run_federation_tests:
149 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
150 DO_WRITE_HOSTS_FILE: "1"
152 - apk add bash curl postgresql-client
153 - bash api_tests/prepare-drone-federation-test.sh
158 # platform: linux/amd64
161 image: woodpeckerci/plugin-docker-buildx
163 repo: dessalines/lemmy
164 dockerfile: docker/Dockerfile
165 platforms: linux/amd64
166 build_args: RUST_RELEASE_MODE=release
168 from_secret: docker_username
170 from_secret: docker_password
171 # 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
176 #platform: linux/amd64
178 publish_release_docker_image_amd:
179 image: woodpeckerci/plugin-docker-buildx
181 repo: dessalines/lemmy
182 dockerfile: docker/Dockerfile
183 platforms: linux/amd64
184 build_args: RUST_RELEASE_MODE=release
186 from_secret: docker_username
188 from_secret: docker_password
189 # 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
191 # auto_tag_suffix: linux-amd64
195 #platform: linux/amd64
197 publish_release_docker_image_arm:
198 image: woodpeckerci/plugin-docker-buildx
200 repo: dessalines/lemmy
201 dockerfile: docker/Dockerfile
202 platforms: linux/arm64
203 build_args: RUST_RELEASE_MODE=release
205 from_secret: docker_username
207 from_secret: docker_password
208 # 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
210 # auto_tag_suffix: linux-arm64
214 #platform: linux/arm64
216 #publish_release_docker_manifest:
217 # image: plugins/manifest
220 # from_secret: docker_username
222 # from_secret: docker_password
223 # target: "dessalines/lemmy:${CI_COMMIT_TAG}"
224 # template: "dessalines/lemmy:${CI_COMMIT_TAG}-OS-ARCH"
228 # ignore_missing: true
232 #publish_latest_release_docker_manifest:
233 # image: plugins/manifest
236 # from_secret: docker_username
238 # from_secret: docker_password
239 # target: "dessalines/lemmy:latest"
240 # template: "dessalines/lemmy:${CI_COMMIT_TAG}-OS-ARCH"
244 # ignore_missing: true
247 # #platform: linux/amd64
249 # using https://github.com/pksunkara/cargo-workspaces
250 publish_to_crates_io:
251 image: *muslrust_image
253 - cargo install cargo-workspaces
254 - cp -r migrations crates/db_schema/
255 - cargo login "$CARGO_API_TOKEN"
256 - cargo workspaces publish --from-git --allow-dirty --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes custom "${CI_COMMIT_TAG}"
257 secrets: [cargo_api_token]
260 #platform: linux/amd64
266 - "curl -d'Drone build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
270 notify_on_tag_deploy:
274 - "curl -d'lemmy:${CI_COMMIT_TAG} deployed' ntfy.sh/lemmy_drone_ci"
280 image: postgres:15.2-alpine
283 POSTGRES_PASSWORD: password
285 # platform: linux/amd64