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
23 - git submodule update
26 image: tmknom/prettier:3.0.0
28 - prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations'
31 image: meltwater/drone-cache:v1
36 from_secret: MINIO_ENDPOINT
38 from_secret: MINIO_WRITE_USER
40 from_secret: MINIO_WRITE_PASSWORD
42 from_secret: MINIO_BUCKET
44 cache_key: "rust-cache"
49 - "api_tests/node_modules"
51 [MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
54 image: tamasfe/taplo:0.8.1
56 - taplo format --check
58 # use minimum supported rust version for most steps
60 image: *muslrust_image
62 # store cargo data in repo folder so that it gets cached between steps
65 # need make existing toolchain available
67 - rustup toolchain install nightly-2023-07-10
68 - rustup component add rustfmt --toolchain nightly-2023-07-10
69 - cargo +nightly-2023-07-10 fmt -- --check
71 # platform: linux/amd64
74 image: *muslrust_image
78 # latest rust for clippy to get extra checks
79 # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
80 - rustup component add clippy
81 - cargo clippy --workspace --tests --all-targets --features console --
82 -D warnings -D deprecated -D clippy::perf -D clippy::complexity
83 -D clippy::style -D clippy::correctness -D clippy::suspicious
84 -D clippy::dbg_macro -D clippy::inefficient_to_string
85 -D clippy::items-after-statements -D clippy::implicit_clone
86 -D clippy::cast_lossless -D clippy::manual_string_new
87 -D clippy::redundant_closure_for_method_calls
88 -D clippy::unused_self
89 -A clippy::uninlined_format_args
91 -D clippy::explicit_into_iter_loop
92 -D clippy::explicit_iter_loop
93 -D clippy::needless_collect
94 -D clippy::unwrap_used
95 -D clippy::indexing_slicing
97 # platform: linux/amd64
99 # make sure api builds with default features (used by other crates relying on lemmy api)
101 image: *muslrust_image
105 - cargo check --package lemmy_api_common
107 # platform: linux/amd64
109 lemmy_api_common_doesnt_depend_on_diesel:
110 image: *muslrust_image
114 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
116 # platform: linux/amd64
117 lemmy_api_common_works_with_wasm:
118 image: *muslrust_image
122 - "rustup target add wasm32-unknown-unknown"
123 - "cargo check --target wasm32-unknown-unknown -p lemmy_api_common"
125 check_defaults_hjson_updated:
126 image: *muslrust_image
130 - export LEMMY_CONFIG_LOCATION=./config/config.hjson
131 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
132 - diff config/defaults.hjson config/defaults_current.hjson
134 # platform: linux/amd64
137 image: willsquire/diesel-cli
140 DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
142 - diesel migration run
143 - diesel print-schema --config-file=diesel.toml > tmp.schema
144 - diff tmp.schema crates/db_schema/src/schema.rs
147 image: *muslrust_image
149 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
151 RUST_TEST_THREADS: "1"
154 - export LEMMY_CONFIG_LOCATION=../../config/config.hjson
155 - cargo test --workspace --no-fail-fast
157 # platform: linux/amd64
160 image: *muslrust_image
165 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
167 # platform: linux/amd64
169 run_federation_tests:
172 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
173 DO_WRITE_HOSTS_FILE: "1"
175 - apk add bash curl postgresql-client
176 - bash api_tests/prepare-drone-federation-test.sh
181 # platform: linux/amd64
184 image: meltwater/drone-cache:v1
189 from_secret: MINIO_ENDPOINT
191 from_secret: MINIO_WRITE_USER
193 from_secret: MINIO_WRITE_PASSWORD
195 from_secret: MINIO_BUCKET
196 cache_key: "rust-cache"
202 - "api_tests/node_modules"
204 [MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
206 publish_release_docker:
207 image: woodpeckerci/plugin-docker-buildx
208 secrets: [docker_username, docker_password]
210 repo: dessalines/lemmy
211 dockerfile: docker/Dockerfile
212 platforms: linux/amd64
214 - RUST_RELEASE_MODE=release
220 image: woodpeckerci/plugin-docker-buildx
221 secrets: [docker_username, docker_password]
223 repo: dessalines/lemmy
224 dockerfile: docker/Dockerfile
225 platforms: linux/amd64
227 - RUST_RELEASE_MODE=release
232 # using https://github.com/pksunkara/cargo-workspaces
233 publish_to_crates_io:
234 image: *muslrust_image
236 - 'echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"'
237 - cargo install cargo-workspaces
238 - cp -r migrations crates/db_schema/
239 - cargo login "$CARGO_API_TOKEN"
240 - cargo workspaces publish --from-git --allow-dirty --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes custom "${CI_COMMIT_TAG}"
241 secrets: [cargo_api_token]
244 #platform: linux/amd64
250 - "curl -d'Lemmy CI build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
254 notify_on_tag_deploy:
258 - "curl -d'lemmy:${CI_COMMIT_TAG} deployed' ntfy.sh/lemmy_drone_ci"
264 image: postgres:15.2-alpine
267 POSTGRES_PASSWORD: password
269 # platform: linux/amd64