]> Untitled Git - lemmy.git/blob - .woodpecker.yml
Enhanced testing of comments. Validate reply notifications, mentions (#3686)
[lemmy.git] / .woodpecker.yml
1 # TODO: The when: platform conditionals aren't working currently
2 # See https://github.com/woodpecker-ci/woodpecker/issues/1677
3
4 variables:
5   - &muslrust_image "clux/muslrust:1.70.0"
6
7 # Broken for cron jobs currently, see
8 # https://github.com/woodpecker-ci/woodpecker/issues/1716
9 # clone:
10 #   git:
11 #     image: woodpeckerci/plugin-git
12 #     settings:
13 #       recursive: true
14 #       submodule_update_remote: true
15
16 pipeline:
17   prepare_repo:
18     image: alpine:3
19     commands:
20       - apk add git
21       - git submodule init
22       - git submodule update
23
24   prettier_check:
25     image: tmknom/prettier:3.0.0
26     commands:
27       - prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations'
28
29   restore-cache:
30     image: meltwater/drone-cache:v1
31     pull: true
32     settings:
33       restore: true
34       endpoint:
35         from_secret: MINIO_ENDPOINT
36       access-key:
37         from_secret: MINIO_WRITE_USER
38       secret-key:
39         from_secret: MINIO_WRITE_PASSWORD
40       bucket:
41         from_secret: MINIO_BUCKET
42       region: us-east-1
43       cache_key: "rust-cache"
44       path-style: true
45       mount:
46         - ".cargo"
47         - "target"
48         - "api_tests/node_modules"
49     secrets:
50       [MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
51
52   toml_fmt:
53     image: tamasfe/taplo:0.8.1
54     commands:
55       - taplo format --check
56
57   cargo_fmt:
58     image: *muslrust_image
59     environment:
60       # store cargo data in repo folder so that it gets cached between steps
61       CARGO_HOME: .cargo
62     commands:
63       # need make existing toolchain available
64       - cp -n ~/.cargo . -r
65       - rustup toolchain install nightly-2023-07-10
66       - rustup component add rustfmt --toolchain nightly-2023-07-10
67       - cargo +nightly-2023-07-10 fmt -- --check
68     # when:
69     #   platform: linux/amd64
70
71   # make sure api builds with default features (used by other crates relying on lemmy api)
72   check_api_common_default_features:
73     image: *muslrust_image
74     environment:
75       CARGO_HOME: .cargo
76     commands:
77       - cargo check --package lemmy_api_common
78     # when:
79     #   platform: linux/amd64
80
81   lemmy_api_common_doesnt_depend_on_diesel:
82     image: *muslrust_image
83     environment:
84       CARGO_HOME: .cargo
85     commands:
86       - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
87     # when:
88     #   platform: linux/amd64
89
90   lemmy_api_common_works_with_wasm:
91     image: *muslrust_image
92     environment:
93       CARGO_HOME: .cargo
94     commands:
95       - "rustup target add wasm32-unknown-unknown"
96       - "cargo check --target wasm32-unknown-unknown -p lemmy_api_common"
97
98   check_defaults_hjson_updated:
99     image: *muslrust_image
100     environment:
101       CARGO_HOME: .cargo
102     commands:
103       - export LEMMY_CONFIG_LOCATION=./config/config.hjson
104       - ./scripts/update_config_defaults.sh config/defaults_current.hjson
105       - diff config/defaults.hjson config/defaults_current.hjson
106     # when:
107     #   platform: linux/amd64
108
109   check_diesel_schema:
110     image: willsquire/diesel-cli
111     environment:
112       CARGO_HOME: .cargo
113       DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
114     commands:
115       - diesel migration run
116       - diesel print-schema --config-file=diesel.toml > tmp.schema
117       - diff tmp.schema crates/db_schema/src/schema.rs
118
119   check_diesel_migration_revertable:
120     image: willsquire/diesel-cli
121     environment:
122       CARGO_HOME: .cargo
123       DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
124     commands:
125       - diesel migration run
126       - diesel migration redo
127
128   cargo_clippy:
129     image: *muslrust_image
130     environment:
131       CARGO_HOME: .cargo
132     commands:
133       # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
134       - rustup component add clippy
135       - cargo clippy --workspace --tests --all-targets --features console --
136         -D warnings -D deprecated -D clippy::perf -D clippy::complexity
137         -D clippy::style -D clippy::correctness -D clippy::suspicious
138         -D clippy::dbg_macro -D clippy::inefficient_to_string
139         -D clippy::items-after-statements -D clippy::implicit_clone
140         -D clippy::cast_lossless -D clippy::manual_string_new
141         -D clippy::redundant_closure_for_method_calls
142         -D clippy::unused_self
143         -A clippy::uninlined_format_args
144         -D clippy::get_first
145         -D clippy::explicit_into_iter_loop
146         -D clippy::explicit_iter_loop
147         -D clippy::needless_collect
148         -D clippy::unwrap_used
149         -D clippy::indexing_slicing
150     # when:
151     #   platform: linux/amd64
152
153   cargo_test:
154     image: *muslrust_image
155     environment:
156       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
157       RUST_BACKTRACE: "1"
158       CARGO_HOME: .cargo
159     commands:
160       - export LEMMY_CONFIG_LOCATION=../../config/config.hjson
161       - cargo test --workspace --no-fail-fast
162     # when:
163     #   platform: linux/amd64
164
165   cargo_build:
166     image: *muslrust_image
167     environment:
168       CARGO_HOME: .cargo
169     commands:
170       - cargo build
171       - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
172     # when:
173     #   platform: linux/amd64
174
175   run_federation_tests:
176     image: node:alpine
177     environment:
178       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
179       DO_WRITE_HOSTS_FILE: "1"
180     commands:
181       - apk add bash curl postgresql-client
182       - bash api_tests/prepare-drone-federation-test.sh
183       - cd api_tests/
184       - yarn
185       - yarn api-test
186     # when:
187     #   platform: linux/amd64
188
189   rebuild-cache:
190     image: meltwater/drone-cache:v1
191     pull: true
192     settings:
193       rebuild: true
194       endpoint:
195         from_secret: MINIO_ENDPOINT
196       access-key:
197         from_secret: MINIO_WRITE_USER
198       secret-key:
199         from_secret: MINIO_WRITE_PASSWORD
200       bucket:
201         from_secret: MINIO_BUCKET
202       cache_key: "rust-cache"
203       region: us-east-1
204       path-style: true
205       mount:
206         - ".cargo"
207         - "target"
208         - "api_tests/node_modules"
209     secrets:
210       [MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
211
212   publish_release_docker:
213     image: woodpeckerci/plugin-docker-buildx
214     secrets: [docker_username, docker_password]
215     settings:
216       repo: dessalines/lemmy
217       dockerfile: docker/Dockerfile
218       platforms: linux/amd64
219       build_args:
220         - RUST_RELEASE_MODE=release
221       auto_tag: true
222     when:
223       event: tag
224
225   nightly_build:
226     image: woodpeckerci/plugin-docker-buildx
227     secrets: [docker_username, docker_password]
228     settings:
229       repo: dessalines/lemmy
230       dockerfile: docker/Dockerfile
231       platforms: linux/amd64
232       build_args:
233         - RUST_RELEASE_MODE=release
234       tag: dev
235     when:
236       event: cron
237
238   notify_on_failure:
239     image: alpine:3
240     commands:
241       - apk add curl
242       - "curl -d'Lemmy CI build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
243     when:
244       status: [failure]
245
246   notify_on_tag_deploy:
247     image: alpine:3
248     commands:
249       - apk add curl
250       - "curl -d'lemmy:${CI_COMMIT_TAG} deployed' ntfy.sh/lemmy_drone_ci"
251     when:
252       event: tag
253
254 services:
255   database:
256     image: postgres:15.2-alpine
257     environment:
258       POSTGRES_USER: lemmy
259       POSTGRES_PASSWORD: password
260     # when:
261     #   platform: linux/amd64