ci: add .drone.starlark
All checks were successful
continuous-integration/drone/push Build is passing

also add build status badge to README.md
This commit is contained in:
surtur 2022-05-04 16:37:08 +02:00
parent 938f8189cb
commit 226f181e6d
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 306 additions and 0 deletions

305
.drone.starlark Normal file
View File

@ -0,0 +1,305 @@
# vim: ft=bzl.starlark noexpandtab tw=4 ts=4
def main(ctx):
return [
{
"kind": "pipeline",
"type": "docker",
"name": "nix",
"node": {
"r": "w"
},
"steps": [
{
"name": "pull nix",
"image": "docker.io/nixos/nix:2.8.0-amd64",
"pull": "always",
"depends_on": ["clone"],
"volumes": [
{
"name": "nix",
"path": "/nix"
}
],
"commands": [
"uname -r",
"nix --version"
]
},
{
"name": "enable flakes",
"image": "docker.io/nixos/nix:2.8.0-amd64",
"pull": "if-not-exists",
"depends_on": ["pull nix"],
"volumes": [
{
"name": "nix",
"path": "/nix"
},
{
"name": "nixconf",
"path": "/etc/nix"
}
],
"commands": [
"cat /etc/nix/nix.conf",
"echo 'experimental-features = nix-command flakes' >> /etc/nix/nix.conf",
"cat /etc/nix/nix.conf"
]
},
{
"name": "enable sandbox",
"image": "docker.io/library/busybox",
"pull": "always",
"depends_on": ["enable flakes"],
"volumes": [
{
"name": "nix",
"path": "/nix"
},
{
"name": "nixconf",
"path": "/etc/nix"
}
],
"commands": [
"cat /etc/nix/nix.conf",
"sed -i 's/^sandbox = false/sandbox = true/' /etc/nix/nix.conf",
"cat /etc/nix/nix.conf"
]
},
{
"name": "nixpkgs-fmt",
"image": "docker.io/nixos/nix:2.8.0-amd64",
"pull": "if-not-exists",
"depends_on": ["pull nix"],
"volumes": [
{
"name": "nix",
"path": "/nix"
}
],
"commands": [
"nix-env -iA nixpkgs.nixpkgs-fmt",
"nixpkgs-fmt --check . || (echo 'run `nixpkgs-fmt .` to fix it' && exit 1)"
]
},
{
"name": "statix",
"image": "docker.io/nixos/nix:2.8.0-amd64",
"pull": "if-not-exists",
"depends_on": ["enable sandbox"],
"volumes": [
{
"name": "nixconf",
"path": "/etc/nix"
}
],
"commands": [
"nix-channel --update && nix-env -iA nixpkgs.statix",
"statix --version",
"statix check ."
]
},
{
"name": "nix flake check",
"image": "docker.io/nixos/nix:2.8.0-amd64",
"pull": "if-not-exists",
# "depends_on": ["nixpkgs-fmt", "statix"],
"depends_on": ["nixpkgs-fmt"],
"volumes": [
{
"name": "nixconf",
"path": "/etc/nix"
}
],
"commands": [
"cat /etc/nix/nix.conf",
"NIXPKGS_ALLOW_BROKEN=1 nix flake check --impure"
]
},
{
"name": "nix flake show",
"image": "docker.io/nixos/nix:2.8.0-amd64",
"pull": "if-not-exists",
"depends_on": ["nix flake check"],
"volumes": [
{
"name": "nixconf",
"path": "/etc/nix"
}
],
"commands": [
"nix flake show"
]
},
{
"name": "nix flake metadata",
"image": "docker.io/nixos/nix:2.8.0-amd64",
"pull": "if-not-exists",
"depends_on": ["nix flake check"],
"volumes": [
{
"name": "nixconf",
"path": "/etc/nix"
}
],
"commands": [
"nix flake metadata"
]
},
{
"name": "pre-build",
"image": "docker.io/nixos/nix:2.8.0-amd64",
"pull": "if-not-exists",
"depends_on": ["nixpkgs-fmt"],
"volumes": [
{
"name": "nix",
"path": "/nix"
},
{
"name": "nixconf",
"path": "/etc/nix"
}
],
"commands": [
"nix-env -iA nixpkgs.cachix nixpkgs.glibc",
"cachix use go-xkcdreader",
]
},
{
"name": "nix-build",
"image": "docker.io/nixos/nix:2.8.0-amd64",
"pull": "if-not-exists",
# "depends_on": ["nix flake check", "statix", "pre-build"],
"depends_on": ["statix", "pre-build"],
"volumes": [
{
"name": "nix",
"path": "/nix"
},
{
"name": "nixconf",
"path": "/etc/nix"
}
],
"commands": [
"cat /etc/nix/nix.conf",
"nix build .#go-xkcdreader"
]
},
{
"name": "ldd",
"image": "docker.io/nixos/nix:2.8.0-amd64",
"pull": "if-not-exists",
"depends_on": ["nix-build"],
"volumes": [
{
"name": "nix",
"path": "/nix"
},
{
"name": "nixconf",
"path": "/etc/nix"
}
],
"commands": [
"ldd result/bin/go-xkcdreader"
]
}
],
"volumes": [
{
"name": "nix",
"temp": {}
},
{
"name": "nixconf",
"temp": {}
}
]
},
{
"kind": "pipeline",
"type": "docker",
"name": "archlinux",
"node": {
"r": "w"
},
"steps": [
{
"name": "pull archlinux",
"image": "docker.io/immawanderer/archlinux-go-fyne:linux-amd64",
"pull": "always",
"depends_on": ["clone"],
"commands": [
"uname -r",
"cat /etc/os-release"
]
},
{
"name": "build",
"image": "docker.io/immawanderer/archlinux-go-fyne:linux-amd64",
"pull": "always",
"depends_on": ["pull archlinux"],
"commands": [
"go version",
"gcc --version",
"go build -v ."
]
},
{
"name": "ldd",
"image": "docker.io/immawanderer/archlinux-go-fyne:linux-amd64",
"pull": "always",
"depends_on": ["build"],
"commands": [
"ldd --version",
"ldd go-xkcdreader"
]
}
]
},
{
"kind": "pipeline",
"type": "docker",
"name": "fedora",
"node": {
"r": "w"
},
"steps": [
{
"name": "pull fedora",
"image": "docker.io/immawanderer/fedora-go-fyne:linux-amd64",
"pull": "always",
"depends_on": ["clone"],
"commands": [
"uname -r",
"cat /etc/os-release"
]
},
{
"name": "build",
"image": "docker.io/immawanderer/fedora-go-fyne:linux-amd64",
"pull": "always",
"depends_on": ["pull fedora"],
"commands": [
"go version",
"gcc --version",
"go build ."
]
},
{
"name": "ldd",
"image": "docker.io/immawanderer/fedora-go-fyne:linux-amd64",
"pull": "always",
"depends_on": ["build"],
"commands": [
"ldd --version",
"ldd go-xkcdreader"
]
}
]
}
]

View File

@ -4,6 +4,7 @@ # [go-xkcdreader](https://git.dotya.ml/wanderer/go-xkcdreader)
[![built with nix](https://builtwithnix.org/badge.svg)](https://builtwithnix.org)
[![Cachix](https://img.shields.io/badge/cachix-go--xkcdreader-blue.svg)](https://go-xkcdreader.cachix.org)
[![Build Status](https://drone.dotya.ml/api/badges/wanderer/go-xkcdreader/status.svg?ref=refs/heads/development)](https://drone.dotya.ml/wanderer/go-xkcdreader)
### disclaimer
WIP :construction: