Repository: goreleaser/goreleaser
Pull request #3040 (2022-04-14 01:26:07)

fix(ci): dont use krew fork
switch back to main krew as my PR was recently released.  


Patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1b26e566..881a82c7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -83,8 +83,7 @@ jobs:
       - uses: sigstore/cosign-installer@ab3bb6a537fb08a1b78f7d1175fff799ca6850a3 # v2.1.0
       - uses: anchore/sbom-action/download-syft@407a3ec314b07e326eff3ba171091cbc150460a8 # v0.10.0
       - name: setup-validate-krew-manifest
-        # TODO: replace this once https://github.com/kubernetes-sigs/krew/pull/736 is merged
-        run: go install github.com/caarlos0/krew/cmd/validate-krew-manifest@fork
+        run: go install sigs.k8s.io/krew/cmd/validate-krew-manifest@latest
       - run: task ci
       - uses: codecov/codecov-action@e3c560433a6cc60aec8812599b7844a7b4fa0d71 # v3
         with:
diff --git a/.github/workflows/misspell.yml b/.github/workflows/misspell.yml
deleted file mode 100644
index 9b91a5b7..00000000
--- a/.github/workflows/misspell.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: misspell
-on:
-  push:
-    tags:
-      - v*
-    branches:
-      - main
-  pull_request:
-permissions:
-  contents: read
-
-jobs:
-  misspell:
-    permissions:
-      checks: write  # for reviewdog/action-misspell to report issues using checks
-      contents: read  # for actions/checkout to fetch code
-    name: spellcheck
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@b0e28b5ac45a892f91e7d036f8200cf5ed489415 # v3
-      - name: misspell
-        uses: reviewdog/action-misspell@83fd95f00e0c172832739f5b4af713aa809f1436 # v1
-        with:
-          github_token: ${{ secrets.github_token }}
-          locale: "US"
diff --git a/.golangci.yaml b/.golangci.yaml
index a0731d50..dda47b7b 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -11,6 +11,7 @@ linters:
     - revive
     - forbidigo
     - tagliatelle
+    - misspell
 
 linters-settings:
   forbidigo:
diff --git a/internal/pipe/nfpm/nfpm.go b/internal/pipe/nfpm/nfpm.go
index fa420372..c739860c 100644
--- a/internal/pipe/nfpm/nfpm.go
+++ b/internal/pipe/nfpm/nfpm.go
@@ -191,7 +191,7 @@ func create(ctx *context.Context, fpm config.NFPM, format string, binaries []*ar
 		for _, ov := range fpm.Deb.Lintian {
 			lines = append(lines, fmt.Sprintf("%s: %s", fpm.PackageName, ov))
 		}
-		lintianPath := filepath.Join(ctx.Config.Dist, "deb", fpm.PackageName, ".lintian")
+		lintianPath := filepath.Join(ctx.Config.Dist, "deb", fpm.PackageName+"_"+arch, ".lintian")
 		if err := os.MkdirAll(filepath.Dir(lintianPath), 0o755); err != nil {
 			return fmt.Errorf("failed to write lintian file: %w", err)
 		}
@@ -199,7 +199,7 @@ func create(ctx *context.Context, fpm config.NFPM, format string, binaries []*ar
 			return fmt.Errorf("failed to write lintian file: %w", err)
 		}
 
-		log.Infof("creating %q", lintianPath)
+		log.Debugf("creating %q", lintianPath)
 		contents = append(contents, &files.Content{
 			Source:      lintianPath,
 			Destination: filepath.Join("./usr/share/lintian/overrides", fpm.PackageName),


Test patch:
diff --git a/internal/pipe/nfpm/nfpm_test.go b/internal/pipe/nfpm/nfpm_test.go
index 13d2dacf..37706595 100644
--- a/internal/pipe/nfpm/nfpm_test.go
+++ b/internal/pipe/nfpm/nfpm_test.go
@@ -627,85 +627,102 @@ func TestOverrides(t *testing.T) {
 }
 
 func TestDebSpecificConfig(t *testing.T) {
-	folder := t.TempDir()
-	dist := filepath.Join(folder, "dist")
-	require.NoError(t, os.Mkdir(dist, 0o755))
-	require.NoError(t, os.Mkdir(filepath.Join(dist, "mybin"), 0o755))
-	binPath := filepath.Join(dist, "mybin", "mybin")
-	f, err := os.Create(binPath)
-	require.NoError(t, err)
-	require.NoError(t, f.Close())
-	ctx := context.New(config.Project{
-		ProjectName: "mybin",
-		Dist:        dist,
-		NFPMs: []config.NFPM{
-			{
-				ID:      "someid",
-				Builds:  []string{"default"},
-				Formats: []string{"deb"},
-				NFPMOverridables: config.NFPMOverridables{
-					PackageName: "foo",
-					Contents: []*files.Content{
-						{
-							Source:      "testdata/testfile.txt",
-							Destination: "/usr/share/testfile.txt",
-						},
-					},
-					Deb: config.NFPMDeb{
-						Signature: config.NFPMDebSignature{
-							KeyFile: "./testdata/privkey.gpg",
+	setupContext := func(tb testing.TB) *context.Context {
+		tb.Helper()
+		folder := t.TempDir()
+		dist := filepath.Join(folder, "dist")
+		require.NoError(t, os.Mkdir(dist, 0o755))
+		require.NoError(t, os.Mkdir(filepath.Join(dist, "mybin"), 0o755))
+		binPath := filepath.Join(dist, "mybin", "mybin")
+		f, err := os.Create(binPath)
+		require.NoError(t, err)
+		require.NoError(t, f.Close())
+		ctx := context.New(config.Project{
+			ProjectName: "mybin",
+			Dist:        dist,
+			NFPMs: []config.NFPM{
+				{
+					ID:         "someid",
+					Builds:     []string{"default"},
+					Formats:    []string{"deb"},
+					Maintainer: "foo",
+					NFPMOverridables: config.NFPMOverridables{
+						PackageName: "foo",
+						Contents: []*files.Content{
+							{
+								Source:      "testdata/testfile.txt",
+								Destination: "/usr/share/testfile.txt",
+							},
 						},
-						Lintian: []string{
-							"statically-linked-binary",
-							"changelog-file-missing-in-native-package",
+						Deb: config.NFPMDeb{
+							Signature: config.NFPMDebSignature{
+								KeyFile: "./testdata/privkey.gpg",
+							},
 						},
 					},
 				},
 			},
-		},
-	})
-	ctx.Version = "1.0.0"
-	ctx.Git = context.GitInfo{CurrentTag: "v1.0.0"}
-	for _, goos := range []string{"linux", "darwin"} {
-		for _, goarch := range []string{"amd64", "386"} {
-			ctx.Artifacts.Add(&artifact.Artifact{
-				Name:   "mybin",
-				Path:   binPath,
-				Goarch: goarch,
-				Goos:   goos,
-				Type:   artifact.Binary,
-				Extra: map[string]interface{}{
-					artifact.ExtraID: "default",
-				},
-			})
+		})
+		ctx.Version = "1.0.0"
+		ctx.Git = context.GitInfo{CurrentTag: "v1.0.0"}
+		for _, goos := range []string{"linux", "darwin"} {
+			for _, goarch := range []string{"amd64", "386"} {
+				ctx.Artifacts.Add(&artifact.Artifact{
+					Name:   "mybin",
+					Path:   binPath,
+					Goarch: goarch,
+					Goos:   goos,
+					Type:   artifact.Binary,
+					Extra: map[string]interface{}{
+						artifact.ExtraID: "default",
+					},
+				})
+			}
 		}
+		return ctx
 	}
 
 	t.Run("no passphrase set", func(t *testing.T) {
 		require.Contains(
 			t,
-			Pipe{}.Run(ctx).Error(),
+			Pipe{}.Run(setupContext(t)).Error(),
 			`key is encrypted but no passphrase was provided`,
 		)
 	})
 
 	t.Run("general passphrase set", func(t *testing.T) {
+		ctx := setupContext(t)
 		ctx.Env = map[string]string{
 			"NFPM_SOMEID_PASSPHRASE": "hunter2",
 		}
 		require.NoError(t, Pipe{}.Run(ctx))
-
-		bts, err := os.ReadFile(filepath.Join(dist, "deb/foo/.lintian"))
-		require.NoError(t, err)
-		require.Equal(t, "foo: statically-linked-binary\nfoo: changelog-file-missing-in-native-package", string(bts))
 	})
 
 	t.Run("packager specific passphrase set", func(t *testing.T) {
+		ctx := setupContext(t)
 		ctx.Env = map[string]string{
 			"NFPM_SOMEID_DEB_PASSPHRASE": "hunter2",
 		}
 		require.NoError(t, Pipe{}.Run(ctx))
 	})
+
+	t.Run("lintian", func(t *testing.T) {
+		ctx := setupContext(t)
+		ctx.Env = map[string]string{
+			"NFPM_SOMEID_DEB_PASSPHRASE": "hunter2",
+		}
+		ctx.Config.NFPMs[0].NFPMOverridables.Deb.Lintian = []string{
+			"statically-linked-binary",
+			"changelog-file-missing-in-native-package",
+		}
+		require.NoError(t, Pipe{}.Run(ctx))
+
+		for _, goarch := range []string{"amd64", "386"} {
+			bts, err := os.ReadFile(filepath.Join(ctx.Config.Dist, "deb/foo_"+goarch+"/.lintian"))
+			require.NoError(t, err)
+			require.Equal(t, "foo: statically-linked-binary\nfoo: changelog-file-missing-in-native-package", string(bts))
+		}
+	})
 }
 
 func TestRPMSpecificConfig(t *testing.T) {