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'
9 image: woodpeckerci/plugin-git
12 submodule_update_remote: true
15 # use minimum supported rust version for most steps
17 image: *muslrust_image
19 # store cargo data in repo folder so that it gets cached between steps
22 # need make existing toolchain available
24 - rustup toolchain install nightly
25 - rustup component add rustfmt --toolchain nightly
26 - cargo +nightly fmt -- --check
28 # platform: linux/amd64
30 # check each package to make sure they compile with default features.
31 # this is required for crates.io
33 image: *muslrust_image
37 - cargo check --package lemmy_utils
38 - cargo check --package lemmy_db_schema
39 - cargo check --package lemmy_db_views
40 - cargo check --package lemmy_db_views_actor
41 - cargo check --package lemmy_db_views_moderator
42 - cargo check --package lemmy_api_common
43 - cargo check --package lemmy_api
44 - cargo check --package lemmy_api_crud
45 - cargo check --package lemmy_apub
46 - cargo check --package lemmy_routes
47 - cargo check --workspace
48 - cargo check --workspace --features console
49 # disabled because it takes too long with pict-rs
50 #- cargo check --workspace --all-features
52 # platform: linux/amd64
55 image: *muslrust_image
59 # latest rust for clippy to get extra checks
60 # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
61 - rustup component add clippy
62 - cargo clippy --workspace --tests --all-targets --features console --
63 -D warnings -D deprecated -D clippy::perf -D clippy::complexity
64 -D clippy::style -D clippy::correctness -D clippy::suspicious
65 -D clippy::dbg_macro -D clippy::inefficient_to_string
66 -D clippy::items-after-statements -D clippy::implicit_clone
67 -D clippy::wildcard_imports -D clippy::cast_lossless
68 -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
69 -D clippy::unused_self
70 -A clippy::uninlined_format_args
72 - cargo clippy --workspace --features console --
73 -D clippy::unwrap_used
74 -D clippy::indexing_slicing
76 # platform: linux/amd64
78 lemmy_api_common_doesnt_depend_on_diesel:
79 image: *muslrust_image
83 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
85 # platform: linux/amd64
87 check_defaults_hjson_updated:
88 image: *muslrust_image
92 - export LEMMY_CONFIG_LOCATION=./config/config.hjson
93 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
94 - diff config/defaults.hjson config/defaults_current.hjson
96 # platform: linux/amd64
99 image: *muslrust_image
101 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
103 RUST_TEST_THREADS: "1"
106 - export LEMMY_CONFIG_LOCATION=../../config/config.hjson
107 - cargo test --workspace --no-fail-fast
109 # platform: linux/amd64
112 image: *muslrust_image
117 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
119 # platform: linux/amd64
121 run_federation_tests:
124 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
125 DO_WRITE_HOSTS_FILE: "1"
127 - apk add bash curl postgresql-client
128 - bash api_tests/prepare-drone-federation-test.sh
133 # platform: linux/amd64
136 image: woodpeckerci/plugin-docker-buildx
138 dockerfile: docker/Dockerfile
139 build_args: RUST_RELEASE_MODE=release
141 from_secret: docker_username
143 from_secret: docker_password
144 repo: dessalines/lemmy
145 # 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
150 #platform: linux/amd64
152 publish_release_docker_image_amd:
153 image: woodpeckerci/plugin-docker-buildx
155 dockerfile: docker/Dockerfile
156 build_args: RUST_RELEASE_MODE=release
158 from_secret: docker_username
160 from_secret: docker_password
161 repo: dessalines/lemmy
162 # 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
164 # auto_tag_suffix: linux-amd64
167 #platform: linux/amd64
169 publish_release_docker_image_arm:
170 image: woodpeckerci/plugin-docker-buildx
172 dockerfile: docker/Dockerfile
173 build_args: RUST_RELEASE_MODE=release
175 from_secret: docker_username
177 from_secret: docker_password
178 repo: dessalines/lemmy
179 # 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
181 # auto_tag_suffix: linux-arm64
184 #platform: linux/arm64
186 #publish_release_docker_manifest:
187 # image: plugins/manifest
190 # from_secret: docker_username
192 # from_secret: docker_password
193 # target: "dessalines/lemmy:${CI_COMMIT_TAG}"
194 # template: "dessalines/lemmy:${CI_COMMIT_TAG}-OS-ARCH"
198 # ignore_missing: true
202 #publish_latest_release_docker_manifest:
203 # image: plugins/manifest
206 # from_secret: docker_username
208 # from_secret: docker_password
209 # target: "dessalines/lemmy:latest"
210 # template: "dessalines/lemmy:${CI_COMMIT_TAG}-OS-ARCH"
214 # ignore_missing: true
217 # #platform: linux/amd64
219 # using https://github.com/pksunkara/cargo-workspaces
220 publish_to_crates_io:
221 image: *muslrust_image
223 - cargo install cargo-workspaces
224 - cp -r migrations crates/db_schema/
225 - cargo login "$CARGO_API_TOKEN"
226 - cargo workspaces publish --from-git --allow-dirty --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes custom "${CI_COMMIT_TAG}"
227 secrets: [cargo_api_token]
230 #platform: linux/amd64
236 - "curl -d'Drone build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
240 notify_on_tag_deploy:
244 - "curl -d'lemmy:${CI_COMMIT_TAG} deployed' ntfy.sh/lemmy_drone_ci"
250 image: postgres:15-alpine
253 POSTGRES_PASSWORD: password
255 # platform: linux/amd64