]> Untitled Git - lemmy.git/blob - .woodpecker.yml
Update translations
[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.67.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 fetch --tags
22       - git submodule init
23       - git submodule update
24
25   prettier_check:
26     image: tmknom/prettier
27     commands:
28       - prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations'
29
30   # use minimum supported rust version for most steps
31   cargo_fmt:
32     image: *muslrust_image
33     environment:
34       # store cargo data in repo folder so that it gets cached between steps
35       CARGO_HOME: .cargo
36     commands:
37       # need make existing toolchain available
38       - cp ~/.cargo . -r
39       - rustup toolchain install nightly
40       - rustup component add rustfmt --toolchain nightly
41       - cargo +nightly fmt -- --check
42     # when:
43     #   platform: linux/amd64
44
45   # check each package to make sure they compile with default features.
46   # this is required for crates.io
47   cargo_check:
48     image: *muslrust_image
49     environment:
50       CARGO_HOME: .cargo
51     commands:
52       - cargo check --package lemmy_utils
53       - cargo check --package lemmy_db_schema
54       - cargo check --package lemmy_db_views
55       - cargo check --package lemmy_db_views_actor
56       - cargo check --package lemmy_db_views_moderator
57       - cargo check --package lemmy_api_common
58       - cargo check --package lemmy_api
59       - cargo check --package lemmy_api_crud
60       - cargo check --package lemmy_apub
61       - cargo check --package lemmy_routes
62       - cargo check --workspace
63       - cargo check --workspace --features console
64       # disabled because it takes too long with pict-rs
65       #- cargo check --workspace --all-features
66     # when:
67     #   platform: linux/amd64
68
69   cargo_clippy:
70     image: *muslrust_image
71     environment:
72       CARGO_HOME: .cargo
73     commands:
74       # latest rust for clippy to get extra checks
75       # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
76       - rustup component add clippy
77       - cargo clippy --workspace --tests --all-targets --features console --
78         -D warnings -D deprecated -D clippy::perf -D clippy::complexity
79         -D clippy::style -D clippy::correctness -D clippy::suspicious
80         -D clippy::dbg_macro -D clippy::inefficient_to_string
81         -D clippy::items-after-statements -D clippy::implicit_clone
82         -D clippy::cast_lossless -D clippy::manual_string_new
83         -D clippy::redundant_closure_for_method_calls
84         -D clippy::unused_self
85         -A clippy::uninlined_format_args
86         -D clippy::get_first
87       - cargo clippy --workspace --features console --
88         -D clippy::unwrap_used
89         -D clippy::indexing_slicing
90     # when:
91     #   platform: linux/amd64
92
93   lemmy_api_common_doesnt_depend_on_diesel:
94     image: *muslrust_image
95     environment:
96       CARGO_HOME: .cargo
97     commands:
98       - "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
99     # when:
100     #   platform: linux/amd64
101
102   check_defaults_hjson_updated:
103     image: *muslrust_image
104     environment:
105       CARGO_HOME: .cargo
106     commands:
107       - export LEMMY_CONFIG_LOCATION=./config/config.hjson
108       - ./scripts/update_config_defaults.sh config/defaults_current.hjson
109       - diff config/defaults.hjson config/defaults_current.hjson
110     # when:
111     #   platform: linux/amd64
112
113   check_diesel_schema:
114     image: willsquire/diesel-cli
115     environment:
116       CARGO_HOME: .cargo
117       DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
118     commands:
119       - diesel migration run
120       - diesel print-schema --config-file=diesel.toml > tmp.schema
121       - diff tmp.schema crates/db_schema/src/schema.rs
122
123   cargo_test:
124     image: *muslrust_image
125     environment:
126       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
127       RUST_BACKTRACE: "1"
128       RUST_TEST_THREADS: "1"
129       CARGO_HOME: .cargo
130     commands:
131       - export LEMMY_CONFIG_LOCATION=../../config/config.hjson
132       - cargo test --workspace --no-fail-fast
133     # when:
134     #   platform: linux/amd64
135
136   cargo_build:
137     image: *muslrust_image
138     environment:
139       CARGO_HOME: .cargo
140     commands:
141       - cargo build
142       - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
143     # when:
144     #   platform: linux/amd64
145
146   run_federation_tests:
147     image: node:alpine
148     environment:
149       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
150       DO_WRITE_HOSTS_FILE: "1"
151     commands:
152       - apk add bash curl postgresql-client
153       - bash api_tests/prepare-drone-federation-test.sh
154       - cd api_tests/
155       - yarn
156       - yarn api-test
157     # when:
158     #   platform: linux/amd64
159
160   nightly_build:
161     image: woodpeckerci/plugin-docker-buildx
162     settings:
163       repo: dessalines/lemmy
164       dockerfile: docker/Dockerfile
165       platforms: linux/amd64
166       build_args: RUST_RELEASE_MODE=release
167       username:
168         from_secret: docker_username
169       password:
170         from_secret: docker_password
171       # 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
172       tag: dev
173     when:
174       event:
175         - cron
176           #platform: linux/amd64
177
178   publish_release_docker_image_amd:
179     image: woodpeckerci/plugin-docker-buildx
180     settings:
181       repo: dessalines/lemmy
182       dockerfile: docker/Dockerfile
183       platforms: linux/amd64
184       build_args: RUST_RELEASE_MODE=release
185       username:
186         from_secret: docker_username
187       password:
188         from_secret: docker_password
189       # 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
190       auto_tag: true
191       # auto_tag_suffix: linux-amd64
192     when:
193       event:
194         tag
195         #platform: linux/amd64
196
197   publish_release_docker_image_arm:
198     image: woodpeckerci/plugin-docker-buildx
199     settings:
200       repo: dessalines/lemmy
201       dockerfile: docker/Dockerfile
202       platforms: linux/arm64
203       build_args: RUST_RELEASE_MODE=release
204       username:
205         from_secret: docker_username
206       password:
207         from_secret: docker_password
208       # 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
209       auto_tag: true
210       # auto_tag_suffix: linux-arm64
211     when:
212       event:
213         tag
214         #platform: linux/arm64
215
216   #publish_release_docker_manifest:
217   #  image: plugins/manifest
218   #  settings:
219   #    username:
220   #      from_secret: docker_username
221   #    password:
222   #      from_secret: docker_password
223   #    target: "dessalines/lemmy:${CI_COMMIT_TAG}"
224   #    template: "dessalines/lemmy:${CI_COMMIT_TAG}-OS-ARCH"
225   #    platforms:
226   #      - linux/amd64
227   #      - linux/arm64
228   #    ignore_missing: true
229   #  when:
230   #    event: tag
231
232   #publish_latest_release_docker_manifest:
233   #  image: plugins/manifest
234   #  settings:
235   #    username:
236   #      from_secret: docker_username
237   #    password:
238   #      from_secret: docker_password
239   #    target: "dessalines/lemmy:latest"
240   #    template: "dessalines/lemmy:${CI_COMMIT_TAG}-OS-ARCH"
241   #    platforms:
242   #      - linux/amd64
243   #      - linux/arm64
244   #    ignore_missing: true
245   #  when:
246   #    event: tag
247   #      #platform: linux/amd64
248
249   # using https://github.com/pksunkara/cargo-workspaces
250   publish_to_crates_io:
251     image: *muslrust_image
252     commands:
253       - 'echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"'
254       - cargo install cargo-workspaces
255       - cp -r migrations crates/db_schema/
256       - cargo login "$CARGO_API_TOKEN"
257       - cargo workspaces publish --from-git --allow-dirty --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes custom "${CI_COMMIT_TAG}"
258     secrets: [cargo_api_token]
259     when:
260       event: tag
261       #platform: linux/amd64
262
263   notify_on_failure:
264     image: alpine:3
265     commands:
266       - apk add curl
267       - "curl -d'Lemmy CI build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
268     when:
269       status: [failure]
270
271   notify_on_tag_deploy:
272     image: alpine:3
273     commands:
274       - apk add curl
275       - "curl -d'lemmy:${CI_COMMIT_TAG} deployed' ntfy.sh/lemmy_drone_ci"
276     when:
277       event: tag
278
279 services:
280   database:
281     image: postgres:15.2-alpine
282     environment:
283       POSTGRES_USER: lemmy
284       POSTGRES_PASSWORD: password
285     # when:
286     #   platform: linux/amd64