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
25 # use minimum supported rust version for most steps
27 image: *muslrust_image
29 # store cargo data in repo folder so that it gets cached between steps
32 # need make existing toolchain available
34 - rustup toolchain install nightly
35 - rustup component add rustfmt --toolchain nightly
36 - cargo +nightly fmt -- --check
38 # platform: linux/amd64
40 # check each package to make sure they compile with default features.
41 # this is required for crates.io
43 image: *muslrust_image
47 - cargo check --package lemmy_utils
48 - cargo check --package lemmy_db_schema
49 - cargo check --package lemmy_db_views
50 - cargo check --package lemmy_db_views_actor
51 - cargo check --package lemmy_db_views_moderator
52 - cargo check --package lemmy_api_common
53 - cargo check --package lemmy_api
54 - cargo check --package lemmy_api_crud
55 - cargo check --package lemmy_apub
56 - cargo check --package lemmy_routes
57 - cargo check --workspace
58 - cargo check --workspace --features console
59 # disabled because it takes too long with pict-rs
60 #- cargo check --workspace --all-features
62 # platform: linux/amd64
65 image: *muslrust_image
69 # latest rust for clippy to get extra checks
70 # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
71 - rustup component add clippy
72 - cargo clippy --workspace --tests --all-targets --features console --
73 -D warnings -D deprecated -D clippy::perf -D clippy::complexity
74 -D clippy::style -D clippy::correctness -D clippy::suspicious
75 -D clippy::dbg_macro -D clippy::inefficient_to_string
76 -D clippy::items-after-statements -D clippy::implicit_clone
77 -D clippy::wildcard_imports -D clippy::cast_lossless
78 -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
79 -D clippy::unused_self
80 -A clippy::uninlined_format_args
82 - cargo clippy --workspace --features console --
83 -D clippy::unwrap_used
84 -D clippy::indexing_slicing
86 # platform: linux/amd64
88 lemmy_api_common_doesnt_depend_on_diesel:
89 image: *muslrust_image
93 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
95 # platform: linux/amd64
97 check_defaults_hjson_updated:
98 image: *muslrust_image
102 - export LEMMY_CONFIG_LOCATION=./config/config.hjson
103 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
104 - diff config/defaults.hjson config/defaults_current.hjson
106 # platform: linux/amd64
109 image: jameshiew/diesel-cli
112 DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
114 - diesel migration run
115 - diesel print-schema --config-file=diesel.toml > tmp.schema
116 - diff tmp.schema crates/db_schema/src/schema.rs
119 image: *muslrust_image
121 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
123 RUST_TEST_THREADS: "1"
126 - export LEMMY_CONFIG_LOCATION=../../config/config.hjson
127 - cargo test --workspace --no-fail-fast
129 # platform: linux/amd64
132 image: *muslrust_image
137 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
139 # platform: linux/amd64
141 run_federation_tests:
144 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
145 DO_WRITE_HOSTS_FILE: "1"
147 - apk add bash curl postgresql-client
148 - bash api_tests/prepare-drone-federation-test.sh
153 # platform: linux/amd64
156 image: woodpeckerci/plugin-docker-buildx
158 repo: dessalines/lemmy
159 dockerfile: docker/Dockerfile
160 platforms: linux/amd64
161 build_args: RUST_RELEASE_MODE=release
163 from_secret: docker_username
165 from_secret: docker_password
166 # 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
171 #platform: linux/amd64
173 publish_release_docker_image_amd:
174 image: woodpeckerci/plugin-docker-buildx
176 repo: dessalines/lemmy
177 dockerfile: docker/Dockerfile
178 platforms: linux/amd64
179 build_args: RUST_RELEASE_MODE=release
181 from_secret: docker_username
183 from_secret: docker_password
184 # 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
186 # auto_tag_suffix: linux-amd64
189 #platform: linux/amd64
191 publish_release_docker_image_arm:
192 image: woodpeckerci/plugin-docker-buildx
194 repo: dessalines/lemmy
195 dockerfile: docker/Dockerfile
196 platforms: linux/arm64
197 build_args: RUST_RELEASE_MODE=release
199 from_secret: docker_username
201 from_secret: docker_password
202 # 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
204 # auto_tag_suffix: linux-arm64
207 #platform: linux/arm64
209 #publish_release_docker_manifest:
210 # image: plugins/manifest
213 # from_secret: docker_username
215 # from_secret: docker_password
216 # target: "dessalines/lemmy:${CI_COMMIT_TAG}"
217 # template: "dessalines/lemmy:${CI_COMMIT_TAG}-OS-ARCH"
221 # ignore_missing: true
225 #publish_latest_release_docker_manifest:
226 # image: plugins/manifest
229 # from_secret: docker_username
231 # from_secret: docker_password
232 # target: "dessalines/lemmy:latest"
233 # template: "dessalines/lemmy:${CI_COMMIT_TAG}-OS-ARCH"
237 # ignore_missing: true
240 # #platform: linux/amd64
242 # using https://github.com/pksunkara/cargo-workspaces
243 publish_to_crates_io:
244 image: *muslrust_image
246 - cargo install cargo-workspaces
247 - cp -r migrations crates/db_schema/
248 - cargo login "$CARGO_API_TOKEN"
249 - cargo workspaces publish --from-git --allow-dirty --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes custom "${CI_COMMIT_TAG}"
250 secrets: [cargo_api_token]
253 #platform: linux/amd64
259 - "curl -d'Drone build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
263 notify_on_tag_deploy:
267 - "curl -d'lemmy:${CI_COMMIT_TAG} deployed' ntfy.sh/lemmy_drone_ci"
273 image: postgres:15-alpine
276 POSTGRES_PASSWORD: password
278 # platform: linux/amd64