2020-12-22 12:13:51 +00:00
|
|
|
---
|
2020-12-08 20:13:53 +00:00
|
|
|
kind: pipeline
|
2020-12-22 12:13:51 +00:00
|
|
|
name: amd64
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
2020-12-08 20:13:53 +00:00
|
|
|
|
|
|
|
steps:
|
2021-01-25 03:44:35 +00:00
|
|
|
|
2022-06-28 21:44:55 +00:00
|
|
|
# use minimum supported rust version for most steps
|
2021-04-26 13:30:30 +00:00
|
|
|
- name: prepare repo
|
2023-01-30 19:17:24 +00:00
|
|
|
image: alpine:3
|
2020-12-10 19:45:14 +00:00
|
|
|
commands:
|
2023-01-30 19:17:24 +00:00
|
|
|
- apk add git
|
2021-04-26 13:30:30 +00:00
|
|
|
- git fetch --tags
|
2022-03-24 15:25:51 +00:00
|
|
|
- git submodule init
|
|
|
|
- git submodule update --recursive --remote
|
2020-12-10 19:45:14 +00:00
|
|
|
|
2023-01-30 19:17:24 +00:00
|
|
|
- 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
|
2020-12-11 13:57:43 +00:00
|
|
|
commands:
|
2023-01-30 19:17:24 +00:00
|
|
|
# need make existing toolchain available
|
|
|
|
- cp ~/.cargo . -r
|
|
|
|
- rustup toolchain install nightly
|
|
|
|
- rustup component add rustfmt --toolchain nightly
|
|
|
|
- cargo +nightly fmt -- --check
|
|
|
|
|
2020-12-11 13:57:43 +00:00
|
|
|
|
2020-12-10 12:00:31 +00:00
|
|
|
- name: cargo clippy
|
2023-01-30 19:17:24 +00:00
|
|
|
image: clux/muslrust:1.67.0
|
2022-11-25 04:43:31 +00:00
|
|
|
environment:
|
|
|
|
CARGO_HOME: .cargo
|
2020-12-10 12:00:31 +00:00
|
|
|
commands:
|
2023-01-30 19:17:24 +00:00
|
|
|
# latest rust for clippy to get extra checks
|
|
|
|
# when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
|
2021-11-09 22:16:59 +00:00
|
|
|
- rustup component add clippy
|
2022-11-19 04:33:54 +00:00
|
|
|
- cargo clippy --workspace --tests --all-targets --all-features --
|
|
|
|
-D warnings -D deprecated -D clippy::perf -D clippy::complexity
|
2022-11-24 16:38:00 +00:00
|
|
|
-D clippy::style -D clippy::correctness -D clippy::suspicious
|
2022-11-19 04:33:54 +00:00
|
|
|
-D clippy::dbg_macro -D clippy::inefficient_to_string
|
|
|
|
-D clippy::items-after-statements -D clippy::implicit_clone
|
|
|
|
-D clippy::wildcard_imports -D clippy::cast_lossless
|
2022-11-24 16:38:00 +00:00
|
|
|
-D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
|
|
|
|
-D clippy::unused_self
|
2023-01-30 19:17:24 +00:00
|
|
|
-A clippy::uninlined_format_args
|
2022-07-05 21:41:22 +00:00
|
|
|
- cargo clippy --workspace --all-features -- -D clippy::unwrap_used
|
2020-12-10 12:00:31 +00:00
|
|
|
|
2023-01-30 19:17:24 +00:00
|
|
|
- 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
|
2020-12-09 22:58:50 +00:00
|
|
|
environment:
|
2022-11-25 04:43:31 +00:00
|
|
|
CARGO_HOME: .cargo
|
2020-12-08 20:13:53 +00:00
|
|
|
commands:
|
2023-01-30 19:17:24 +00:00
|
|
|
- "! cargo tree -p lemmy_api_common --no-default-features -i diesel"
|
2020-12-10 12:24:16 +00:00
|
|
|
|
2021-10-22 17:29:47 +00:00
|
|
|
- name: check defaults.hjson updated
|
2023-01-30 19:17:24 +00:00
|
|
|
image: clux/muslrust:1.67.0
|
2022-11-25 04:43:31 +00:00
|
|
|
environment:
|
|
|
|
CARGO_HOME: .cargo
|
2020-12-10 16:46:36 +00:00
|
|
|
commands:
|
2023-01-30 19:17:24 +00:00
|
|
|
- export LEMMY_CONFIG_LOCATION=./config/config.hjson
|
2021-10-22 17:29:47 +00:00
|
|
|
- ./scripts/update_config_defaults.sh config/defaults_current.hjson
|
|
|
|
- diff config/defaults.hjson config/defaults_current.hjson
|
2020-12-10 16:46:36 +00:00
|
|
|
|
2023-01-30 19:17:24 +00:00
|
|
|
- name: cargo test
|
|
|
|
image: clux/muslrust:1.67.0
|
2022-11-25 04:43:31 +00:00
|
|
|
environment:
|
2023-01-30 19:17:24 +00:00
|
|
|
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
|
|
|
RUST_BACKTRACE: 1
|
|
|
|
RUST_TEST_THREADS: 1
|
2022-11-25 04:43:31 +00:00
|
|
|
CARGO_HOME: .cargo
|
2022-06-06 12:09:43 +00:00
|
|
|
commands:
|
2023-01-30 19:17:24 +00:00
|
|
|
- export LEMMY_CONFIG_LOCATION=../../config/config.hjson
|
|
|
|
- cargo test --workspace --no-fail-fast
|
2022-11-17 15:23:01 +00:00
|
|
|
|
2021-10-22 17:29:47 +00:00
|
|
|
- name: cargo build
|
2023-01-30 19:17:24 +00:00
|
|
|
image: clux/muslrust:1.67.0
|
2022-11-25 04:43:31 +00:00
|
|
|
environment:
|
|
|
|
CARGO_HOME: .cargo
|
2021-10-21 16:57:09 +00:00
|
|
|
commands:
|
2021-10-22 17:29:47 +00:00
|
|
|
- cargo build
|
|
|
|
- mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
|
2021-10-21 16:57:09 +00:00
|
|
|
|
2020-12-10 16:46:36 +00:00
|
|
|
- name: run federation tests
|
2021-08-25 21:26:10 +00:00
|
|
|
image: node:alpine
|
2020-12-11 17:09:47 +00:00
|
|
|
environment:
|
2020-12-15 13:58:11 +00:00
|
|
|
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
|
|
|
|
DO_WRITE_HOSTS_FILE: 1
|
2020-12-09 21:43:32 +00:00
|
|
|
commands:
|
2020-12-18 02:10:20 +00:00
|
|
|
- apk add bash curl postgresql-client
|
2020-12-10 20:36:50 +00:00
|
|
|
- bash api_tests/prepare-drone-federation-test.sh
|
2020-12-10 20:14:05 +00:00
|
|
|
- cd api_tests/
|
2020-12-09 21:43:32 +00:00
|
|
|
- yarn
|
|
|
|
- yarn api-test
|
2020-12-10 16:20:44 +00:00
|
|
|
|
2022-05-19 20:30:16 +00:00
|
|
|
- name: nightly build
|
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
2022-11-24 13:33:58 +00:00
|
|
|
dockerfile: docker/prod/Dockerfile
|
2022-11-23 20:25:24 +00:00
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
|
|
|
repo: dessalines/lemmy
|
2023-01-30 19:17:24 +00:00
|
|
|
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
|
2022-11-23 20:25:24 +00:00
|
|
|
tags:
|
|
|
|
- dev
|
|
|
|
when:
|
|
|
|
event:
|
|
|
|
- cron
|
2022-05-19 20:30:16 +00:00
|
|
|
|
2021-04-08 14:33:58 +00:00
|
|
|
- name: publish release docker image
|
2020-12-09 22:58:50 +00:00
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
|
|
|
dockerfile: docker/prod/Dockerfile
|
2020-12-14 16:01:40 +00:00
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
2020-12-09 22:58:50 +00:00
|
|
|
repo: dessalines/lemmy
|
2023-01-30 19:17:24 +00:00
|
|
|
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
|
2021-01-13 00:26:32 +00:00
|
|
|
auto_tag: true
|
2021-01-25 03:44:35 +00:00
|
|
|
auto_tag_suffix: linux-amd64
|
|
|
|
when:
|
|
|
|
ref:
|
2021-04-08 14:33:58 +00:00
|
|
|
- refs/tags/*
|
2021-01-25 03:44:35 +00:00
|
|
|
|
2021-04-08 14:33:58 +00:00
|
|
|
- name: publish release docker manifest
|
2021-01-25 03:44:35 +00:00
|
|
|
image: plugins/manifest
|
2021-11-26 12:38:55 +00:00
|
|
|
settings:
|
2021-01-25 03:44:35 +00:00
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
|
|
|
target: "dessalines/lemmy:${DRONE_TAG}"
|
|
|
|
template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
|
|
|
|
platforms:
|
|
|
|
- linux/amd64
|
|
|
|
- linux/arm64
|
|
|
|
ignore_missing: true
|
2020-12-10 16:20:44 +00:00
|
|
|
when:
|
|
|
|
ref:
|
2021-04-08 14:33:58 +00:00
|
|
|
- refs/tags/*
|
2020-12-10 12:21:34 +00:00
|
|
|
|
2021-11-26 12:38:55 +00:00
|
|
|
- name: publish latest release docker manifest
|
|
|
|
image: plugins/manifest
|
|
|
|
settings:
|
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
|
|
|
target: "dessalines/lemmy:latest"
|
|
|
|
template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
|
|
|
|
platforms:
|
|
|
|
- linux/amd64
|
|
|
|
- linux/arm64
|
|
|
|
ignore_missing: true
|
|
|
|
when:
|
|
|
|
ref:
|
|
|
|
- refs/tags/*
|
|
|
|
|
2021-08-09 15:37:06 +00:00
|
|
|
# using https://github.com/pksunkara/cargo-workspaces
|
|
|
|
- name: publish to crates.io
|
2023-01-30 19:17:24 +00:00
|
|
|
image: clux/muslrust:1.67.0
|
2021-08-25 21:26:10 +00:00
|
|
|
environment:
|
|
|
|
CARGO_TOKEN:
|
|
|
|
from_secret: cargo_api_token
|
2021-08-09 15:37:06 +00:00
|
|
|
commands:
|
|
|
|
- cargo install cargo-workspaces
|
2021-10-21 17:26:01 +00:00
|
|
|
- cp -r migrations crates/db_schema/
|
2021-08-25 21:26:10 +00:00
|
|
|
- cargo login "$CARGO_TOKEN"
|
|
|
|
- cargo workspaces publish --from-git --allow-dirty --allow-branch "${DRONE_TAG}" --yes custom "${DRONE_TAG}"
|
2021-08-09 15:37:06 +00:00
|
|
|
when:
|
|
|
|
ref:
|
|
|
|
- refs/tags/*
|
|
|
|
|
2023-01-30 19:17:24 +00:00
|
|
|
- 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
|
|
|
|
|
2020-12-10 12:47:46 +00:00
|
|
|
services:
|
|
|
|
- name: database
|
2023-01-30 19:17:24 +00:00
|
|
|
image: postgres:15-alpine
|
2020-12-10 12:47:46 +00:00
|
|
|
environment:
|
|
|
|
POSTGRES_USER: lemmy
|
|
|
|
POSTGRES_PASSWORD: password
|
2020-12-14 16:01:40 +00:00
|
|
|
|
2020-12-22 12:13:51 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
name: arm64
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: arm64
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
2021-04-26 13:30:30 +00:00
|
|
|
- name: prepare repo
|
2022-06-28 21:44:55 +00:00
|
|
|
image: rust:1.57-slim
|
2021-04-26 13:30:30 +00:00
|
|
|
user: root
|
|
|
|
commands:
|
|
|
|
- apt update
|
|
|
|
- apt install --no-install-recommends --yes git
|
|
|
|
- git fetch --tags
|
2022-03-29 18:05:18 +00:00
|
|
|
- git submodule init
|
|
|
|
- git submodule update --recursive --remote
|
2021-04-26 13:30:30 +00:00
|
|
|
|
2021-11-11 19:49:48 +00:00
|
|
|
# TODO temporarily disable arm tests
|
|
|
|
# - name: cargo test
|
2022-06-28 21:44:55 +00:00
|
|
|
# image: rust:1.57-slim
|
2021-11-11 19:49:48 +00:00
|
|
|
# environment:
|
|
|
|
# LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
|
|
|
# LEMMY_CONFIG_LOCATION: ../../config/config.hjson
|
|
|
|
# RUST_BACKTRACE: 1
|
|
|
|
# RUST_TEST_THREADS: 1
|
|
|
|
# commands:
|
|
|
|
# - apt-get update
|
|
|
|
# - apt-get -y install --no-install-recommends postgresql-client libssl-dev pkg-config libpq-dev
|
|
|
|
# - cargo test --workspace --no-fail-fast
|
|
|
|
# - cargo build
|
|
|
|
|
|
|
|
# TODO temporarily disable arm tests
|
2020-12-22 12:13:51 +00:00
|
|
|
# Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
|
2021-11-11 19:49:48 +00:00
|
|
|
# - name: cargo build
|
2022-06-28 21:44:55 +00:00
|
|
|
# image: rust:1.57-slim
|
2021-11-11 19:49:48 +00:00
|
|
|
# commands:
|
|
|
|
# - apt-get update
|
|
|
|
# - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
|
|
|
|
# - cargo build
|
|
|
|
# - mv target/debug/lemmy_server target/lemmy_server
|
|
|
|
|
|
|
|
# TODO temporarily disable arm tests
|
|
|
|
# - name: run federation tests
|
|
|
|
# image: node:16-slim
|
|
|
|
# environment:
|
|
|
|
# LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
|
|
|
|
# DO_WRITE_HOSTS_FILE: 1
|
|
|
|
# commands:
|
|
|
|
# - mkdir -p /usr/share/man/man1 /usr/share/man/man7
|
|
|
|
# - apt-get update
|
|
|
|
# - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
|
|
|
|
# - bash api_tests/prepare-drone-federation-test.sh
|
|
|
|
# - cd api_tests/
|
|
|
|
# - yarn
|
|
|
|
# - yarn api-test
|
2020-12-22 12:13:51 +00:00
|
|
|
|
2021-04-08 14:33:58 +00:00
|
|
|
- name: publish release docker image
|
2020-12-22 12:13:51 +00:00
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
|
|
|
dockerfile: docker/prod/Dockerfile.arm
|
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
|
|
|
repo: dessalines/lemmy
|
2021-01-15 17:28:49 +00:00
|
|
|
auto_tag: true
|
2021-01-25 03:44:35 +00:00
|
|
|
auto_tag_suffix: linux-arm64
|
2020-12-22 12:13:51 +00:00
|
|
|
when:
|
|
|
|
ref:
|
|
|
|
- refs/tags/*
|
|
|
|
|
2021-04-08 14:33:58 +00:00
|
|
|
- name: publish release docker manifest
|
2021-01-25 03:44:35 +00:00
|
|
|
image: plugins/manifest
|
2021-11-26 12:38:55 +00:00
|
|
|
settings:
|
2021-01-25 03:44:35 +00:00
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
|
|
|
target: "dessalines/lemmy:${DRONE_TAG}"
|
|
|
|
template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
|
|
|
|
platforms:
|
|
|
|
- linux/amd64
|
|
|
|
- linux/arm64
|
|
|
|
ignore_missing: true
|
|
|
|
when:
|
|
|
|
ref:
|
2021-04-08 14:33:58 +00:00
|
|
|
- refs/tags/*
|
2021-01-25 03:44:35 +00:00
|
|
|
|
2021-11-26 12:38:55 +00:00
|
|
|
- name: publish latest release docker manifest
|
|
|
|
image: plugins/manifest
|
|
|
|
settings:
|
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
|
|
|
target: "dessalines/lemmy:latest"
|
|
|
|
template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
|
|
|
|
platforms:
|
|
|
|
- linux/amd64
|
|
|
|
- linux/arm64
|
|
|
|
ignore_missing: true
|
|
|
|
when:
|
|
|
|
ref:
|
|
|
|
- refs/tags/*
|
|
|
|
|
2021-11-11 19:49:48 +00:00
|
|
|
# TODO temporarily disable arm tests
|
|
|
|
# services:
|
|
|
|
# - name: database
|
|
|
|
# image: postgres:12-alpine
|
|
|
|
# environment:
|
|
|
|
# POSTGRES_USER: lemmy
|
|
|
|
# POSTGRES_PASSWORD: password
|