149 lines
3.3 KiB
YAML
149 lines
3.3 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
|
|
DEBIAN_FRONTEND: noninteractive
|
|
CARGO_HOME: *cargo_home
|
|
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: gcc
|
|
RUSTFLAGS: -C link-arg=-fuse-ld=bfd -C target-cpu=native
|
|
|
|
kind: pipeline
|
|
type: docker
|
|
name: rust
|
|
|
|
# share cargo cache between steps
|
|
workspace:
|
|
path: /drone/src
|
|
|
|
steps:
|
|
- name: prepare
|
|
image: *rust_image
|
|
pull: always
|
|
|
|
environment:
|
|
<<: *cargo_env
|
|
HOST:
|
|
from_secret: host_production
|
|
|
|
commands:
|
|
- 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:
|
|
- apt-get -qq update
|
|
- apt-get -qq install -y --no-install-recommends make
|
|
- 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:
|
|
- cron
|
|
- push
|
|
|
|
---
|
|
|
|
global-variables:
|
|
rust_image: &rust_image rustlang/rust:nightly-bullseye-slim
|
|
cargo_home: &cargo_home /drone/src
|
|
environment: &cargo_env
|
|
DEBIAN_FRONTEND: noninteractive
|
|
CARGO_HOME: *cargo_home
|
|
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: gcc
|
|
RUSTFLAGS: -C link-arg=-fuse-ld=bfd -C target-cpu=native
|
|
|
|
kind: pipeline
|
|
type: docker
|
|
name: deploy
|
|
|
|
steps:
|
|
- name: build
|
|
image: *rust_image
|
|
|
|
environment:
|
|
<<: *cargo_env
|
|
|
|
commands:
|
|
- 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:
|
|
from_secret: ssh_port_production
|
|
command_timeout: 1m
|
|
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:
|
|
from_secret: ssh_port_production
|
|
command_timeout: 1m
|
|
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
|