tcpasters/.drone.yml
Thorsten Schubert 94b7750c0a
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is failing
Implement nudity filter
2022-04-23 21:28:01 +00:00

141 lines
No EOL
3.1 KiB
YAML

# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright © 2022 Thorsten Schubert <tschubert@bafh.org>
global-variables:
rust_image: &rust_image rustlang/rust:nightly-bullseye-slim
cargo_home: &cargo_home /drone/src
environment: &cargo_env
CARGO_HOME: *cargo_home
kind: pipeline
type: docker
name: rust
# share cargo cache between steps
workspace:
path: /drone/src
steps:
- name: prepare
image: *rust_image
environment:
<<: *cargo_env
HOST:
from_secret: host_production
commands:
- rm --force --recursive -- .cargo
- cargo -V && rustc +nightly -V && rustc +nightly -Z unstable-options --print target-spec-json
- sleep 1s
- name: build
image: *rust_image
environment:
<<: *cargo_env
commands:
- cargo -vv --color never build --workspace
- name: test
image: *rust_image
environment:
<<: *cargo_env
commands:
- cargo --color never test --workspace
- name: clippy
image: *rust_image
environment:
<<: *cargo_env
commands:
- cargo --color never clippy --workspace --package tcpaste
trigger:
branch:
- main
event:
- push
---
global-variables:
rust_image: &rust_image rustlang/rust:nightly-bullseye-slim
cargo_home: &cargo_home /drone/src
environment: &cargo_env
CARGO_HOME: *cargo_home
kind: pipeline
type: docker
name: deploy
steps:
- name: build
image: *rust_image
environment:
<<: *cargo_env
DEBIAN_FRONTEND: noninteractive
commands:
# lld non-default linker
- sed --in-place --regexp-extended 's#(link-arg=-fuse-ld=)[^[:space:]]*(".*]$)#\\\1lld\\\2#ig' .cargo/config.toml
- apt-get update && apt-get install -y --no-install-recommends lld clang
# necessary for manual std compilation
- rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
- cargo -vv --color never build --workspace -Z build-std=panic_abort,core,std,alloc,proc_macro -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu --release
- name: remote
image: appleboy/drone-scp
settings:
host:
from_secret: host_production
username:
from_secret: user_production
port: 22
command_timeout: 2m
key:
from_secret: ssh_key_production
target: /tmp
source:
- /drone/src/target/x86_64-unknown-linux-gnu/release/tcp-erased
- /drone/src/target/x86_64-unknown-linux-gnu/release/tcp-expire
- /drone/src/target/x86_64-unknown-linux-gnu/release/tcp-filter-cli
- /drone/src/target/x86_64-unknown-linux-gnu/release/tcp-filter-hasher
- /drone/src/target/x86_64-unknown-linux-gnu/release/tcp-filter-nude
- /drone/src/target/x86_64-unknown-linux-gnu/release/tcp-pasted
- name: inotify
image: appleboy/drone-ssh
environment:
USER_PRODUCTION:
from_secret: user_production
settings:
host:
from_secret: host_production
username:
from_secret: user_production
port: 22
command_timeout: 2m
script_stop: true
key:
from_secret: ssh_key_production
envs:
- USER_PRODUCTION
script:
# trigger systemd.path unit
- touch /home/$USER_PRODUCTION/tmp/done
trigger:
event:
- promote
target:
- production