Compare commits

...

6 Commits

Author SHA1 Message Date
8ac2c97b0b Create release after everything is built
All checks were successful
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
2022-09-07 22:43:55 +02:00
97b4d16a33 Only create release on tag or promotion
Some checks reported errors
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build was killed
Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
2022-09-07 22:38:08 +02:00
ced47d0cc7 Create release on build
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
2022-09-07 22:34:36 +02:00
2a041ae332 Small improvements
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
2022-09-07 22:19:30 +02:00
7bc8c5b967 Bring back Windows support
Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
2022-09-07 22:15:58 +02:00
6bdd545cec Remove unnecessary function buildForArch()
Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
2022-09-07 22:10:29 +02:00
3 changed files with 50 additions and 35 deletions

View File

@@ -1,41 +1,41 @@
local archs = [ local archs = [
{ target: 'aarch64-unknown-linux-gnu', short: 'arm64-gnu' }, { target: 'aarch64-unknown-linux-gnu', short: 'arm64-gnu' },
{ target: 'aarch64-unknown-linux-musl', short: 'arm64-musl' }, { target: 'aarch64-unknown-linux-musl', short: 'arm64-musl' },
// { target: 'x86_64-pc-windows-gnu', short: 'windows-amd64' }, { target: 'x86_64-pc-windows-gnu', short: 'windows-amd64' },
{ target: 'x86_64-unknown-linux-gnu', short: 'amd64-gnu' }, { target: 'x86_64-unknown-linux-gnu', short: 'amd64-gnu' },
{ target: 'x86_64-unknown-linux-musl', short: 'amd64-musl' }, { target: 'x86_64-unknown-linux-musl', short: 'amd64-musl' },
]; ];
local getStepName(arch) = 'check ' + arch.short; local getStepName(arch) = 'Build for ' + arch.short;
local buildForArch(arch) = { local getExeName(arch) = if std.startsWith(arch.short, 'windows') then '.exe' else '';
name: getStepName(arch),
image: 'img.kie.rs/jjkiers/rust-dind-cross:1.62-slim',
volumes: [
{
name: 'dockersock',
path: '/var/run',
},
{
name: 'rustup',
path: '/usr/local/rustup',
},
],
commands: [
'echo Hello World from Jsonnet on ' + arch.target + '!',
'cross build --release --target ' + arch.target,
'rm -rf target/' + arch.target + '/release/{build,deps,examples,incremental}',
'cp target/' + arch.target + '/release/drone-test artifacts/drone-test-' + arch.short,
],
environment: {
CROSS_REMOTE: true,
},
depends_on: ['wait-for-docker'],
};
local check_steps() = [ local add_build_steps() = [
buildForArch(a) {
for a in archs name: getStepName(arch),
image: 'img.kie.rs/jjkiers/rust-dind-cross:1.62-slim',
volumes: [
{
name: 'dockersock',
path: '/var/run',
},
{
name: 'rustup',
path: '/usr/local/rustup',
},
],
commands: [
'echo Hello World from Jsonnet on ' + arch.target + '!',
'cross build --release --target ' + arch.target,
'cp target/' + arch.target + '/release/drone-test' + getExeName(arch) + ' artifacts/drone-test-' + arch.short + getExeName(arch),
'rm -rf target/' + arch.target + '/release/*',
],
environment: {
CROSS_REMOTE: true,
},
depends_on: ['Wait for Docker'],
}
for arch in archs
]; ];
{ {
@@ -47,7 +47,7 @@ local check_steps() = [
}, },
steps: steps:
[{ [{
name: 'wait-for-docker', name: 'Wait for Docker',
image: 'img.kie.rs/jjkiers/rust-dind-cross:1.62-slim', image: 'img.kie.rs/jjkiers/rust-dind-cross:1.62-slim',
commands: [ commands: [
'while ! docker image ls; do sleep 1; done', 'while ! docker image ls; do sleep 1; done',
@@ -60,17 +60,32 @@ local check_steps() = [
path: '/var/run', path: '/var/run',
}], }],
}] + }] +
check_steps() + add_build_steps() +
[ [
{ {
name: 'build', name: 'Show built artifacts',
image: 'img.kie.rs/jjkiers/rust-dind-cross:1.62-slim', image: 'img.kie.rs/jjkiers/rust-dind-cross:1.62-slim',
commands: [ commands: [
'ls -lah target/',
'ls -lah artifacts', 'ls -lah artifacts',
], ],
depends_on: [getStepName(a) for a in archs], depends_on: [getStepName(a) for a in archs],
}, },
{
name: 'Create release on gitea',
image: 'plugins/gitea-release',
settings: {
api_key: {
from_secret: 'gitea_token',
},
base_url: 'https://code.kiers.eu',
files: 'artifacts/*',
checksum: 'sha256',
},
when: {
event: ['tag', 'promote'],
},
depends_on: ['Show built artifacts'],
},
], ],
services: [{ services: [{

2
Cargo.lock generated
View File

@@ -4,4 +4,4 @@ version = 3
[[package]] [[package]]
name = "drone-test" name = "drone-test"
version = "0.1.0" version = "0.1.1"

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "drone-test" name = "drone-test"
version = "0.1.0" version = "0.1.1"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html