mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-31 01:53:50 +02:00
feat: remove gofish (#3312)
* feat: remove gofish Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * fix: remove more unused code Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * fix: remove more references Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
66e863df32
commit
08e7038a20
@ -56,8 +56,6 @@ const (
|
||||
UploadableSourceArchive
|
||||
// BrewTap is an uploadable homebrew tap recipe file.
|
||||
BrewTap
|
||||
// GoFishRig is an uploadable Rigs rig food file.
|
||||
GoFishRig
|
||||
// PkgBuild is an Arch Linux AUR PKGBUILD file.
|
||||
PkgBuild
|
||||
// SrcInfo is an Arch Linux AUR .SRCINFO file.
|
||||
@ -96,8 +94,6 @@ func (t Type) String() string {
|
||||
return "Source"
|
||||
case BrewTap:
|
||||
return "Brew Tap"
|
||||
case GoFishRig:
|
||||
return "GoFish Rig"
|
||||
case KrewPluginManifest:
|
||||
return "Krew Plugin Manifest"
|
||||
case ScoopManifest:
|
||||
|
@ -39,17 +39,7 @@ func RequireEqualRb(tb testing.TB, out []byte) {
|
||||
doRequireEqual(tb, out, ".rb", golden)
|
||||
}
|
||||
|
||||
func RequireEqualLua(tb testing.TB, out []byte) {
|
||||
tb.Helper()
|
||||
doRequireEqual(tb, out, ".lua", golden)
|
||||
}
|
||||
|
||||
func RequireEqualYaml(tb testing.TB, out []byte) {
|
||||
tb.Helper()
|
||||
doRequireEqual(tb, out, ".yml", golden)
|
||||
}
|
||||
|
||||
func RequireEqualNakedYaml(tb testing.TB, out []byte) {
|
||||
tb.Helper()
|
||||
doRequireEqual(tb, out, ".yaml", "")
|
||||
}
|
||||
|
@ -590,13 +590,8 @@ func TestRunEmptyTokenType(t *testing.T) {
|
||||
Dist: folder,
|
||||
ProjectName: "foo",
|
||||
Release: config.Release{},
|
||||
Rigs: []config.GoFish{
|
||||
{
|
||||
Rig: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
},
|
||||
AURs: []config.AUR{
|
||||
{},
|
||||
},
|
||||
})
|
||||
ctx.Git = context.GitInfo{CurrentTag: "v1.0.1"}
|
||||
@ -612,7 +607,7 @@ func TestRunEmptyTokenType(t *testing.T) {
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "bin",
|
||||
Path: path,
|
||||
Goos: "darwin",
|
||||
Goos: "linux",
|
||||
Goarch: "amd64",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
|
@ -1,3 +0,0 @@
|
||||
// Package gofish implements the Pipe, providing food generation and
|
||||
// uploading it to a configured repo.
|
||||
package gofish
|
@ -1,56 +0,0 @@
|
||||
package gofish
|
||||
|
||||
type templateData struct {
|
||||
Name string
|
||||
Desc string
|
||||
Homepage string
|
||||
Version string
|
||||
License string
|
||||
ReleasePackages []releasePackage
|
||||
}
|
||||
|
||||
type releasePackage struct {
|
||||
DownloadURL string
|
||||
SHA256 string
|
||||
OS string
|
||||
Arch string
|
||||
Binaries []binary
|
||||
}
|
||||
|
||||
type binary struct {
|
||||
Name, Target string
|
||||
}
|
||||
|
||||
const foodTemplate = `local name = "{{ .Name }}"
|
||||
local version = "{{ .Version }}"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "{{ .Desc }}",
|
||||
license = "{{ .License }}",
|
||||
homepage = "{{ .Homepage }}",
|
||||
version = version,
|
||||
packages = {
|
||||
{{- range $element := .ReleasePackages}}
|
||||
{{- if ne $element.OS ""}}
|
||||
{
|
||||
os = "{{ $element.OS }}",
|
||||
arch = "{{ $element.Arch }}",
|
||||
url = "{{ $element.DownloadURL }}",
|
||||
sha256 = "{{ $element.SHA256 }}",
|
||||
resources = {
|
||||
{{- range $binary := $element.Binaries }}
|
||||
{
|
||||
path = "{{ $binary.Name }}",
|
||||
installpath = {{if ne $element.OS "windows"}}"bin/{{ $binary.Target }}"{{else}}"bin\\{{ $binary.Target }}"{{end}},
|
||||
{{- if ne $element.OS "windows"}}
|
||||
executable = true
|
||||
{{- end }}
|
||||
},
|
||||
{{- end }}
|
||||
}
|
||||
},
|
||||
{{- end }}
|
||||
{{- end}}
|
||||
}
|
||||
}`
|
@ -1,321 +0,0 @@
|
||||
package gofish
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"github.com/caarlos0/log"
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/client"
|
||||
"github.com/goreleaser/goreleaser/internal/commitauthor"
|
||||
"github.com/goreleaser/goreleaser/internal/deprecate"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe"
|
||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||
"github.com/goreleaser/goreleaser/pkg/config"
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
)
|
||||
|
||||
const (
|
||||
goFishConfigExtra = "GoFishConfig"
|
||||
foodFolder = "Food"
|
||||
)
|
||||
|
||||
var ErrNoArchivesFound = errors.New("no linux/macos/windows archives found")
|
||||
|
||||
// Pipe for goFish deployment.
|
||||
type Pipe struct{}
|
||||
|
||||
func (Pipe) String() string { return "gofish fish food cookbook" }
|
||||
func (Pipe) Skip(ctx *context.Context) bool { return len(ctx.Config.Rigs) == 0 }
|
||||
|
||||
func (Pipe) Default(ctx *context.Context) error {
|
||||
if len(ctx.Config.Rigs) > 0 {
|
||||
deprecate.Notice(ctx, "rigs")
|
||||
}
|
||||
for i := range ctx.Config.Rigs {
|
||||
goFish := &ctx.Config.Rigs[i]
|
||||
|
||||
goFish.CommitAuthor = commitauthor.Default(goFish.CommitAuthor)
|
||||
if goFish.CommitMessageTemplate == "" {
|
||||
goFish.CommitMessageTemplate = "GoFish fish food update for {{ .ProjectName }} version {{ .Tag }}"
|
||||
}
|
||||
if goFish.Name == "" {
|
||||
goFish.Name = ctx.Config.ProjectName
|
||||
}
|
||||
if goFish.Goarm == "" {
|
||||
goFish.Goarm = "6"
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (Pipe) Run(ctx *context.Context) error {
|
||||
cli, err := client.New(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return runAll(ctx, cli)
|
||||
}
|
||||
|
||||
func runAll(ctx *context.Context, cli client.Client) error {
|
||||
for _, goFish := range ctx.Config.Rigs {
|
||||
err := doRun(ctx, goFish, cli)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func doRun(ctx *context.Context, goFish config.GoFish, cl client.Client) error {
|
||||
if goFish.Rig.Name == "" {
|
||||
return pipe.Skip("Rigs rig name is not set")
|
||||
}
|
||||
|
||||
filters := []artifact.Filter{
|
||||
artifact.Or(
|
||||
artifact.ByGoos("darwin"),
|
||||
artifact.ByGoos("linux"),
|
||||
artifact.ByGoos("windows"),
|
||||
),
|
||||
artifact.Or(
|
||||
artifact.And(
|
||||
artifact.ByGoarch("amd64"),
|
||||
artifact.ByGoamd64("v1"),
|
||||
),
|
||||
artifact.ByGoarch("arm64"),
|
||||
artifact.ByGoarch("all"),
|
||||
artifact.And(
|
||||
artifact.ByGoarch("arm"),
|
||||
artifact.ByGoarm(goFish.Goarm),
|
||||
),
|
||||
),
|
||||
artifact.Or(
|
||||
artifact.ByType(artifact.UploadableArchive),
|
||||
artifact.ByType(artifact.UploadableBinary),
|
||||
),
|
||||
artifact.OnlyReplacingUnibins,
|
||||
}
|
||||
if len(goFish.IDs) > 0 {
|
||||
filters = append(filters, artifact.ByIDs(goFish.IDs...))
|
||||
}
|
||||
|
||||
archives := ctx.Artifacts.Filter(artifact.And(filters...)).List()
|
||||
if len(archives) == 0 {
|
||||
return ErrNoArchivesFound
|
||||
}
|
||||
|
||||
name, err := tmpl.New(ctx).Apply(goFish.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
goFish.Name = name
|
||||
|
||||
content, err := buildFood(ctx, goFish, cl, archives)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
filename := goFish.Name + ".lua"
|
||||
luaPath := filepath.Join(ctx.Config.Dist, filename)
|
||||
log.WithField("food", luaPath).Info("writing")
|
||||
if err := os.WriteFile(luaPath, []byte(content), 0o644); err != nil { //nolint: gosec
|
||||
return fmt.Errorf("failed to write gofish food: %w", err)
|
||||
}
|
||||
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: filename,
|
||||
Path: luaPath,
|
||||
Type: artifact.GoFishRig,
|
||||
Extra: map[string]interface{}{
|
||||
goFishConfigExtra: goFish,
|
||||
},
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func buildFood(ctx *context.Context, goFish config.GoFish, client client.Client, artifacts []*artifact.Artifact) (string, error) {
|
||||
data, err := dataFor(ctx, goFish, client, artifacts)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return doBuildFood(ctx, data)
|
||||
}
|
||||
|
||||
func doBuildFood(ctx *context.Context, data templateData) (string, error) {
|
||||
t, err := template.
|
||||
New(data.Name).
|
||||
Parse(foodTemplate)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
var out bytes.Buffer
|
||||
if err := t.Execute(&out, data); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
content, err := tmpl.New(ctx).Apply(out.String())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
out.Reset()
|
||||
|
||||
// Sanitize the template output and get rid of trailing whitespace.
|
||||
var (
|
||||
r = strings.NewReader(content)
|
||||
s = bufio.NewScanner(r)
|
||||
)
|
||||
for s.Scan() {
|
||||
l := strings.TrimRight(s.Text(), " ")
|
||||
_, _ = out.WriteString(l)
|
||||
_ = out.WriteByte('\n')
|
||||
}
|
||||
if err := s.Err(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out.String(), nil
|
||||
}
|
||||
|
||||
func dataFor(ctx *context.Context, cfg config.GoFish, cl client.Client, artifacts []*artifact.Artifact) (templateData, error) {
|
||||
result := templateData{
|
||||
Name: cfg.Name,
|
||||
Desc: cfg.Description,
|
||||
Homepage: cfg.Homepage,
|
||||
Version: ctx.Version,
|
||||
License: cfg.License,
|
||||
}
|
||||
|
||||
for _, art := range artifacts {
|
||||
sum, err := art.Checksum("sha256")
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if cfg.URLTemplate == "" {
|
||||
url, err := cl.ReleaseURLTemplate(ctx)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
cfg.URLTemplate = url
|
||||
}
|
||||
url, err := tmpl.New(ctx).WithArtifact(art, map[string]string{}).Apply(cfg.URLTemplate)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
goarch := []string{art.Goarch}
|
||||
if art.Goarch == "all" {
|
||||
goarch = []string{"amd64", "arm64"}
|
||||
}
|
||||
|
||||
for _, arch := range goarch {
|
||||
releasePackage := releasePackage{
|
||||
DownloadURL: url,
|
||||
SHA256: sum,
|
||||
OS: art.Goos,
|
||||
Arch: arch,
|
||||
Binaries: []binary{},
|
||||
}
|
||||
switch art.Type {
|
||||
case artifact.UploadableArchive:
|
||||
for _, bin := range artifact.ExtraOr(*art, artifact.ExtraBinaries, []string{}) {
|
||||
releasePackage.Binaries = append(releasePackage.Binaries, binary{
|
||||
Name: bin,
|
||||
Target: bin,
|
||||
})
|
||||
}
|
||||
case artifact.UploadableBinary:
|
||||
releasePackage.Binaries = append(releasePackage.Binaries, binary{
|
||||
Name: art.Name,
|
||||
Target: artifact.ExtraOr(*art, artifact.ExtraBinary, art.Name),
|
||||
})
|
||||
}
|
||||
result.ReleasePackages = append(result.ReleasePackages, releasePackage)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Publish gofish rig.
|
||||
func (Pipe) Publish(ctx *context.Context) error {
|
||||
cli, err := client.New(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return publishAll(ctx, cli)
|
||||
}
|
||||
|
||||
func publishAll(ctx *context.Context, cli client.Client) error {
|
||||
skips := pipe.SkipMemento{}
|
||||
for _, rig := range ctx.Artifacts.Filter(artifact.ByType(artifact.GoFishRig)).List() {
|
||||
err := doPublish(ctx, rig, cli)
|
||||
if err != nil && pipe.IsSkip(err) {
|
||||
skips.Remember(err)
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return skips.Evaluate()
|
||||
}
|
||||
|
||||
func doPublish(ctx *context.Context, food *artifact.Artifact, cl client.Client) error {
|
||||
rig, err := artifact.Extra[config.GoFish](*food, goFishConfigExtra)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cl, err = client.NewIfToken(ctx, cl, rig.Rig.Token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if strings.TrimSpace(rig.SkipUpload) == "true" {
|
||||
return pipe.Skip("rig.skip_upload is set")
|
||||
}
|
||||
|
||||
if strings.TrimSpace(rig.SkipUpload) == "auto" && ctx.Semver.Prerelease != "" {
|
||||
return pipe.Skip("prerelease detected with 'auto' upload, skipping gofish publish")
|
||||
}
|
||||
|
||||
repo := client.RepoFromRef(rig.Rig)
|
||||
|
||||
gpath := buildFoodPath(foodFolder, food.Name)
|
||||
log.WithField("food", gpath).
|
||||
WithField("repo", repo.String()).
|
||||
Info("pushing")
|
||||
|
||||
msg, err := tmpl.New(ctx).Apply(rig.CommitMessageTemplate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
author, err := commitauthor.Get(ctx, rig.CommitAuthor)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
content, err := os.ReadFile(food.Path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return cl.CreateFile(ctx, author, repo, content, gpath, msg)
|
||||
}
|
||||
|
||||
func buildFoodPath(folder, filename string) string {
|
||||
return path.Join(folder, filename)
|
||||
}
|
@ -1,844 +0,0 @@
|
||||
package gofish
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/client"
|
||||
"github.com/goreleaser/goreleaser/internal/golden"
|
||||
"github.com/goreleaser/goreleaser/internal/testlib"
|
||||
"github.com/goreleaser/goreleaser/pkg/config"
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestDescription(t *testing.T) {
|
||||
require.NotEmpty(t, Pipe{}.String())
|
||||
}
|
||||
|
||||
func createTemplateData() templateData {
|
||||
binaries := func(ext string) []binary {
|
||||
return []binary{
|
||||
{Name: "bin1" + ext, Target: "bin1" + ext},
|
||||
{Name: "bin2" + ext, Target: "bin2" + ext},
|
||||
{Name: "bin3" + ext, Target: "bin3" + ext},
|
||||
}
|
||||
}
|
||||
return templateData{
|
||||
Desc: "Some desc",
|
||||
Homepage: "https://google.com",
|
||||
ReleasePackages: []releasePackage{
|
||||
{
|
||||
Arch: "amd64",
|
||||
OS: "darwin",
|
||||
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Darwin_x86_64.tar.gz",
|
||||
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68",
|
||||
Binaries: binaries(""),
|
||||
},
|
||||
{
|
||||
Arch: "arm64",
|
||||
OS: "darwin",
|
||||
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Darwin_arm64.tar.gz",
|
||||
SHA256: "1633f61598ab0791e213135923624eb342196b349490sadasdsadsadasdasdsd",
|
||||
Binaries: binaries(""),
|
||||
},
|
||||
{
|
||||
Arch: "amd64",
|
||||
OS: "linux",
|
||||
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz",
|
||||
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
Binaries: binaries(""),
|
||||
},
|
||||
{
|
||||
Arch: "arm",
|
||||
OS: "linux",
|
||||
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm6.tar.gz",
|
||||
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
Binaries: binaries(""),
|
||||
},
|
||||
{
|
||||
Arch: "arm64",
|
||||
OS: "linux",
|
||||
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm64.tar.gz",
|
||||
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
Binaries: binaries(""),
|
||||
},
|
||||
{
|
||||
Arch: "amd64",
|
||||
OS: "windows",
|
||||
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_windows_amd64.zip",
|
||||
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
Binaries: binaries(".exe"),
|
||||
},
|
||||
},
|
||||
Name: "Test",
|
||||
Version: "0.1.3",
|
||||
}
|
||||
}
|
||||
|
||||
func assertDefaultTemplateData(t *testing.T, food string) {
|
||||
t.Helper()
|
||||
require.Contains(t, food, "food =")
|
||||
require.Contains(t, food, `homepage = "https://google.com"`)
|
||||
require.Contains(t, food, `url = "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Darwin_x86_64.tar.gz"`)
|
||||
require.Contains(t, food, `sha256 = "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68"`)
|
||||
require.Contains(t, food, `local version = "0.1.3"`)
|
||||
}
|
||||
|
||||
func TestFullFood(t *testing.T) {
|
||||
data := createTemplateData()
|
||||
data.License = "MIT"
|
||||
food, err := doBuildFood(context.New(config.Project{
|
||||
ProjectName: "foo",
|
||||
}), data)
|
||||
require.NoError(t, err)
|
||||
|
||||
golden.RequireEqualLua(t, []byte(food))
|
||||
}
|
||||
|
||||
func TestFullFoodLinuxOnly(t *testing.T) {
|
||||
data := createTemplateData()
|
||||
for i, v := range data.ReleasePackages {
|
||||
if v.OS != "linux" {
|
||||
data.ReleasePackages[i] = releasePackage{}
|
||||
}
|
||||
}
|
||||
|
||||
food, err := doBuildFood(context.New(config.Project{
|
||||
ProjectName: "foo",
|
||||
}), data)
|
||||
require.NoError(t, err)
|
||||
|
||||
golden.RequireEqualLua(t, []byte(food))
|
||||
}
|
||||
|
||||
func TestFullFoodWindowsOnly(t *testing.T) {
|
||||
data := createTemplateData()
|
||||
for i, v := range data.ReleasePackages {
|
||||
if v.OS != "windows" {
|
||||
data.ReleasePackages[i] = releasePackage{}
|
||||
}
|
||||
}
|
||||
food, err := doBuildFood(context.New(config.Project{
|
||||
ProjectName: "foo",
|
||||
}), data)
|
||||
require.NoError(t, err)
|
||||
|
||||
golden.RequireEqualLua(t, []byte(food))
|
||||
}
|
||||
|
||||
func TestFoodSimple(t *testing.T) {
|
||||
food, err := doBuildFood(context.New(config.Project{}), createTemplateData())
|
||||
require.NoError(t, err)
|
||||
assertDefaultTemplateData(t, food)
|
||||
}
|
||||
|
||||
func TestFullPipe(t *testing.T) {
|
||||
type testcase struct {
|
||||
prepare func(ctx *context.Context)
|
||||
expectedPublishError string
|
||||
}
|
||||
for name, tt := range map[string]testcase{
|
||||
"default": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitHub
|
||||
ctx.Config.Rigs[0].Rig.Owner = "test"
|
||||
ctx.Config.Rigs[0].Rig.Name = "test"
|
||||
ctx.Config.Rigs[0].Homepage = "https://github.com/goreleaser"
|
||||
},
|
||||
},
|
||||
"default_gitlab": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitLab
|
||||
ctx.Config.Rigs[0].Rig.Owner = "test"
|
||||
ctx.Config.Rigs[0].Rig.Name = "test"
|
||||
ctx.Config.Rigs[0].Homepage = "https://gitlab.com/goreleaser"
|
||||
},
|
||||
},
|
||||
"invalid_commit_template": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Rigs[0].Rig.Owner = "test"
|
||||
ctx.Config.Rigs[0].Rig.Name = "test"
|
||||
ctx.Config.Rigs[0].CommitMessageTemplate = "{{ .Asdsa }"
|
||||
},
|
||||
expectedPublishError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
},
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
folder := t.TempDir()
|
||||
ctx := &context.Context{
|
||||
Git: context.GitInfo{
|
||||
CurrentTag: "v1.0.1",
|
||||
},
|
||||
Version: "1.0.1",
|
||||
Artifacts: artifact.New(),
|
||||
Env: map[string]string{
|
||||
"FOO": "foo_is_bar",
|
||||
},
|
||||
Config: config.Project{
|
||||
Dist: folder,
|
||||
ProjectName: name,
|
||||
Rigs: []config.GoFish{
|
||||
{
|
||||
Name: name,
|
||||
IDs: []string{
|
||||
"foo",
|
||||
},
|
||||
Description: "A run pipe test fish food and FOO={{ .Env.FOO }}",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
tt.prepare(ctx)
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "bar_bin.tar.gz",
|
||||
Path: "doesnt matter",
|
||||
Goos: "darwin",
|
||||
Goarch: "amd64",
|
||||
Goamd64: "v1",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: "bar",
|
||||
artifact.ExtraFormat: "tar.gz",
|
||||
},
|
||||
})
|
||||
path := filepath.Join(folder, "bin.tar.gz")
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "bin.tar.gz",
|
||||
Path: path,
|
||||
Goos: "darwin",
|
||||
Goarch: "amd64",
|
||||
Goamd64: "v1",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: "foo",
|
||||
artifact.ExtraFormat: "tar.gz",
|
||||
artifact.ExtraBinaries: []string{"name"},
|
||||
},
|
||||
})
|
||||
|
||||
f, err := os.Create(path)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, f.Close())
|
||||
client := client.NewMock()
|
||||
distFile := filepath.Join(folder, name+".lua")
|
||||
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
if tt.expectedPublishError != "" {
|
||||
require.EqualError(t, publishAll(ctx, client), tt.expectedPublishError)
|
||||
return
|
||||
}
|
||||
|
||||
require.NoError(t, publishAll(ctx, client))
|
||||
require.True(t, client.CreatedFile)
|
||||
golden.RequireEqualLua(t, []byte(client.Content))
|
||||
|
||||
distBts, err := os.ReadFile(distFile)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, client.Content, string(distBts))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunPipeUniversalBinary(t *testing.T) {
|
||||
folder := t.TempDir()
|
||||
ctx := &context.Context{
|
||||
Git: context.GitInfo{
|
||||
CurrentTag: "v1.0.1",
|
||||
},
|
||||
Version: "1.0.1",
|
||||
Artifacts: artifact.New(),
|
||||
Config: config.Project{
|
||||
Dist: folder,
|
||||
ProjectName: "unibin",
|
||||
Rigs: []config.GoFish{
|
||||
{
|
||||
Name: "unibin",
|
||||
Rig: config.RepoRef{
|
||||
Owner: "unibin",
|
||||
Name: "bar",
|
||||
},
|
||||
IDs: []string{
|
||||
"unibin",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
path := filepath.Join(folder, "bin.tar.gz")
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "unibin.tar.gz",
|
||||
Path: path,
|
||||
Goos: "darwin",
|
||||
Goarch: "all",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: "unibin",
|
||||
artifact.ExtraFormat: "tar.gz",
|
||||
artifact.ExtraBinaries: []string{"unibin"},
|
||||
artifact.ExtraReplaces: true,
|
||||
},
|
||||
})
|
||||
|
||||
f, err := os.Create(path)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, f.Close())
|
||||
client := client.NewMock()
|
||||
distFile := filepath.Join(folder, "unibin.lua")
|
||||
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
require.NoError(t, publishAll(ctx, client))
|
||||
require.True(t, client.CreatedFile)
|
||||
golden.RequireEqualLua(t, []byte(client.Content))
|
||||
distBts, err := os.ReadFile(distFile)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, client.Content, string(distBts))
|
||||
}
|
||||
|
||||
func TestRunPipeUniversalBinaryNotReplacing(t *testing.T) {
|
||||
folder := t.TempDir()
|
||||
ctx := &context.Context{
|
||||
Git: context.GitInfo{
|
||||
CurrentTag: "v1.0.1",
|
||||
},
|
||||
Version: "1.0.1",
|
||||
Artifacts: artifact.New(),
|
||||
Config: config.Project{
|
||||
Dist: folder,
|
||||
ProjectName: "unibin",
|
||||
Rigs: []config.GoFish{
|
||||
{
|
||||
Name: "unibin",
|
||||
Rig: config.RepoRef{
|
||||
Owner: "unibin",
|
||||
Name: "bar",
|
||||
},
|
||||
IDs: []string{
|
||||
"unibin",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
path := filepath.Join(folder, "bin.tar.gz")
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "unibin_amd64.tar.gz",
|
||||
Path: path,
|
||||
Goos: "darwin",
|
||||
Goarch: "amd64",
|
||||
Goamd64: "v1",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: "unibin",
|
||||
artifact.ExtraFormat: "tar.gz",
|
||||
artifact.ExtraBinaries: []string{"unibin"},
|
||||
},
|
||||
})
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "unibin_arm64.tar.gz",
|
||||
Path: path,
|
||||
Goos: "darwin",
|
||||
Goarch: "arm64",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: "unibin",
|
||||
artifact.ExtraFormat: "tar.gz",
|
||||
artifact.ExtraBinaries: []string{"unibin"},
|
||||
},
|
||||
})
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "unibin.tar.gz",
|
||||
Path: path,
|
||||
Goos: "darwin",
|
||||
Goarch: "all",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: "unibin",
|
||||
artifact.ExtraFormat: "tar.gz",
|
||||
artifact.ExtraBinaries: []string{"unibin"},
|
||||
artifact.ExtraReplaces: false,
|
||||
},
|
||||
})
|
||||
|
||||
f, err := os.Create(path)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, f.Close())
|
||||
client := client.NewMock()
|
||||
distFile := filepath.Join(folder, "unibin.lua")
|
||||
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
require.NoError(t, publishAll(ctx, client))
|
||||
require.True(t, client.CreatedFile)
|
||||
golden.RequireEqualLua(t, []byte(client.Content))
|
||||
distBts, err := os.ReadFile(distFile)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, client.Content, string(distBts))
|
||||
}
|
||||
|
||||
func TestRunPipeNameTemplate(t *testing.T) {
|
||||
folder := t.TempDir()
|
||||
ctx := &context.Context{
|
||||
Git: context.GitInfo{
|
||||
CurrentTag: "v1.0.1",
|
||||
},
|
||||
Version: "1.0.1",
|
||||
Artifacts: artifact.New(),
|
||||
Env: map[string]string{
|
||||
"FOO_BAR": "is_bar",
|
||||
},
|
||||
Config: config.Project{
|
||||
Dist: folder,
|
||||
ProjectName: "foo",
|
||||
Rigs: []config.GoFish{
|
||||
{
|
||||
Name: "foo_{{ .Env.FOO_BAR }}",
|
||||
Rig: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
IDs: []string{
|
||||
"foo",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
path := filepath.Join(folder, "bin.tar.gz")
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "bin.tar.gz",
|
||||
Path: path,
|
||||
Goos: "darwin",
|
||||
Goarch: "amd64",
|
||||
Goamd64: "v1",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: "foo",
|
||||
artifact.ExtraFormat: "tar.gz",
|
||||
artifact.ExtraBinaries: []string{"foo"},
|
||||
},
|
||||
})
|
||||
|
||||
f, err := os.Create(path)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, f.Close())
|
||||
client := client.NewMock()
|
||||
distFile := filepath.Join(folder, "foo_is_bar.lua")
|
||||
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
require.NoError(t, publishAll(ctx, client))
|
||||
require.True(t, client.CreatedFile)
|
||||
golden.RequireEqualLua(t, []byte(client.Content))
|
||||
distBts, err := os.ReadFile(distFile)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, client.Content, string(distBts))
|
||||
}
|
||||
|
||||
func TestRunPipeMultipleGoFishWithSkip(t *testing.T) {
|
||||
folder := t.TempDir()
|
||||
ctx := &context.Context{
|
||||
Git: context.GitInfo{
|
||||
CurrentTag: "v1.0.1",
|
||||
},
|
||||
Version: "1.0.1",
|
||||
Artifacts: artifact.New(),
|
||||
Env: map[string]string{
|
||||
"FOO_BAR": "is_bar",
|
||||
},
|
||||
Config: config.Project{
|
||||
Dist: folder,
|
||||
ProjectName: "foo",
|
||||
Rigs: []config.GoFish{
|
||||
{
|
||||
Name: "foo",
|
||||
Rig: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
IDs: []string{
|
||||
"foo",
|
||||
},
|
||||
SkipUpload: "true",
|
||||
},
|
||||
{
|
||||
Name: "bar",
|
||||
Rig: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
IDs: []string{
|
||||
"foo",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "foobar",
|
||||
Rig: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
IDs: []string{
|
||||
"foo",
|
||||
},
|
||||
SkipUpload: "true",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
path := filepath.Join(folder, "bin.tar.gz")
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "bin.tar.gz",
|
||||
Path: path,
|
||||
Goos: "darwin",
|
||||
Goarch: "amd64",
|
||||
Goamd64: "v1",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: "foo",
|
||||
artifact.ExtraFormat: "tar.gz",
|
||||
artifact.ExtraBinaries: []string{"foo"},
|
||||
},
|
||||
})
|
||||
|
||||
f, err := os.Create(path)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, f.Close())
|
||||
|
||||
cli := client.NewMock()
|
||||
require.NoError(t, runAll(ctx, cli))
|
||||
require.EqualError(t, publishAll(ctx, cli), `rig.skip_upload is set`)
|
||||
require.True(t, cli.CreatedFile)
|
||||
|
||||
for _, food := range ctx.Config.Rigs {
|
||||
distFile := filepath.Join(folder, food.Name+".lua")
|
||||
_, err := os.Stat(distFile)
|
||||
require.NoError(t, err, "file should exist: "+distFile)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunPipeForMultipleArmVersions(t *testing.T) {
|
||||
for name, fn := range map[string]func(ctx *context.Context){
|
||||
"multiple_armv5": func(ctx *context.Context) {
|
||||
ctx.Config.Rigs[0].Goarm = "5"
|
||||
},
|
||||
"multiple_armv6": func(ctx *context.Context) {
|
||||
ctx.Config.Rigs[0].Goarm = "6"
|
||||
},
|
||||
"multiple_armv7": func(ctx *context.Context) {
|
||||
ctx.Config.Rigs[0].Goarm = "7"
|
||||
},
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
folder := t.TempDir()
|
||||
ctx := &context.Context{
|
||||
TokenType: context.TokenTypeGitHub,
|
||||
Git: context.GitInfo{
|
||||
CurrentTag: "v1.0.1",
|
||||
},
|
||||
Version: "1.0.1",
|
||||
Artifacts: artifact.New(),
|
||||
Env: map[string]string{
|
||||
"FOO": "foo_is_bar",
|
||||
},
|
||||
Config: config.Project{
|
||||
Dist: folder,
|
||||
ProjectName: name,
|
||||
Rigs: []config.GoFish{
|
||||
{
|
||||
Name: name,
|
||||
Description: "A run pipe test fish food and FOO={{ .Env.FOO }}",
|
||||
Rig: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
Homepage: "https://github.com/goreleaser",
|
||||
},
|
||||
},
|
||||
GitHubURLs: config.GitHubURLs{
|
||||
Download: "https://github.com",
|
||||
},
|
||||
Release: config.Release{
|
||||
GitHub: config.Repo{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
fn(ctx)
|
||||
for _, a := range []struct {
|
||||
name string
|
||||
goos string
|
||||
goarch string
|
||||
goarm string
|
||||
}{
|
||||
{
|
||||
name: "bin",
|
||||
goos: "darwin",
|
||||
goarch: "amd64",
|
||||
},
|
||||
{
|
||||
name: "arm64",
|
||||
goos: "linux",
|
||||
goarch: "arm64",
|
||||
},
|
||||
{
|
||||
name: "armv5",
|
||||
goos: "linux",
|
||||
goarch: "arm",
|
||||
goarm: "5",
|
||||
},
|
||||
{
|
||||
name: "armv6",
|
||||
goos: "linux",
|
||||
goarch: "arm",
|
||||
goarm: "6",
|
||||
},
|
||||
{
|
||||
name: "armv7",
|
||||
goos: "linux",
|
||||
goarch: "arm",
|
||||
goarm: "7",
|
||||
},
|
||||
} {
|
||||
path := filepath.Join(folder, fmt.Sprintf("%s.tar.gz", a.name))
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: fmt.Sprintf("%s.tar.gz", a.name),
|
||||
Path: path,
|
||||
Goos: a.goos,
|
||||
Goarch: a.goarch,
|
||||
Goarm: a.goarm,
|
||||
Goamd64: "v1",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: a.name,
|
||||
artifact.ExtraFormat: "tar.gz",
|
||||
artifact.ExtraBinaries: []string{"foo"},
|
||||
},
|
||||
})
|
||||
f, err := os.Create(path)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, f.Close())
|
||||
}
|
||||
|
||||
client := client.NewMock()
|
||||
distFile := filepath.Join(folder, name+".lua")
|
||||
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
require.NoError(t, publishAll(ctx, client))
|
||||
require.True(t, client.CreatedFile)
|
||||
golden.RequireEqualLua(t, []byte(client.Content))
|
||||
|
||||
distBts, err := os.ReadFile(distFile)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, client.Content, string(distBts))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunPipeNoBuilds(t *testing.T) {
|
||||
ctx := &context.Context{
|
||||
TokenType: context.TokenTypeGitHub,
|
||||
Config: config.Project{
|
||||
Rigs: []config.GoFish{
|
||||
{
|
||||
Rig: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
client := client.NewMock()
|
||||
require.Equal(t, ErrNoArchivesFound, runAll(ctx, client))
|
||||
require.False(t, client.CreatedFile)
|
||||
}
|
||||
|
||||
func TestRunPipeBinaryRelease(t *testing.T) {
|
||||
folder := t.TempDir()
|
||||
ctx := &context.Context{
|
||||
Git: context.GitInfo{
|
||||
CurrentTag: "v1.2.1",
|
||||
},
|
||||
Version: "1.2.1",
|
||||
Artifacts: artifact.New(),
|
||||
Config: config.Project{
|
||||
Dist: folder,
|
||||
ProjectName: "foo",
|
||||
Rigs: []config.GoFish{
|
||||
{
|
||||
Name: "foo",
|
||||
Rig: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
path := filepath.Join(folder, "dist/foo_darwin_all/foo")
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "foo_macos",
|
||||
Path: path,
|
||||
Goos: "darwin",
|
||||
Goarch: "all",
|
||||
Type: artifact.UploadableBinary,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: "foo",
|
||||
artifact.ExtraFormat: "binary",
|
||||
artifact.ExtraBinary: "foo",
|
||||
},
|
||||
})
|
||||
|
||||
require.NoError(t, os.MkdirAll(filepath.Dir(path), 0o755))
|
||||
f, err := os.Create(path)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, f.Close())
|
||||
|
||||
client := client.NewMock()
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
require.NoError(t, publishAll(ctx, client))
|
||||
require.True(t, client.CreatedFile)
|
||||
golden.RequireEqualRb(t, []byte(client.Content))
|
||||
}
|
||||
|
||||
func TestRunPipeNoUpload(t *testing.T) {
|
||||
folder := t.TempDir()
|
||||
ctx := context.New(config.Project{
|
||||
Dist: folder,
|
||||
ProjectName: "foo",
|
||||
Release: config.Release{},
|
||||
Rigs: []config.GoFish{
|
||||
{
|
||||
Rig: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
ctx.TokenType = context.TokenTypeGitHub
|
||||
ctx.Git = context.GitInfo{CurrentTag: "v1.0.1"}
|
||||
path := filepath.Join(folder, "whatever.tar.gz")
|
||||
f, err := os.Create(path)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, f.Close())
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "bin",
|
||||
Path: path,
|
||||
Goos: "darwin",
|
||||
Goarch: "amd64",
|
||||
Goamd64: "v1",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: "foo",
|
||||
artifact.ExtraFormat: "tar.gz",
|
||||
artifact.ExtraBinaries: []string{"foo"},
|
||||
},
|
||||
})
|
||||
client := client.NewMock()
|
||||
|
||||
assertNoPublish := func(t *testing.T) {
|
||||
t.Helper()
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
testlib.AssertSkipped(t, publishAll(ctx, client))
|
||||
require.False(t, client.CreatedFile)
|
||||
}
|
||||
t.Run("skip upload true", func(t *testing.T) {
|
||||
ctx.Config.Rigs[0].SkipUpload = "true"
|
||||
ctx.Semver.Prerelease = ""
|
||||
assertNoPublish(t)
|
||||
})
|
||||
t.Run("skip upload auto", func(t *testing.T) {
|
||||
ctx.Config.Rigs[0].SkipUpload = "auto"
|
||||
ctx.Semver.Prerelease = "beta1"
|
||||
assertNoPublish(t)
|
||||
})
|
||||
}
|
||||
|
||||
func TestRunEmptyTokenType(t *testing.T) {
|
||||
folder := t.TempDir()
|
||||
ctx := context.New(config.Project{
|
||||
Dist: folder,
|
||||
ProjectName: "foo",
|
||||
Release: config.Release{},
|
||||
Rigs: []config.GoFish{
|
||||
{
|
||||
Rig: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
ctx.Git = context.GitInfo{CurrentTag: "v1.0.1"}
|
||||
path := filepath.Join(folder, "whatever.tar.gz")
|
||||
f, err := os.Create(path)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, f.Close())
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "bin",
|
||||
Path: path,
|
||||
Goos: "darwin",
|
||||
Goarch: "amd64",
|
||||
Goamd64: "v1",
|
||||
Type: artifact.UploadableArchive,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: "foo",
|
||||
artifact.ExtraFormat: "tar.gz",
|
||||
},
|
||||
})
|
||||
client := client.NewMock()
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
}
|
||||
|
||||
func TestDefault(t *testing.T) {
|
||||
testlib.Mktmp(t)
|
||||
|
||||
ctx := &context.Context{
|
||||
TokenType: context.TokenTypeGitHub,
|
||||
Config: config.Project{
|
||||
ProjectName: "myproject",
|
||||
Rigs: []config.GoFish{
|
||||
{},
|
||||
},
|
||||
},
|
||||
}
|
||||
require.NoError(t, Pipe{}.Default(ctx))
|
||||
require.Equal(t, ctx.Config.ProjectName, ctx.Config.Rigs[0].Name)
|
||||
require.NotEmpty(t, ctx.Config.Rigs[0].CommitAuthor.Name)
|
||||
require.NotEmpty(t, ctx.Config.Rigs[0].CommitAuthor.Email)
|
||||
require.NotEmpty(t, ctx.Config.Rigs[0].CommitMessageTemplate)
|
||||
}
|
||||
|
||||
func TestGHFolder(t *testing.T) {
|
||||
require.Equal(t, "bar.lua", buildFoodPath("", "bar.lua"))
|
||||
require.Equal(t, "fooo/bar.lua", buildFoodPath("fooo", "bar.lua"))
|
||||
}
|
||||
|
||||
func TestSkip(t *testing.T) {
|
||||
t.Run("skip", func(t *testing.T) {
|
||||
require.True(t, Pipe{}.Skip(context.New(config.Project{})))
|
||||
})
|
||||
|
||||
t.Run("dont skip", func(t *testing.T) {
|
||||
ctx := context.New(config.Project{
|
||||
Rigs: []config.GoFish{
|
||||
{},
|
||||
},
|
||||
})
|
||||
require.False(t, Pipe{}.Skip(ctx))
|
||||
})
|
||||
}
|
||||
|
||||
func TestRunSkipNoName(t *testing.T) {
|
||||
ctx := context.New(config.Project{
|
||||
Rigs: []config.GoFish{{}},
|
||||
})
|
||||
|
||||
client := client.NewMock()
|
||||
testlib.AssertSkipped(t, runAll(ctx, client))
|
||||
}
|
@ -1,147 +0,0 @@
|
||||
local name = "Test"
|
||||
local version = "0.1.3"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "Some desc",
|
||||
license = "MIT",
|
||||
homepage = "https://google.com",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "amd64",
|
||||
url = "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Darwin_x86_64.tar.gz",
|
||||
sha256 = "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68",
|
||||
resources = {
|
||||
{
|
||||
path = "bin1",
|
||||
installpath = "bin/bin1",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin2",
|
||||
installpath = "bin/bin2",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin3",
|
||||
installpath = "bin/bin3",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "arm64",
|
||||
url = "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Darwin_arm64.tar.gz",
|
||||
sha256 = "1633f61598ab0791e213135923624eb342196b349490sadasdsadsadasdasdsd",
|
||||
resources = {
|
||||
{
|
||||
path = "bin1",
|
||||
installpath = "bin/bin1",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin2",
|
||||
installpath = "bin/bin2",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin3",
|
||||
installpath = "bin/bin3",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "linux",
|
||||
arch = "amd64",
|
||||
url = "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz",
|
||||
sha256 = "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
resources = {
|
||||
{
|
||||
path = "bin1",
|
||||
installpath = "bin/bin1",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin2",
|
||||
installpath = "bin/bin2",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin3",
|
||||
installpath = "bin/bin3",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "linux",
|
||||
arch = "arm",
|
||||
url = "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm6.tar.gz",
|
||||
sha256 = "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
resources = {
|
||||
{
|
||||
path = "bin1",
|
||||
installpath = "bin/bin1",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin2",
|
||||
installpath = "bin/bin2",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin3",
|
||||
installpath = "bin/bin3",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "linux",
|
||||
arch = "arm64",
|
||||
url = "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm64.tar.gz",
|
||||
sha256 = "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
resources = {
|
||||
{
|
||||
path = "bin1",
|
||||
installpath = "bin/bin1",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin2",
|
||||
installpath = "bin/bin2",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin3",
|
||||
installpath = "bin/bin3",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "windows",
|
||||
arch = "amd64",
|
||||
url = "https://github.com/caarlos0/test/releases/download/v0.1.3/test_windows_amd64.zip",
|
||||
sha256 = "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
resources = {
|
||||
{
|
||||
path = "bin1.exe",
|
||||
installpath = "bin\\bin1.exe",
|
||||
},
|
||||
{
|
||||
path = "bin2.exe",
|
||||
installpath = "bin\\bin2.exe",
|
||||
},
|
||||
{
|
||||
path = "bin3.exe",
|
||||
installpath = "bin\\bin3.exe",
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
local name = "Test"
|
||||
local version = "0.1.3"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "Some desc",
|
||||
license = "",
|
||||
homepage = "https://google.com",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "linux",
|
||||
arch = "amd64",
|
||||
url = "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz",
|
||||
sha256 = "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
resources = {
|
||||
{
|
||||
path = "bin1",
|
||||
installpath = "bin/bin1",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin2",
|
||||
installpath = "bin/bin2",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin3",
|
||||
installpath = "bin/bin3",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "linux",
|
||||
arch = "arm",
|
||||
url = "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm6.tar.gz",
|
||||
sha256 = "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
resources = {
|
||||
{
|
||||
path = "bin1",
|
||||
installpath = "bin/bin1",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin2",
|
||||
installpath = "bin/bin2",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin3",
|
||||
installpath = "bin/bin3",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "linux",
|
||||
arch = "arm64",
|
||||
url = "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm64.tar.gz",
|
||||
sha256 = "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
resources = {
|
||||
{
|
||||
path = "bin1",
|
||||
installpath = "bin/bin1",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin2",
|
||||
installpath = "bin/bin2",
|
||||
executable = true
|
||||
},
|
||||
{
|
||||
path = "bin3",
|
||||
installpath = "bin/bin3",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
local name = "Test"
|
||||
local version = "0.1.3"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "Some desc",
|
||||
license = "",
|
||||
homepage = "https://google.com",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "windows",
|
||||
arch = "amd64",
|
||||
url = "https://github.com/caarlos0/test/releases/download/v0.1.3/test_windows_amd64.zip",
|
||||
sha256 = "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
resources = {
|
||||
{
|
||||
path = "bin1.exe",
|
||||
installpath = "bin\\bin1.exe",
|
||||
},
|
||||
{
|
||||
path = "bin2.exe",
|
||||
installpath = "bin\\bin2.exe",
|
||||
},
|
||||
{
|
||||
path = "bin3.exe",
|
||||
installpath = "bin\\bin3.exe",
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
local name = "default"
|
||||
local version = "1.0.1"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "A run pipe test fish food and FOO=foo_is_bar",
|
||||
license = "",
|
||||
homepage = "https://github.com/goreleaser",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "amd64",
|
||||
url = "https://dummyhost/download/v1.0.1/bin.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "name",
|
||||
installpath = "bin/name",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
local name = "default_gitlab"
|
||||
local version = "1.0.1"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "A run pipe test fish food and FOO=foo_is_bar",
|
||||
license = "",
|
||||
homepage = "https://gitlab.com/goreleaser",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "amd64",
|
||||
url = "https://dummyhost/download/v1.0.1/bin.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "name",
|
||||
installpath = "bin/name",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
local name = "foo"
|
||||
local version = "1.2.1"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "",
|
||||
license = "",
|
||||
homepage = "",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "amd64",
|
||||
url = "https://dummyhost/download/v1.2.1/foo_macos",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo_macos",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "arm64",
|
||||
url = "https://dummyhost/download/v1.2.1/foo_macos",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo_macos",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
local name = "multiple_armv5"
|
||||
local version = "1.0.1"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "A run pipe test fish food and FOO=foo_is_bar",
|
||||
license = "",
|
||||
homepage = "https://github.com/goreleaser",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "amd64",
|
||||
url = "https://dummyhost/download/v1.0.1/bin.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "linux",
|
||||
arch = "arm64",
|
||||
url = "https://dummyhost/download/v1.0.1/arm64.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "linux",
|
||||
arch = "arm",
|
||||
url = "https://dummyhost/download/v1.0.1/armv5.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
local name = "multiple_armv6"
|
||||
local version = "1.0.1"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "A run pipe test fish food and FOO=foo_is_bar",
|
||||
license = "",
|
||||
homepage = "https://github.com/goreleaser",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "amd64",
|
||||
url = "https://dummyhost/download/v1.0.1/bin.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "linux",
|
||||
arch = "arm64",
|
||||
url = "https://dummyhost/download/v1.0.1/arm64.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "linux",
|
||||
arch = "arm",
|
||||
url = "https://dummyhost/download/v1.0.1/armv6.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
local name = "multiple_armv7"
|
||||
local version = "1.0.1"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "A run pipe test fish food and FOO=foo_is_bar",
|
||||
license = "",
|
||||
homepage = "https://github.com/goreleaser",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "amd64",
|
||||
url = "https://dummyhost/download/v1.0.1/bin.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "linux",
|
||||
arch = "arm64",
|
||||
url = "https://dummyhost/download/v1.0.1/arm64.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "linux",
|
||||
arch = "arm",
|
||||
url = "https://dummyhost/download/v1.0.1/armv7.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
local name = "foo_is_bar"
|
||||
local version = "1.0.1"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "",
|
||||
license = "",
|
||||
homepage = "",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "amd64",
|
||||
url = "https://dummyhost/download/v1.0.1/bin.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "foo",
|
||||
installpath = "bin/foo",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
local name = "unibin"
|
||||
local version = "1.0.1"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "",
|
||||
license = "",
|
||||
homepage = "",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "amd64",
|
||||
url = "https://dummyhost/download/v1.0.1/unibin.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "unibin",
|
||||
installpath = "bin/unibin",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "arm64",
|
||||
url = "https://dummyhost/download/v1.0.1/unibin.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "unibin",
|
||||
installpath = "bin/unibin",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
local name = "unibin"
|
||||
local version = "1.0.1"
|
||||
|
||||
food = {
|
||||
name = name,
|
||||
description = "",
|
||||
license = "",
|
||||
homepage = "",
|
||||
version = version,
|
||||
packages = {
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "amd64",
|
||||
url = "https://dummyhost/download/v1.0.1/unibin_amd64.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "unibin",
|
||||
installpath = "bin/unibin",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
os = "darwin",
|
||||
arch = "arm64",
|
||||
url = "https://dummyhost/download/v1.0.1/unibin_arm64.tar.gz",
|
||||
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
resources = {
|
||||
{
|
||||
path = "unibin",
|
||||
installpath = "bin/unibin",
|
||||
executable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -113,7 +113,7 @@ func TestFullManifest(t *testing.T) {
|
||||
manifest, err := doBuildManifest(data)
|
||||
require.NoError(t, err)
|
||||
|
||||
golden.RequireEqualNakedYaml(t, []byte(manifest))
|
||||
golden.RequireEquaYaml(t, []byte(manifest))
|
||||
requireValidManifest(t)
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ func TestSimple(t *testing.T) {
|
||||
data.Metadata.Name = manifestName(t)
|
||||
manifest, err := doBuildManifest(data)
|
||||
require.NoError(t, err)
|
||||
golden.RequireEqualNakedYaml(t, []byte(manifest))
|
||||
golden.RequireEquaYaml(t, []byte(manifest))
|
||||
requireValidManifest(t)
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ func TestFullPipe(t *testing.T) {
|
||||
|
||||
require.NoError(t, err)
|
||||
require.True(t, client.CreatedFile)
|
||||
golden.RequireEqualNakedYaml(t, []byte(client.Content))
|
||||
golden.RequireEquaYaml(t, []byte(client.Content))
|
||||
requireValidManifest(t)
|
||||
|
||||
distBts, err := os.ReadFile(distFile)
|
||||
@ -365,7 +365,7 @@ func TestRunPipeUniversalBinary(t *testing.T) {
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
require.NoError(t, publishAll(ctx, client))
|
||||
require.True(t, client.CreatedFile)
|
||||
golden.RequireEqualNakedYaml(t, []byte(client.Content))
|
||||
golden.RequireEquaYaml(t, []byte(client.Content))
|
||||
requireValidManifest(t)
|
||||
distBts, err := os.ReadFile(distFile)
|
||||
require.NoError(t, err)
|
||||
@ -450,7 +450,7 @@ func TestRunPipeUniversalBinaryNotReplacing(t *testing.T) {
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
require.NoError(t, publishAll(ctx, client))
|
||||
require.True(t, client.CreatedFile)
|
||||
golden.RequireEqualNakedYaml(t, []byte(client.Content))
|
||||
golden.RequireEquaYaml(t, []byte(client.Content))
|
||||
requireValidManifest(t)
|
||||
distBts, err := os.ReadFile(distFile)
|
||||
require.NoError(t, err)
|
||||
@ -512,7 +512,7 @@ func TestRunPipeNameTemplate(t *testing.T) {
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
require.NoError(t, publishAll(ctx, client))
|
||||
require.True(t, client.CreatedFile)
|
||||
golden.RequireEqualNakedYaml(t, []byte(client.Content))
|
||||
golden.RequireEquaYaml(t, []byte(client.Content))
|
||||
requireValidManifest(t)
|
||||
distBts, err := os.ReadFile(distFile)
|
||||
require.NoError(t, err)
|
||||
@ -720,7 +720,7 @@ func TestRunPipeForMultipleArmVersions(t *testing.T) {
|
||||
require.NoError(t, runAll(ctx, client))
|
||||
require.NoError(t, publishAll(ctx, client))
|
||||
require.True(t, client.CreatedFile)
|
||||
golden.RequireEqualNakedYaml(t, []byte(client.Content))
|
||||
golden.RequireEquaYaml(t, []byte(client.Content))
|
||||
requireValidManifest(t)
|
||||
|
||||
distBts, err := os.ReadFile(distFile)
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/brew"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/custompublishers"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/docker"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/gofish"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/krew"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/milestone"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/release"
|
||||
@ -47,7 +46,6 @@ var publishers = []Publisher{
|
||||
// brew et al use the release URL, so, they should be last
|
||||
brew.Pipe{},
|
||||
aur.Pipe{},
|
||||
gofish.Pipe{},
|
||||
krew.Pipe{},
|
||||
scoop.Pipe{},
|
||||
milestone.Pipe{},
|
||||
|
@ -18,7 +18,6 @@ import (
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/effectiveconfig"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/env"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/git"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/gofish"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/gomod"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/krew"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/metadata"
|
||||
@ -80,7 +79,6 @@ var Pipeline = append(
|
||||
sign.Pipe{}, // sign artifacts
|
||||
aur.Pipe{}, // create arch linux aur pkgbuild
|
||||
brew.Pipe{}, // create brew tap
|
||||
gofish.Pipe{}, // create gofish rig
|
||||
krew.Pipe{}, // krew plugins
|
||||
scoop.Pipe{}, // create scoop buckets
|
||||
docker.Pipe{}, // create and push docker images
|
||||
|
@ -147,21 +147,6 @@ type AUR struct {
|
||||
Goamd64 string `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
|
||||
}
|
||||
|
||||
// GoFish contains the gofish section.
|
||||
type GoFish struct {
|
||||
Name string `yaml:"name,omitempty" json:"name,omitempty"`
|
||||
Rig RepoRef `yaml:"rig,omitempty" json:"rig,omitempty"`
|
||||
CommitAuthor CommitAuthor `yaml:"commit_author,omitempty" json:"commit_author,omitempty"`
|
||||
CommitMessageTemplate string `yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty"`
|
||||
Description string `yaml:"description,omitempty" json:"description,omitempty"`
|
||||
Homepage string `yaml:"homepage,omitempty" json:"homepage,omitempty"`
|
||||
License string `yaml:"license,omitempty" json:"license,omitempty"`
|
||||
SkipUpload string `yaml:"skip_upload,omitempty" json:"skip_upload,omitempty"`
|
||||
URLTemplate string `yaml:"url_template,omitempty" json:"url_template,omitempty"`
|
||||
IDs []string `yaml:"ids,omitempty" json:"ids,omitempty"`
|
||||
Goarm string `yaml:"goarm,omitempty" json:"goarm,omitempty"`
|
||||
} // deprecated
|
||||
|
||||
// Homebrew contains the brew section.
|
||||
type Homebrew struct {
|
||||
Name string `yaml:"name,omitempty" json:"name,omitempty"`
|
||||
@ -902,7 +887,6 @@ type Project struct {
|
||||
Release Release `yaml:"release,omitempty" json:"release,omitempty"`
|
||||
Milestones []Milestone `yaml:"milestones,omitempty" json:"milestones,omitempty"`
|
||||
Brews []Homebrew `yaml:"brews,omitempty" json:"brews,omitempty"`
|
||||
Rigs []GoFish `yaml:"rigs,omitempty" json:"rigs,omitempty"` // deprecated
|
||||
AURs []AUR `yaml:"aurs,omitempty" json:"aurs,omitempty"`
|
||||
Krews []Krew `yaml:"krews,omitempty" json:"krews,omitempty"`
|
||||
Scoop Scoop `yaml:"scoop,omitempty" json:"scoop,omitempty"`
|
||||
|
@ -14,7 +14,6 @@ import (
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/checksums"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/discord"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/docker"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/gofish"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/gomod"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/krew"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe/linkedin"
|
||||
@ -73,7 +72,6 @@ var Defaulters = []Defaulter{
|
||||
aur.Pipe{},
|
||||
brew.Pipe{},
|
||||
krew.Pipe{},
|
||||
gofish.Pipe{},
|
||||
scoop.Pipe{},
|
||||
discord.Pipe{},
|
||||
reddit.Pipe{},
|
||||
|
@ -50,7 +50,7 @@ Following environment variables can be used, as environment variable.
|
||||
|
||||
| Name | Description |
|
||||
|------------------|---------------------------------------|
|
||||
| `GITHUB_TOKEN` | [GITHUB_TOKEN](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) for e.g. `brew` or `gofish` |
|
||||
| `GITHUB_TOKEN` | [GITHUB_TOKEN](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) for e.g. `brew` |
|
||||
| `GORELEASER_KEY` | Your [GoReleaser Pro](https://goreleaser.com/pro) License Key, in case you are using the `goreleaser-pro` distribution |
|
||||
|
||||
### Example pipeline
|
||||
|
@ -55,12 +55,6 @@ nFPM will soon make mandatory setting the maintainer field.
|
||||
```
|
||||
|
||||
|
||||
### rigs
|
||||
|
||||
> since 2022-03-21 (v1.8.0)
|
||||
|
||||
GoFish was deprecated by their authors, therefore, we're removing its
|
||||
support from GoReleaser too.
|
||||
|
||||
### dockers.use: buildpacks
|
||||
|
||||
@ -97,6 +91,13 @@ On [GoReleaser PRO](/pro/) custom variables should now be prefixed with `.Var`.
|
||||
|
||||
The following options were deprecated in the past and were already removed.
|
||||
|
||||
### rigs
|
||||
|
||||
> since 2022-03-21 (v1.8.0), removed 2022-08-16 (v1.11.0)
|
||||
|
||||
GoFish was deprecated by their authors, therefore, we're removing its
|
||||
support from GoReleaser too.
|
||||
|
||||
### nfpms.empty_folders
|
||||
|
||||
> since 2021-11-14 (v1.0.0), removed 2022-06-14 (v1.10.0)
|
||||
|
48
www/docs/static/schema.json
generated
vendored
48
www/docs/static/schema.json
generated
vendored
@ -825,48 +825,6 @@
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"GoFish": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"rig": {
|
||||
"$ref": "#/$defs/RepoRef"
|
||||
},
|
||||
"commit_author": {
|
||||
"$ref": "#/$defs/CommitAuthor"
|
||||
},
|
||||
"commit_msg_template": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"homepage": {
|
||||
"type": "string"
|
||||
},
|
||||
"license": {
|
||||
"type": "string"
|
||||
},
|
||||
"skip_upload": {
|
||||
"type": "string"
|
||||
},
|
||||
"url_template": {
|
||||
"type": "string"
|
||||
},
|
||||
"ids": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"goarm": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"GoMod": {
|
||||
"properties": {
|
||||
"proxy": {
|
||||
@ -1592,12 +1550,6 @@
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"rigs": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/GoFish"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"aurs": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/AUR"
|
||||
|
Loading…
Reference in New Issue
Block a user