Add drone build configuration

This commit is contained in:
Harald Kube 2021-03-08 00:25:14 +01:00
parent 4cdf27a949
commit 47c1427fb3
4 changed files with 62 additions and 1 deletions

View file

@ -1,2 +1,3 @@
[target.armv7-unknown-linux-musleabihf] [target.armv7-unknown-linux-musleabihf]
linker = "/usr/local/Cellar/arm-linux-gnueabihf-binutils/2.36.1/bin/arm-linux-gnueabihf-ld" #linker = "/usr/local/Cellar/arm-linux-gnueabihf-binutils/2.36.1/bin/arm-linux-gnueabihf-ld"
linker = "/usr/bin/arm-linux-gnueabihf-ld"

19
.drone.yml Normal file
View file

@ -0,0 +1,19 @@
kind: pipeline
type: exec
name: toolchain
steps:
- name: build
commands:
- docker build -t drone_rust:1.50-musl .
---
kind: pipeline
type: docker
name: s0_meter
steps:
- name: checkout
image: drone_rust:1.50-musl
commands:
- cargo build --release --target=armv7-unknown-linux-musleabihf --features="rppal"

14
Dockerfile Normal file
View file

@ -0,0 +1,14 @@
FROM rust:1.50-slim
# RUN apk add --no-cache musl-dev binutils-arm-none-eabi
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install binutils-arm-linux-gnueabihf musl-dev
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*
RUN rustup target add armv7-unknown-linux-musleabihf
#WORKDIR /usr/src/s0_meter
#COPY . .
#RUN cargo test

27
build_with_docker.sh Executable file
View file

@ -0,0 +1,27 @@
#/bin/bash
WORK_DIR=/usr/src/s0_meter
RUST_VERSION=1.50
RUST_IMG_FLAVOR=musl
# docker run \
# --rm \
# --user "$(id -u):$(id -g)" \
# -v "$PWD":"$WORK_DIR" \
# -w "$WORK_DIR" \
# drone_rust:$RUST_VERSION-$RUST_IMG_FLAVOR \
# /bin/sh -c "echo Build: ; cargo build && echo Test: ; cargo test"
docker run \
--rm \
--user "$(id -u):$(id -g)" \
-v "$PWD":"$WORK_DIR" \
-w "$WORK_DIR" \
drone_rust:$RUST_VERSION-$RUST_IMG_FLAVOR \
cargo build --release --target=armv7-unknown-linux-musleabihf --features="rppal"
exit
# rust:$RUST_VERSION-$RUST_IMG_FLAVOR \