2022-08-10 23:10:39 +00:00
|
|
|
local archs = [
|
2022-08-11 07:31:55 +00:00
|
|
|
'aarch64-unknown-linux-gnu',
|
|
|
|
'aarch64-unknown-linux-musl',
|
|
|
|
'x86_64-pc-windows-gnu',
|
|
|
|
'x86_64-unknown-linux-gnu',
|
|
|
|
'x86_64-unknown-linux-musl',
|
2022-08-10 23:11:42 +00:00
|
|
|
];
|
2022-08-10 23:10:39 +00:00
|
|
|
|
2022-08-11 07:31:55 +00:00
|
|
|
local getStepName(arch) = 'check ' + arch;
|
2022-08-10 23:10:39 +00:00
|
|
|
|
2022-08-10 22:57:46 +00:00
|
|
|
local buildForArch(arch) = {
|
2022-08-11 07:31:55 +00:00
|
|
|
name: getStepName(arch),
|
2022-08-11 21:11:55 +00:00
|
|
|
image: 'img.kie.rs/jjkiers/rust-dind-cross:1.62-slim',
|
2022-08-20 22:10:07 +00:00
|
|
|
volumes: [
|
|
|
|
{
|
|
|
|
name: 'dockersock',
|
|
|
|
path: '/var/run',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'rust-toolchains',
|
|
|
|
path: '/usr/local/rustup/toolchains',
|
|
|
|
},
|
|
|
|
],
|
2022-08-11 07:31:55 +00:00
|
|
|
commands: [
|
|
|
|
'echo Hello World from Jsonnet on ' + arch + '!',
|
2022-08-11 21:43:10 +00:00
|
|
|
'cross build --release --target ' + arch,
|
2022-08-11 21:56:07 +00:00
|
|
|
'rm -rf target/' + arch + '/release/{build,deps,examples,incremental}',
|
2022-08-11 21:46:10 +00:00
|
|
|
'ls -lah target/' + arch + '/release',
|
2022-08-11 07:31:55 +00:00
|
|
|
],
|
2022-08-11 21:30:14 +00:00
|
|
|
environment: {
|
|
|
|
CROSS_REMOTE: true,
|
|
|
|
},
|
2022-08-20 22:02:39 +00:00
|
|
|
depends_on: ['wait-for-docker'],
|
2022-08-10 22:58:45 +00:00
|
|
|
};
|
2022-08-11 07:31:55 +00:00
|
|
|
|
|
|
|
local check_steps() = [
|
|
|
|
buildForArch(a)
|
|
|
|
for a in archs
|
|
|
|
];
|
|
|
|
|
2022-08-10 22:46:48 +00:00
|
|
|
{
|
2022-08-11 07:31:55 +00:00
|
|
|
kind: 'pipeline',
|
|
|
|
type: 'docker',
|
|
|
|
name: 'default',
|
|
|
|
platform: {
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps:
|
2022-08-20 18:24:12 +00:00
|
|
|
[{
|
|
|
|
name: 'wait-for-docker',
|
2022-08-20 18:25:51 +00:00
|
|
|
image: 'img.kie.rs/jjkiers/rust-dind-cross:1.62-slim',
|
2022-08-20 21:16:47 +00:00
|
|
|
commands: [
|
|
|
|
'while ! docker image ls; do sleep 1; done',
|
|
|
|
'docker info',
|
2022-08-20 21:23:48 +00:00
|
|
|
'docker pull hello-world:latest',
|
2022-08-20 21:16:47 +00:00
|
|
|
],
|
2022-08-20 18:27:22 +00:00
|
|
|
volumes: [{
|
|
|
|
name: 'dockersock',
|
|
|
|
path: '/var/run',
|
|
|
|
}],
|
2022-08-20 21:16:47 +00:00
|
|
|
}] +
|
2022-08-20 21:31:00 +00:00
|
|
|
check_steps() +
|
2022-08-11 21:11:55 +00:00
|
|
|
[
|
|
|
|
{
|
|
|
|
name: 'build',
|
2022-08-20 18:25:51 +00:00
|
|
|
image: 'img.kie.rs/jjkiers/rust-dind-cross:1.62-slim',
|
2022-08-11 21:11:55 +00:00
|
|
|
commands: [
|
|
|
|
'ls -lah target/',
|
|
|
|
],
|
2022-08-20 22:00:41 +00:00
|
|
|
depends_on: [getStepName(a) for a in archs],
|
2022-08-11 21:11:55 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
services: [{
|
|
|
|
name: 'docker',
|
|
|
|
image: 'docker:dind',
|
|
|
|
privileged: true,
|
2022-08-20 21:23:48 +00:00
|
|
|
volumes: [
|
|
|
|
{
|
|
|
|
name: 'dockersock',
|
|
|
|
path: '/var/run',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'docker-storage',
|
|
|
|
path: '/var/lib/docker',
|
|
|
|
},
|
|
|
|
],
|
2022-08-11 21:11:55 +00:00
|
|
|
}],
|
|
|
|
|
2022-08-20 21:23:48 +00:00
|
|
|
volumes: [
|
|
|
|
{
|
|
|
|
name: 'dockersock',
|
|
|
|
temp: {},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'docker-storage',
|
|
|
|
host: {
|
2022-08-20 21:57:02 +00:00
|
|
|
path: '/srv/drone/docker-dind-rust',
|
2022-08-20 21:23:48 +00:00
|
|
|
},
|
|
|
|
},
|
2022-08-20 22:10:07 +00:00
|
|
|
{
|
|
|
|
name: 'rust-toolchains',
|
|
|
|
host: {
|
|
|
|
path: '/srv/drone/rust-toolchains',
|
|
|
|
},
|
|
|
|
},
|
2022-08-20 21:23:48 +00:00
|
|
|
],
|
2022-08-11 21:30:14 +00:00
|
|
|
|
|
|
|
image_pull_secrets: ['docker_private_repo'],
|
2022-08-11 07:31:55 +00:00
|
|
|
}
|