1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-10-30 23:58:09 +02:00

build: nix devShell (#4507)

<!--

Hi, thanks for contributing!

Please make sure you read our CONTRIBUTING guide.

Also, add tests and the respective documentation changes as well.

-->


<!-- If applied, this commit will... -->

...

<!-- Why is this change being made? -->

...

<!-- # Provide links to any relevant tickets, URLs or other resources
-->

...

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2023-12-28 20:49:23 -03:00
committed by GitHub
parent e91a0f513e
commit 48f036b5d6
7 changed files with 138 additions and 19 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

View File

@@ -20,14 +20,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
- uses: arduino/setup-task@e26d8975574116b0097a1161e0fe16ba75d84c1c # v1
- uses: cachix/install-nix-action@v24
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v4
with:
go-version: stable
- run: task docs:build
- uses: wjdp/htmltest-action@09118714cd26bef56bd3d0819e4f9b1dce6f60a9 # master
with:
path: www/site
config: www/htmltest.yml
nix_path: nixpkgs=channel:nixos-unstable
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix develop .#docs --command task docs:test

1
.gitignore vendored
View File

@@ -14,3 +14,4 @@ completions/
.idea/
manpages
output.json
.direnv

View File

@@ -6,9 +6,6 @@ env:
GO111MODULE: on
GOPROXY: https://proxy.golang.org,direct
vars:
DOCKER: '{{default "docker" .DOCKER}}'
tasks:
dev:
desc: Setup git hooks
@@ -124,15 +121,19 @@ tasks:
desc: Start documentation server
cmds:
- task: docs:generate
- "{{.DOCKER}} build -t mkdocs -f www/docker/Dockerfile www/docker"
- "{{.DOCKER}} run --rm -p 8000:8000 -v ${PWD}/www:/docs mkdocs"
- "mkdocs serve -f www/mkdocs.yml -a 0.0.0.0:8000"
docs:build:
desc: Build docs
cmds:
- task: docs:generate
- "{{.DOCKER}} build -t mkdocs -f www/docker/Dockerfile www/docker"
- "{{.DOCKER}} run --rm -v ${PWD}/www:/docs mkdocs build"
- "mkdocs build -f www/mkdocs.yml"
docs:test:
desc: Test docs with htmltest
cmds:
- task: docs:build
- "htmltest www/site -c www/htmltest.yml"
release:
desc: Create a new tag

78
flake.lock generated Normal file
View File

@@ -0,0 +1,78 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1703438236,
"narHash": "sha256-aqVBq1u09yFhL7bj1/xyUeJjzr92fXVvQSSEx6AdB1M=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5f64a12a728902226210bf01d25ec6cbb9d9265b",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"staging": "staging"
}
},
"staging": {
"locked": {
"lastModified": 1703777495,
"narHash": "sha256-ISkNWa58+6Uk/nQ47omTETrV+yhKFbnU/wR9n+3ux8g=",
"owner": "caarlos0",
"repo": "nixpkgs",
"rev": "e1d1738a056a052aedb6560c240b2749af33fee0",
"type": "github"
},
"original": {
"owner": "caarlos0",
"ref": "wip",
"repo": "nixpkgs",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

46
flake.nix Normal file
View File

@@ -0,0 +1,46 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
staging.url = "github:caarlos0/nixpkgs/wip";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { nixpkgs, staging, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
staging-pkgs = staging.legacyPackages.${system};
in
{
packages.default = pkgs.buildGoModule {
pname = "goreleaser";
version = "unversioned";
src = ./.;
ldflags = [ "-s" "-w" "-X main.version=dev" "-X main.builtBy=flake" ];
doCheck = false;
vendorHash = "sha256-wY3kIhNIqTaK9MT1VeePERNhqvbtf6bsyRTjG8nrqxU=";
};
devShells.default = pkgs.mkShell {
packages = with pkgs; with staging-pkgs.python311Packages; [
go
go-task
gofumpt
];
shellHook = "go mod tidy";
};
devShells.docs = pkgs.mkShell {
packages = with pkgs; with staging-pkgs.python311Packages; [
go-task
htmltest
mkdocs-material
mkdocs-redirects
mkdocs-minify
mkdocs-rss-plugin
mkdocs-include-markdown-plugin
] ++ mkdocs-material.passthru.optional-dependencies.git;
};
}
);
}

View File

@@ -1,2 +0,0 @@
FROM squidfunk/mkdocs-material
RUN pip install mkdocs-include-markdown-plugin mkdocs-rss-plugin