Compare commits
1 Commits
developmen
...
feature-dr
Author | SHA1 | Date | |
---|---|---|---|
3ebc0de61f |
@ -7,11 +7,39 @@ def main(ctx):
|
|||||||
"kind": "pipeline",
|
"kind": "pipeline",
|
||||||
"type": "docker",
|
"type": "docker",
|
||||||
"name": "golangci-lint",
|
"name": "golangci-lint",
|
||||||
|
"clone": {"disable": True},
|
||||||
|
"environment": {
|
||||||
|
"GOPROXY": "direct"
|
||||||
|
},
|
||||||
"steps": [
|
"steps": [
|
||||||
|
{
|
||||||
|
"name": "skip-check",
|
||||||
|
"image": "docker.io/immawanderer/drone-skip-pipeline:linux-amd64",
|
||||||
|
"pull": "always",
|
||||||
|
"settings": {
|
||||||
|
"rules": [
|
||||||
|
"*.go",
|
||||||
|
"*.sum",
|
||||||
|
"*.mod",
|
||||||
|
".golangci.yml"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clone",
|
||||||
|
"image": "docker.io/alpine/git",
|
||||||
|
"pull": "always",
|
||||||
|
"depends_on": ["skip-check"],
|
||||||
|
"commands": [
|
||||||
|
"git clone ${DRONE_GIT_HTTP_URL} .",
|
||||||
|
"git checkout ${DRONE_COMMIT}"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "golangci-lint",
|
"name": "golangci-lint",
|
||||||
"image": "docker.io/immawanderer/archlinux-go-fyne:linux-amd64",
|
"image": "docker.io/immawanderer/archlinux-go-fyne:linux-amd64",
|
||||||
"pull": "always",
|
"pull": "always",
|
||||||
|
"depends_on": ["clone"],
|
||||||
"commands": [
|
"commands": [
|
||||||
"curl -sSfL " +
|
"curl -sSfL " +
|
||||||
"https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh"+
|
"https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh"+
|
||||||
@ -30,6 +58,9 @@ def main(ctx):
|
|||||||
"node": {
|
"node": {
|
||||||
"r": "w"
|
"r": "w"
|
||||||
},
|
},
|
||||||
|
"environment": {
|
||||||
|
"GOPROXY": "direct"
|
||||||
|
},
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"name": "pull nix",
|
"name": "pull nix",
|
||||||
@ -276,6 +307,9 @@ def main(ctx):
|
|||||||
"node": {
|
"node": {
|
||||||
"r": "w"
|
"r": "w"
|
||||||
},
|
},
|
||||||
|
"environment": {
|
||||||
|
"GOPROXY": "direct"
|
||||||
|
},
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"name": "pull archlinux",
|
"name": "pull archlinux",
|
||||||
@ -353,6 +387,9 @@ def main(ctx):
|
|||||||
"node": {
|
"node": {
|
||||||
"r": "w"
|
"r": "w"
|
||||||
},
|
},
|
||||||
|
"environment": {
|
||||||
|
"GOPROXY": "direct"
|
||||||
|
},
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"name": "pull fedora",
|
"name": "pull fedora",
|
||||||
|
@ -34,8 +34,10 @@ linters:
|
|||||||
- ineffassign
|
- ineffassign
|
||||||
# - ifshort
|
# - ifshort
|
||||||
- misspell
|
- misspell
|
||||||
# - prealloc # disable for now as it might be premature optimisation
|
- prealloc
|
||||||
- revive
|
- revive
|
||||||
|
- rowserrcheck
|
||||||
|
- sqlclosecheck
|
||||||
- unconvert
|
- unconvert
|
||||||
- unparam
|
- unparam
|
||||||
- varcheck
|
- varcheck
|
||||||
|
@ -45,10 +45,13 @@ repos:
|
|||||||
- repo: https://github.com/dnephin/pre-commit-golang
|
- repo: https://github.com/dnephin/pre-commit-golang
|
||||||
rev: v0.5.0
|
rev: v0.5.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: go-mod-tidy
|
- id: go-vet
|
||||||
- id: go-unit-tests
|
- id: go-unit-tests
|
||||||
|
- id: go-cyclo
|
||||||
|
args: [-over=15]
|
||||||
- id: golangci-lint
|
- id: golangci-lint
|
||||||
- id: go-build
|
- id: go-build
|
||||||
|
- id: go-mod-tidy
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: nix-build
|
- id: nix-build
|
||||||
|
16
flake.lock
16
flake.lock
@ -16,21 +16,6 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nix-filter": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1653590866,
|
|
||||||
"narHash": "sha256-E4yKIrt/S//WfW5D9IhQ1dVuaAy8RE7EiCMfnbrOC78=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "nix-filter",
|
|
||||||
"rev": "3e81a637cdf9f6e9b39aeb4d6e6394d1ad158e16",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "nix-filter",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixgl": {
|
"nixgl": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
@ -70,7 +55,6 @@
|
|||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"nix-filter": "nix-filter",
|
|
||||||
"nixgl": "nixgl",
|
"nixgl": "nixgl",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
|
48
flake.nix
48
flake.nix
@ -10,17 +10,11 @@
|
|||||||
flake = false;
|
flake = false;
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
nix-filter = {
|
|
||||||
url = "github:numtide/nix-filter";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixgl, nix-filter, nixpkgs, ... }:
|
outputs = { self, nixgl, nixpkgs, ... }:
|
||||||
let
|
let
|
||||||
|
|
||||||
projname = "go-xkcdreader";
|
|
||||||
|
|
||||||
# to work with older version of flakes
|
# to work with older version of flakes
|
||||||
lastModifiedDate =
|
lastModifiedDate =
|
||||||
self.lastModifiedDate or self.lastModified or "19700101";
|
self.lastModifiedDate or self.lastModified or "19700101";
|
||||||
@ -45,10 +39,6 @@
|
|||||||
});
|
});
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
formatter = forAllSystems (system:
|
|
||||||
nixpkgsFor.${system}.nixpkgs-fmt
|
|
||||||
);
|
|
||||||
|
|
||||||
packages = forAllSystems (system:
|
packages = forAllSystems (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgsFor.${system};
|
pkgs = nixpkgsFor.${system};
|
||||||
@ -56,7 +46,7 @@
|
|||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
go-xkcdreader = with pkgs; buildGoModule rec {
|
go-xkcdreader = with pkgs; buildGoModule rec {
|
||||||
pname = "${projname}";
|
pname = "go-xkcdreader";
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
gcc
|
gcc
|
||||||
libglvnd # instead of libGL
|
libglvnd # instead of libGL
|
||||||
@ -77,7 +67,7 @@
|
|||||||
nativeBuildInputs = [ pkgconfig ];
|
nativeBuildInputs = [ pkgconfig ];
|
||||||
|
|
||||||
overrideModAttrs = _: {
|
overrideModAttrs = _: {
|
||||||
# GOPROXY = "direct";
|
GOPROXY = "direct";
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit version;
|
inherit version;
|
||||||
@ -93,35 +83,15 @@
|
|||||||
|
|
||||||
modSha256 = lib.fakeSha256;
|
modSha256 = lib.fakeSha256;
|
||||||
# dont't forget to update vendorSha256 whenever go.mod or go.sum change
|
# dont't forget to update vendorSha256 whenever go.mod or go.sum change
|
||||||
vendorSha256 = "sha256-LvdcTbj8cFlaIBsq1VLfLF2Tu9HiZzGO8igD766nMLE=";
|
vendorSha256 = "sha256-gaIoacCs0PcvmFW8dQOFUb9KU1u6KUiFmGQ/ERcVwjc=";
|
||||||
|
|
||||||
# In 'nix develop', we don't need a copy of the source tree
|
# In 'nix develop', we don't need a copy of the source tree
|
||||||
# in the Nix store.
|
# in the Nix store.
|
||||||
src = nix-filter.lib.filter {
|
src = lib.cleanSource ./.;
|
||||||
root = lib.cleanSource ./.;
|
|
||||||
exclude = [
|
|
||||||
./flake.nix
|
|
||||||
./flake.lock
|
|
||||||
./default.nix
|
|
||||||
./shell.nix
|
|
||||||
|
|
||||||
./check-fmt
|
|
||||||
./README.md
|
|
||||||
./LICENSE
|
|
||||||
|
|
||||||
./.drone.starlark
|
|
||||||
./.envrc
|
|
||||||
./.example.vimrc
|
|
||||||
./.gitattributes
|
|
||||||
./.gitignore
|
|
||||||
./.golangci.yml
|
|
||||||
./.pre-commit-config.yaml
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "an offline-capable xkcd webcomic reader written in Go";
|
description = "an offline-capable xkcd webcomic reader written in Go";
|
||||||
homepage = "https://git.dotya.ml/wanderer/${projname}";
|
homepage = "https://git.dotya.ml/wanderer/go-xkcdreader";
|
||||||
license = lib.licenses.gpl3;
|
license = lib.licenses.gpl3;
|
||||||
maintainers = [ "wanderer" ];
|
maintainers = [ "wanderer" ];
|
||||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||||
@ -135,7 +105,7 @@
|
|||||||
go-xkcdreader = {
|
go-xkcdreader = {
|
||||||
type = "app";
|
type = "app";
|
||||||
program =
|
program =
|
||||||
"${self.packages.${system}.${projname}}/bin/${projname}";
|
"${self.packages.${system}.go-xkcdreader}/bin/go-xkcdreader";
|
||||||
};
|
};
|
||||||
default = go-xkcdreader;
|
default = go-xkcdreader;
|
||||||
});
|
});
|
||||||
@ -168,7 +138,7 @@
|
|||||||
nix-store --query --references $(nix-instantiate shell.nix) | \
|
nix-store --query --references $(nix-instantiate shell.nix) | \
|
||||||
xargs nix-store --realise | \
|
xargs nix-store --realise | \
|
||||||
xargs nix-store --query --requisites | \
|
xargs nix-store --query --requisites | \
|
||||||
cachix push ${projname}
|
cachix push go-xkcdreader
|
||||||
'';
|
'';
|
||||||
add-license = pkgs.writeShellScriptBin "add-license" ''
|
add-license = pkgs.writeShellScriptBin "add-license" ''
|
||||||
go run github.com/google/addlicense@v1.0.0 -v \
|
go run github.com/google/addlicense@v1.0.0 -v \
|
||||||
@ -179,7 +149,7 @@
|
|||||||
{
|
{
|
||||||
default = with pkgs; mkShell
|
default = with pkgs; mkShell
|
||||||
{
|
{
|
||||||
name = "${projname}-" + version;
|
name = "go-xkcdreader-" + version;
|
||||||
|
|
||||||
GOFLAGS = "-buildmode=pie -trimpath -mod=readonly -modcacherw";
|
GOFLAGS = "-buildmode=pie -trimpath -mod=readonly -modcacherw";
|
||||||
GOLDFLAGS = "-s -w -X cmd.version=${version}";
|
GOLDFLAGS = "-s -w -X cmd.version=${version}";
|
||||||
|
Loading…
Reference in New Issue
Block a user