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
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
46 image: *muslrust_image
50 # latest rust for clippy to get extra checks
51 # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
52 - rustup component add clippy
53 - cargo clippy --workspace --tests --all-targets --features console --
54 -D warnings -D deprecated -D clippy::perf -D clippy::complexity
55 -D clippy::style -D clippy::correctness -D clippy::suspicious
56 -D clippy::dbg_macro -D clippy::inefficient_to_string
57 -D clippy::items-after-statements -D clippy::implicit_clone
58 -D clippy::cast_lossless -D clippy::manual_string_new
59 -D clippy::redundant_closure_for_method_calls
60 -D clippy::unused_self
61 -A clippy::uninlined_format_args
63 - cargo clippy --workspace --features console --
64 -D clippy::unwrap_used
65 -D clippy::indexing_slicing
67 # platform: linux/amd64
69 # make sure api builds with default features (used by other crates relying on lemmy api)
71 image: *muslrust_image
75 - cargo check --package lemmy_api_common
77 # platform: linux/amd64
79 lemmy_api_common_doesnt_depend_on_diesel:
80 image: *muslrust_image
84 - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
86 # platform: linux/amd64
88 check_defaults_hjson_updated:
89 image: *muslrust_image
93 - export LEMMY_CONFIG_LOCATION=./config/config.hjson
94 - ./scripts/update_config_defaults.sh config/defaults_current.hjson
95 - diff config/defaults.hjson config/defaults_current.hjson
97 # platform: linux/amd64
100 image: willsquire/diesel-cli
103 DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
105 - diesel migration run
106 - diesel print-schema --config-file=diesel.toml > tmp.schema
107 - diff tmp.schema crates/db_schema/src/schema.rs
110 image: *muslrust_image
112 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
114 RUST_TEST_THREADS: "1"
117 - export LEMMY_CONFIG_LOCATION=../../config/config.hjson
118 - cargo test --workspace --no-fail-fast
120 # platform: linux/amd64
123 image: *muslrust_image
128 - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
130 # platform: linux/amd64
132 run_federation_tests:
135 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
136 DO_WRITE_HOSTS_FILE: "1"
138 - apk add bash curl postgresql-client
139 - bash api_tests/prepare-drone-federation-test.sh
144 # platform: linux/amd64
146 publish_release_docker:
147 image: woodpeckerci/plugin-docker-buildx
148 secrets: [docker_username, docker_password]
150 repo: dessalines/lemmy
151 dockerfile: docker/Dockerfile
152 platforms: linux/amd64
154 - RUST_RELEASE_MODE=release
160 image: woodpeckerci/plugin-docker-buildx
161 secrets: [docker_username, docker_password]
163 repo: dessalines/lemmy
164 dockerfile: docker/Dockerfile
165 platforms: linux/amd64
167 - RUST_RELEASE_MODE=release
172 # using https://github.com/pksunkara/cargo-workspaces
173 publish_to_crates_io:
174 image: *muslrust_image
176 - 'echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"'
177 - cargo install cargo-workspaces
178 - cp -r migrations crates/db_schema/
179 - cargo login "$CARGO_API_TOKEN"
180 - cargo workspaces publish --from-git --allow-dirty --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes custom "${CI_COMMIT_TAG}"
181 secrets: [cargo_api_token]
184 #platform: linux/amd64
190 - "curl -d'Lemmy CI build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
194 notify_on_tag_deploy:
198 - "curl -d'lemmy:${CI_COMMIT_TAG} deployed' ntfy.sh/lemmy_drone_ci"
204 image: postgres:15.2-alpine
207 POSTGRES_PASSWORD: password
209 # platform: linux/amd64