|
|
|
@ -10,27 +10,33 @@ steps:
|
|
|
|
|
|
|
|
|
|
# use minimum supported rust version for most steps
|
|
|
|
|
- name: prepare repo
|
|
|
|
|
image: clux/muslrust:1.64.0
|
|
|
|
|
image: alpine:3
|
|
|
|
|
commands:
|
|
|
|
|
- apk add git
|
|
|
|
|
- git fetch --tags
|
|
|
|
|
- git submodule init
|
|
|
|
|
- git submodule update --recursive --remote
|
|
|
|
|
- chown 1000:1000 . -R
|
|
|
|
|
|
|
|
|
|
- name: check formatting
|
|
|
|
|
image: rustdocker/rust:nightly
|
|
|
|
|
- name: cargo fmt
|
|
|
|
|
image: clux/muslrust:1.67.0
|
|
|
|
|
environment:
|
|
|
|
|
# store cargo data in repo folder so that it gets cached between steps
|
|
|
|
|
CARGO_HOME: .cargo
|
|
|
|
|
commands:
|
|
|
|
|
- /root/.cargo/bin/cargo fmt -- --check
|
|
|
|
|
# need make existing toolchain available
|
|
|
|
|
- cp ~/.cargo . -r
|
|
|
|
|
- rustup toolchain install nightly
|
|
|
|
|
- rustup component add rustfmt --toolchain nightly
|
|
|
|
|
- cargo +nightly fmt -- --check
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# latest rust for clippy to get extra checks
|
|
|
|
|
# when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
|
|
|
|
|
- name: cargo clippy
|
|
|
|
|
image: rust:1.65-buster
|
|
|
|
|
image: clux/muslrust:1.67.0
|
|
|
|
|
environment:
|
|
|
|
|
CARGO_HOME: .cargo
|
|
|
|
|
commands:
|
|
|
|
|
- apt-get update
|
|
|
|
|
- apt-get install -y --no-install-recommends protobuf-compiler libprotobuf-dev
|
|
|
|
|
# latest rust for clippy to get extra checks
|
|
|
|
|
# when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
|
|
|
|
|
- rustup component add clippy
|
|
|
|
|
- cargo clippy --workspace --tests --all-targets --all-features --
|
|
|
|
|
-D warnings -D deprecated -D clippy::perf -D clippy::complexity
|
|
|
|
@ -40,45 +46,56 @@ steps:
|
|
|
|
|
-D clippy::wildcard_imports -D clippy::cast_lossless
|
|
|
|
|
-D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
|
|
|
|
|
-D clippy::unused_self
|
|
|
|
|
-A clippy::uninlined_format_args
|
|
|
|
|
- cargo clippy --workspace --all-features -- -D clippy::unwrap_used
|
|
|
|
|
|
|
|
|
|
- name: cargo test
|
|
|
|
|
image: clux/muslrust:1.64.0
|
|
|
|
|
- name: cargo check
|
|
|
|
|
image: clux/muslrust:1.67.0
|
|
|
|
|
environment:
|
|
|
|
|
CARGO_HOME: .cargo
|
|
|
|
|
commands:
|
|
|
|
|
- cargo check --package lemmy_utils
|
|
|
|
|
- cargo check --package lemmy_db_schema
|
|
|
|
|
- cargo check --package lemmy_db_views
|
|
|
|
|
- cargo check --package lemmy_db_views_actor
|
|
|
|
|
- cargo check --package lemmy_db_views_moderator
|
|
|
|
|
- cargo check --package lemmy_api_common
|
|
|
|
|
- cargo check --package lemmy_api
|
|
|
|
|
- cargo check --package lemmy_api_crud
|
|
|
|
|
- cargo check --package lemmy_apub
|
|
|
|
|
- cargo check --package lemmy_routes
|
|
|
|
|
- cargo check --workspace --no-default-features
|
|
|
|
|
- cargo check --workspace --all-features
|
|
|
|
|
|
|
|
|
|
- name: lemmy_api_common doesnt depend on diesel
|
|
|
|
|
image: clux/muslrust:1.67.0
|
|
|
|
|
environment:
|
|
|
|
|
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
|
|
|
|
LEMMY_CONFIG_LOCATION: ../../config/config.hjson
|
|
|
|
|
RUST_BACKTRACE: 1
|
|
|
|
|
RUST_TEST_THREADS: 1
|
|
|
|
|
CARGO_HOME: .cargo
|
|
|
|
|
commands:
|
|
|
|
|
- apt-get update
|
|
|
|
|
- apt-get -y install --no-install-recommends postgresql-client protobuf-compiler libprotobuf-dev
|
|
|
|
|
- cargo test --workspace --no-fail-fast --all-features
|
|
|
|
|
- "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
|
|
|
|
|
|
|
|
|
|
- name: check defaults.hjson updated
|
|
|
|
|
image: clux/muslrust:1.64.0
|
|
|
|
|
image: clux/muslrust:1.67.0
|
|
|
|
|
environment:
|
|
|
|
|
CARGO_HOME: .cargo
|
|
|
|
|
commands:
|
|
|
|
|
- export LEMMY_CONFIG_LOCATION=./config/config.hjson
|
|
|
|
|
- ./scripts/update_config_defaults.sh config/defaults_current.hjson
|
|
|
|
|
- diff config/defaults.hjson config/defaults_current.hjson
|
|
|
|
|
|
|
|
|
|
- name: check with different features
|
|
|
|
|
image: clux/muslrust:1.64.0
|
|
|
|
|
- name: cargo test
|
|
|
|
|
image: clux/muslrust:1.67.0
|
|
|
|
|
environment:
|
|
|
|
|
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
|
|
|
|
RUST_BACKTRACE: 1
|
|
|
|
|
RUST_TEST_THREADS: 1
|
|
|
|
|
CARGO_HOME: .cargo
|
|
|
|
|
commands:
|
|
|
|
|
- cargo install cargo-workspaces
|
|
|
|
|
- cargo workspaces exec cargo check --no-default-features
|
|
|
|
|
- cargo workspaces exec cargo check --all-features
|
|
|
|
|
|
|
|
|
|
- name: lemmy_api_common doesnt depend on diesel
|
|
|
|
|
image: rust:1.64-buster
|
|
|
|
|
commands:
|
|
|
|
|
- "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
|
|
|
|
|
- export LEMMY_CONFIG_LOCATION=../../config/config.hjson
|
|
|
|
|
- cargo test --workspace --no-fail-fast
|
|
|
|
|
|
|
|
|
|
- name: cargo build
|
|
|
|
|
image: clux/muslrust:1.64.0
|
|
|
|
|
image: clux/muslrust:1.67.0
|
|
|
|
|
environment:
|
|
|
|
|
CARGO_HOME: .cargo
|
|
|
|
|
commands:
|
|
|
|
@ -106,6 +123,7 @@ steps:
|
|
|
|
|
password:
|
|
|
|
|
from_secret: docker_password
|
|
|
|
|
repo: dessalines/lemmy
|
|
|
|
|
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
|
|
|
|
|
tags:
|
|
|
|
|
- dev
|
|
|
|
|
when:
|
|
|
|
@ -121,6 +139,7 @@ steps:
|
|
|
|
|
password:
|
|
|
|
|
from_secret: docker_password
|
|
|
|
|
repo: dessalines/lemmy
|
|
|
|
|
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
|
|
|
|
|
auto_tag: true
|
|
|
|
|
auto_tag_suffix: linux-amd64
|
|
|
|
|
when:
|
|
|
|
@ -163,7 +182,7 @@ steps:
|
|
|
|
|
|
|
|
|
|
# using https://github.com/pksunkara/cargo-workspaces
|
|
|
|
|
- name: publish to crates.io
|
|
|
|
|
image: rustlang/rust:nightly
|
|
|
|
|
image: clux/muslrust:1.67.0
|
|
|
|
|
environment:
|
|
|
|
|
CARGO_TOKEN:
|
|
|
|
|
from_secret: cargo_api_token
|
|
|
|
@ -176,9 +195,18 @@ steps:
|
|
|
|
|
ref:
|
|
|
|
|
- refs/tags/*
|
|
|
|
|
|
|
|
|
|
- name: Notify on failure
|
|
|
|
|
image: alpine:3
|
|
|
|
|
commands:
|
|
|
|
|
- apk add curl
|
|
|
|
|
- "curl -d'Drone build failed: ${DRONE_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
|
|
|
|
|
when:
|
|
|
|
|
status:
|
|
|
|
|
- failure
|
|
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
- name: database
|
|
|
|
|
image: postgres:14-alpine
|
|
|
|
|
image: postgres:15-alpine
|
|
|
|
|
environment:
|
|
|
|
|
POSTGRES_USER: lemmy
|
|
|
|
|
POSTGRES_PASSWORD: password
|
|
|
|
@ -197,7 +225,6 @@ steps:
|
|
|
|
|
image: rust:1.57-slim
|
|
|
|
|
user: root
|
|
|
|
|
commands:
|
|
|
|
|
- chown 1000:1000 . -R
|
|
|
|
|
- apt update
|
|
|
|
|
- apt install --no-install-recommends --yes git
|
|
|
|
|
- git fetch --tags
|
|
|
|
|