464 lines
9.4 KiB
Plaintext
464 lines
9.4 KiB
Plaintext
# Copyright 2022 wanderer <a_mirre at utb dot cz>
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
def main(ctx):
|
|
return [
|
|
{
|
|
"kind": "pipeline",
|
|
"type": "docker",
|
|
"name": "golangci-lint",
|
|
"steps": [
|
|
{
|
|
"name": "golangci-lint",
|
|
"image": "docker.io/immawanderer/archlinux-go-fyne:linux-amd64",
|
|
"pull": "always",
|
|
"commands": [
|
|
"curl -sSfL " +
|
|
"https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh"+
|
|
" | sh -s -- -b $(go env GOPATH)/bin v1.46.2",
|
|
"export PATH=\"$(go env GOPATH)/bin:$PATH\"",
|
|
"golangci-lint --version",
|
|
"golangci-lint run -v --timeout 5m"
|
|
],
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"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": "nixpkgs-fmt",
|
|
"image": "docker.io/immawanderer/nix-nixpkgs-fmt:linux-amd64",
|
|
"pull": "always",
|
|
"depends_on": ["clone"],
|
|
"commands": [
|
|
"nixpkgs-fmt --version || true",
|
|
"nixpkgs-fmt --check . || (echo 'run `nixpkgs-fmt .` to fix it' && exit 1)"
|
|
]
|
|
},
|
|
{
|
|
"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": "set up cachix",
|
|
"image": "docker.io/immawanderer/nix-cachix-glibc",
|
|
"pull": "if-not-exists",
|
|
"depends_on": ["enable sandbox"],
|
|
"volumes": [
|
|
{
|
|
"name": "nixconf",
|
|
"path": "/etc/nix"
|
|
}
|
|
],
|
|
"commands": [
|
|
"cat /etc/nix/nix.conf",
|
|
"cachix use go-xkcdreader",
|
|
"cat /etc/nix/nix.conf"
|
|
]
|
|
},
|
|
{
|
|
"name": "statix",
|
|
"image": "docker.io/immawanderer/nix-statix:linux-amd64",
|
|
"pull": "if-not-exists",
|
|
"depends_on": ["enable flakes"],
|
|
"commands": [
|
|
"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": ["statix", "enable sandbox"],
|
|
"volumes": [
|
|
{
|
|
"name": "nixconf",
|
|
"path": "/etc/nix"
|
|
}
|
|
],
|
|
"commands": [
|
|
"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": "go test",
|
|
"image": "docker.io/nixos/nix:2.8.0-amd64",
|
|
"pull": "if-not-exists",
|
|
"depends_on": ["set up cachix"],
|
|
"volumes": [
|
|
{
|
|
"name": "nix",
|
|
"path": "/nix"
|
|
},
|
|
{
|
|
"name": "nixconf",
|
|
"path": "/etc/nix"
|
|
},
|
|
{
|
|
"name": "gopath",
|
|
"path": "/root/go"
|
|
}
|
|
],
|
|
"commands": [
|
|
"nix develop --command go test -cover ./..."
|
|
]
|
|
},
|
|
{
|
|
"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": ["nixpkgs-fmt", "set up cachix", "nix flake check"],
|
|
"volumes": [
|
|
{
|
|
"name": "nix",
|
|
"path": "/nix"
|
|
},
|
|
{
|
|
"name": "nixconf",
|
|
"path": "/etc/nix"
|
|
}
|
|
],
|
|
"commands": [
|
|
"nix build .#go-xkcdreader"
|
|
]
|
|
},
|
|
{
|
|
"name": "go-xkcdreader version",
|
|
"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": [
|
|
"./result/bin/go-xkcdreader version"
|
|
]
|
|
},
|
|
{
|
|
"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": [
|
|
"nix develop --command ldd result/bin/go-xkcdreader"
|
|
]
|
|
}
|
|
],
|
|
"volumes": [
|
|
{
|
|
"name": "nix",
|
|
"temp": {}
|
|
},
|
|
{
|
|
"name": "nixconf",
|
|
"temp": {}
|
|
},
|
|
{
|
|
"name": "gopath",
|
|
"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": "go env",
|
|
"image": "docker.io/immawanderer/archlinux-go-fyne:linux-amd64",
|
|
"pull": "always",
|
|
"depends_on": ["pull archlinux"],
|
|
"commands": [
|
|
"go env",
|
|
]
|
|
},
|
|
{
|
|
"name": "test",
|
|
"image": "docker.io/immawanderer/archlinux-go-fyne:linux-amd64",
|
|
"pull": "always",
|
|
"depends_on": ["pull archlinux"],
|
|
"volumes": [
|
|
{
|
|
"name": "gopath",
|
|
"path": "/root/go"
|
|
}
|
|
],
|
|
"commands": [
|
|
"go test -cover ./..."
|
|
]
|
|
},
|
|
{
|
|
"name": "build",
|
|
"image": "docker.io/immawanderer/archlinux-go-fyne:linux-amd64",
|
|
"pull": "always",
|
|
"depends_on": ["pull archlinux"],
|
|
"volumes": [
|
|
{
|
|
"name": "gopath",
|
|
"path": "/root/go"
|
|
}
|
|
],
|
|
"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"
|
|
]
|
|
}
|
|
],
|
|
"volumes": [
|
|
{
|
|
"name": "gopath",
|
|
"temp": {}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"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": "go env",
|
|
"image": "docker.io/immawanderer/fedora-go-fyne:linux-amd64",
|
|
"pull": "always",
|
|
"depends_on": ["pull fedora"],
|
|
"commands": [
|
|
"go env",
|
|
]
|
|
},
|
|
{
|
|
"name": "test",
|
|
"image": "docker.io/immawanderer/fedora-go-fyne:linux-amd64",
|
|
"pull": "always",
|
|
"depends_on": ["pull fedora"],
|
|
"volumes": [
|
|
{
|
|
"name": "gopath",
|
|
"path": "/root/go"
|
|
}
|
|
],
|
|
"commands": [
|
|
"go test -cover ./..."
|
|
]
|
|
},
|
|
{
|
|
"name": "build",
|
|
"image": "docker.io/immawanderer/fedora-go-fyne:linux-amd64",
|
|
"pull": "always",
|
|
"depends_on": ["pull fedora"],
|
|
"volumes": [
|
|
{
|
|
"name": "gopath",
|
|
"path": "/root/go"
|
|
}
|
|
],
|
|
"commands": [
|
|
"go version",
|
|
"gcc --version",
|
|
"go build -v ."
|
|
]
|
|
},
|
|
{
|
|
"name": "ldd",
|
|
"image": "docker.io/immawanderer/fedora-go-fyne:linux-amd64",
|
|
"pull": "always",
|
|
"depends_on": ["build"],
|
|
"commands": [
|
|
"ldd --version",
|
|
"ldd go-xkcdreader"
|
|
]
|
|
}
|
|
],
|
|
"volumes": [
|
|
{
|
|
"name": "gopath",
|
|
"temp": {}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"kind": "pipeline",
|
|
"type": "docker",
|
|
"name": "goreportcard refresh",
|
|
"clone": {"disable": True},
|
|
"depends_on": ["golangci-lint"],
|
|
"trigger": {
|
|
"ref": {
|
|
"include": [
|
|
"refs/tags/**",
|
|
"refs/heads/development"
|
|
],
|
|
"exclude": [
|
|
"refs/pull/**"
|
|
]
|
|
}
|
|
},
|
|
"steps": [
|
|
{
|
|
"name": "trigger",
|
|
"image": "docker.io/curlimages/curl:7.83.1",
|
|
"pull": "if-not-exists",
|
|
"commands": [
|
|
"uname -r",
|
|
"curl --version",
|
|
"curl " +
|
|
"-sS " +
|
|
"-X POST " +
|
|
"-F \"repo=git.dotya.ml/${DRONE_REPO}\" " +
|
|
"https://goreportcard.com/checks " +
|
|
"-o /dev/null"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
|
|
# vim: ft=bzl syntax=bzl.starlark noexpandtab ts=4 foldmethod=manual
|