1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/internal/pipe/chocolatey/nuspec_test.go
Fabio Ribeiro f2281e8ff2
feat: chocolatey support (#3509)
This PR adds support for generating the structure used to pack and push
Chocolatey Packages. And will solve the #3154

Is not ready for merge yet, but has the main structure, and ready for
comments.

Accordingly to Chocolatey, in order to build a package, it's necessary a
`.nuspec` and `chocolateyinstall.ps1` files at least, having these ones,
we could pack and distribute without adding the binary inside the final
package and that was implemented here.

To complete, will be necessary to define the package build and
distribute, however will be required to have Chocolatey installed
(Windows Only). One of alternatives that I thought was, publish the
files like Scoop and Brew in a separate repository, and there we could
use `chocolatey` through
[crazy-max/ghaction-chocolatey](https://github.com/crazy-max/ghaction-chocolatey).

Chocolatey has a lot of good examples of repositories:

https://github.com/chocolatey-community/chocolatey-packages/tree/master/automatic/curl

A final compilation of the missing parts:
- [x] How to pack and push (chocolatey)
- [x] Documentation

Sorry for the long description😄 

All feedback very welcome!

Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2022-11-11 23:52:32 -03:00

46 lines
1.8 KiB
Go

package chocolatey
import (
"testing"
"github.com/goreleaser/goreleaser/internal/golden"
"github.com/stretchr/testify/require"
)
func TestNuspecBytes(t *testing.T) {
m := &Nuspec{
Xmlns: schema,
Metadata: Metadata{
ID: "goreleaser",
Version: "1.12.3",
PackageSourceURL: "https://github.com/goreleaser/goreleaser",
Owners: "caarlos0",
Title: "GoReleaser",
Authors: "caarlos0",
ProjectURL: "https://goreleaser.com/",
IconURL: "https://raw.githubusercontent.com/goreleaser/goreleaser/main/www/docs/static/avatar.png",
Copyright: "2016-2022 Carlos Alexandro Becker",
LicenseURL: "https://github.com/goreleaser/goreleaser/blob/main/LICENSE.md",
RequireLicenseAcceptance: true,
ProjectSourceURL: "https://github.com/goreleaser/goreleaser",
DocsURL: "https://github.com/goreleaser/goreleaser/blob/main/README.md",
BugTrackerURL: "https://github.com/goreleaser/goreleaser/issues",
Tags: "go docker homebrew golang package",
Summary: "Deliver Go binaries as fast and easily as possible",
Description: "GoReleaser builds Go binaries for several platforms, creates a GitHub release and then pushes a Homebrew formula to a tap repository. All that wrapped in your favorite CI.",
ReleaseNotes: "This tag is only to keep version parity with the pro version, which does have a couple of bugfixes.",
Dependencies: &Dependencies{Dependency: []Dependency{
{ID: "nfpm", Version: "2.20.0"},
}},
},
Files: Files{File: []File{
{Source: "tools\\**", Target: "tools"},
}},
}
out, err := m.Bytes()
require.NoError(t, err)
golden.RequireEqualExt(t, out, ".nuspec")
}