adds cross-compiling
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Signed-off-by: Jochen maes <jochen@sejo-it.be>
This commit is contained in:
parent
8aa18b22b5
commit
a29153ab3c
146
.drone.yml
146
.drone.yml
@ -1,44 +1,124 @@
|
|||||||
---
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: mouse-amd64
|
name: 'Rust cross compilation'
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
arch: amd64
|
arch: amd64
|
||||||
|
|
||||||
|
# Shared volume for the Docker in Docker service and build steps.
|
||||||
|
# Without this, cross won't be able to find a running Docker agent.
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
temp: {}
|
||||||
|
|
||||||
|
services:
|
||||||
|
- image: docker:dind
|
||||||
|
name: docker
|
||||||
|
privileged: true # Docker in Docker requires this, sadly.
|
||||||
|
pull: true
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
# Ensure Docker agent has started before continuing.
|
||||||
steps:
|
steps:
|
||||||
- name: test
|
- name: Wait for Docker
|
||||||
image: rust:1.73
|
image: rust-dind-cross:1.73-full
|
||||||
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- cargo test
|
- mkdir artifacts
|
||||||
- name: compile
|
- while ! docker image ls; do sleep 1; done
|
||||||
image: rust:1.73
|
- docker info
|
||||||
commands:
|
- docker pull hello-world:latest
|
||||||
- cargo build --target x86_64-unknown-linux-gnu
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
# Build for aarch64-unknown-linux-gnu (arm64)
|
||||||
---
|
- name: Build for arm64-gnu
|
||||||
kind: pipeline
|
image: rust-dind-cross:1.73-full
|
||||||
type: docker
|
pull: true
|
||||||
name: mouse-arm64
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: arm64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: test
|
|
||||||
image: rust:1.73
|
|
||||||
commands:
|
|
||||||
- cargo test
|
|
||||||
- name: compile
|
|
||||||
image: rust:1.73
|
|
||||||
commands:
|
|
||||||
- cargo build --target aarch64-unknown-linux-gnu
|
|
||||||
- name: publish crate
|
|
||||||
image: rust:1.73
|
|
||||||
environment:
|
environment:
|
||||||
TOKEN:
|
CROSS_REMOTE: true
|
||||||
from_secret: gitea_token
|
|
||||||
commands:
|
commands:
|
||||||
- cargo publish --registry gita --token $TOKEN
|
- cross build --release --target aarch64-unknown-linux-gnu
|
||||||
|
- cp target/aarch64-unknown-linux-gnu/release/mouse artifacts/mouse-arm64-gnu
|
||||||
|
- rm -rf target/aarch64-unknown-linux-gnu/release/*
|
||||||
|
depends_on:
|
||||||
|
- Wait for Docker
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
# Build for aarch64-unknown-linux-musl (arm64 with Alpine linux)
|
||||||
|
- name: Build for arm64-musl
|
||||||
|
image: rust-dind-cross:1.73-full
|
||||||
|
pull: true
|
||||||
|
environment:
|
||||||
|
CROSS_REMOTE: true
|
||||||
|
commands:
|
||||||
|
- cross build --release --target aarch64-unknown-linux-musl
|
||||||
|
- cp target/aarch64-unknown-linux-musl/release/mouse artifacts/mouse-arm64-musl
|
||||||
|
- rm -rf target/aarch64-unknown-linux-musl/release/*
|
||||||
|
depends_on:
|
||||||
|
- Wait for Docker
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
# Build for x86_64-unknown-linux-gnu (amd64)
|
||||||
|
- name: Build for amd64-gnu
|
||||||
|
image: rust-dind-cross:1.73-full
|
||||||
|
pull: true
|
||||||
|
environment:
|
||||||
|
CROSS_REMOTE: true
|
||||||
|
commands:
|
||||||
|
- cross build --release --target x86_64-unknown-linux-gnu
|
||||||
|
- cp target/x86_64-unknown-linux-gnu/release/mouse artifacts/mouse-amd64-gnu
|
||||||
|
- rm -rf target/x86_64-unknown-linux-gnu/release/*
|
||||||
|
depends_on:
|
||||||
|
- Wait for Docker
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
# Build for x86_64-unknown-linux-musl (amd64 with Alpine linux)
|
||||||
|
- name: Build for amd64-musl
|
||||||
|
image: rust-dind-cross:1.73-full
|
||||||
|
pull: true
|
||||||
|
environment:
|
||||||
|
CROSS_REMOTE: true
|
||||||
|
commands:
|
||||||
|
- cross build --release --target x86_64-unknown-linux-musl
|
||||||
|
- cp target/x86_64-unknown-linux-musl/release/mouse artifacts/mouse-amd64-musl
|
||||||
|
- rm -rf target/x86_64-unknown-linux-musl/release/*
|
||||||
|
depends_on:
|
||||||
|
- Wait for Docker
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
# Show all built artifacts
|
||||||
|
- name: Show built artifacts
|
||||||
|
image: rust-dind-cross:1.73-full
|
||||||
|
commands:
|
||||||
|
- ls -lah artifacts
|
||||||
|
depends_on:
|
||||||
|
- Build for arm64-gnu
|
||||||
|
- Build for arm64-musl
|
||||||
|
- Build for amd64-gnu
|
||||||
|
- Build for amd64-musl
|
||||||
|
|
||||||
|
# When a tag is created, this step gets added.
|
||||||
|
- name: Create release on gitea
|
||||||
|
image: plugins/gitea-release
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: gitea_token
|
||||||
|
base_url: https://gitea.sejo-it.be
|
||||||
|
checksum: sha256
|
||||||
|
files: artifacts/*
|
||||||
|
depends_on:
|
||||||
|
- Show built artifacts
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
Loading…
Reference in New Issue
Block a user