mailspy/.drone.yml

107 lines
2.0 KiB
YAML

kind: pipeline
name: default
trigger:
event:
- push
- promote
steps:
- name: test
image: rust:latest
commands:
- mkdir -p ui/build
- touch ui/build/index.html
- rustup component add clippy
- cargo clippy
- cargo test --all
- name: build-ui
image: node:18.9.1-slim
volumes:
- name: temp
path: /app
commands:
- apt-get update
- apt-get -y install libssl-dev
- cd ui
- npm install
- npm run build
- cp -R ./build /app/ui
when:
event:
- promote
target:
- staging
- production
- name: binary-deploy
image: rust:latest
depends_on: [ build-ui, test ]
volumes:
- name: temp
path: /app
commands:
- cp -R /app/ui ./ui/build
- cargo build --release
- tar cvzf mailspy.tar.gz -C target/release mailspy
- wget https://dl.min.io/client/mc/release/linux-amd64/mc
- chmod +x mc
- ./mc alias set fivesigma https://objects.5sigma.io $MINIOID $MINIOSECRET
- ./mc cp mailspy.tar.gz fivesigma/public/mailspy.tar.gz
when:
event:
- promote
target:
- staging
- production
- name: build-musl
image: rust
depends_on: [ build-ui, test ]
volumes:
- name: temp
path: /app
commands:
- cp -R /app/ui ./ui/build
- rustup target add x86_64-unknown-linux-musl
- apt update && apt install -y musl-tools musl-dev libssl-dev
- update-ca-certificates
- cargo build --target x86_64-unknown-linux-musl --release
- mkdir /app/build
- cp target/x86_64-unknown-linux-musl/release/mailspy /app/build/mailspy
when:
event:
- promote
target:
- staging
- production
- name: stage-deploy
image: plugins/docker
privileged: true
depends_on: [ build-musl, test ]
volumes:
- name: temp
path: /app
settings:
username:
from_secret: CONTAINER_USER
password:
from_secret: CONTAINER_PASSWORD
registry: git.5sigma.io
context: /app/build
repo: git.5sigma.io/mailspy/mailspy
tags: latest
when:
event:
- promote
target:
- staging
- production
volumes:
- name: temp
temp: {}