43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: build-check-deploy
|
|
|
|
platform:
|
|
os: "linux"
|
|
arch: "arm"
|
|
|
|
steps:
|
|
# Fetch deps and check the code
|
|
- name: "validate"
|
|
image: "rust:1.49"
|
|
volumes:
|
|
- name: "cache"
|
|
path: "./target"
|
|
commands:
|
|
- "apt-get update && apt-get install -yqq musl-tools"
|
|
- "rustup target add armv7-unknown-linux-musleabihf"
|
|
- "CC=musl-gcc cargo check --release --target=armv7-unknown-linux-musleabihf"
|
|
- "CC=musl-gcc cargo test --release --target=armv7-unknown-linux-musleabihf"
|
|
- "CC=musl-gcc cargo build --release --target=armv7-unknown-linux-musleabihf"
|
|
# Deploy it somewhere.
|
|
- name: "deploy"
|
|
image: "rust:1.49"
|
|
depends_on:
|
|
- "validate"
|
|
environment:
|
|
SSH_PRIVATE_KEY:
|
|
from_secret: SSH_PRIVATE_KEY
|
|
SSH_PARAMS: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/tmp/known_hosts'
|
|
TARGET_DIR: "./.target/armv7-unknown-linux-musleabihf/release"
|
|
commands:
|
|
# Start the SSH Agent and insert ssh private key.
|
|
- "eval $(ssh-agent -s)"
|
|
- "echo '${SSH_PRIVATE_KEY}' | tr -d '\r' | ssh-add -"
|
|
# Copy the binary file to it.
|
|
- "scp ${SSH_PARAMS} ${TARGET_DIR}/alterego ${SSH_USER}@${SSH_HOST}:/home/pi/alterego"
|
|
|
|
volumes:
|
|
- name: "cache"
|
|
temp: {}
|