From c5e8e70b35d7699a6d9dc4f4264ba45f1afe6955 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 4 Feb 2025 02:07:45 +0100 Subject: [PATCH 1/4] chore: generate GitHub Actions assets for v2 --- assets/github-action-config-v2.json | 188 +++++++++++++++++ scripts/gen_github_action_config/main.go | 7 + scripts/gen_github_action_config/main_test.go | 6 + .../testdata/github-action-config-v2.json | 193 ++++++++++++++++++ 4 files changed, 394 insertions(+) create mode 100644 assets/github-action-config-v2.json create mode 100644 scripts/gen_github_action_config/testdata/github-action-config-v2.json diff --git a/assets/github-action-config-v2.json b/assets/github-action-config-v2.json new file mode 100644 index 000000000000..ea02764b05e9 --- /dev/null +++ b/assets/github-action-config-v2.json @@ -0,0 +1,188 @@ +{ + "MinorVersionToConfig": { + "latest": {}, + "v1.10": { + "Error": "golangci-lint version 'v1.10' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.11": { + "Error": "golangci-lint version 'v1.11' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.12": { + "Error": "golangci-lint version 'v1.12' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.13": { + "Error": "golangci-lint version 'v1.13' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.14": { + "Error": "golangci-lint version 'v1.14' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.15": { + "Error": "golangci-lint version 'v1.15' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.16": { + "Error": "golangci-lint version 'v1.16' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.17": { + "Error": "golangci-lint version 'v1.17' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.18": { + "Error": "golangci-lint version 'v1.18' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.19": { + "Error": "golangci-lint version 'v1.19' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.20": { + "Error": "golangci-lint version 'v1.20' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.21": { + "Error": "golangci-lint version 'v1.21' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.22": { + "Error": "golangci-lint version 'v1.22' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.23": { + "Error": "golangci-lint version 'v1.23' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.24": { + "Error": "golangci-lint version 'v1.24' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.25": { + "Error": "golangci-lint version 'v1.25' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.26": { + "Error": "golangci-lint version 'v1.26' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.27": { + "Error": "golangci-lint version 'v1.27' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.28": { + "Error": "golangci-lint version 'v1.28' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.29": { + "Error": "golangci-lint version 'v1.29' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.3": { + "Error": "golangci-lint version 'v1.3' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.30": { + "Error": "golangci-lint version 'v1.30' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.31": { + "Error": "golangci-lint version 'v1.31' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.32": { + "Error": "golangci-lint version 'v1.32' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.33": { + "Error": "golangci-lint version 'v1.33' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.34": { + "Error": "golangci-lint version 'v1.34' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.35": { + "Error": "golangci-lint version 'v1.35' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.36": { + "Error": "golangci-lint version 'v1.36' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.37": { + "Error": "golangci-lint version 'v1.37' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.38": { + "Error": "golangci-lint version 'v1.38' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.39": { + "Error": "golangci-lint version 'v1.39' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.4": { + "Error": "golangci-lint version 'v1.4' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.40": { + "Error": "golangci-lint version 'v1.40' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.41": { + "Error": "golangci-lint version 'v1.41' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.42": { + "Error": "golangci-lint version 'v1.42' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.43": { + "Error": "golangci-lint version 'v1.43' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.44": { + "Error": "golangci-lint version 'v1.44' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.45": { + "Error": "golangci-lint version 'v1.45' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.46": { + "Error": "golangci-lint version 'v1.46' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.47": { + "Error": "golangci-lint version 'v1.47' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.48": { + "Error": "golangci-lint version 'v1.48' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.49": { + "Error": "golangci-lint version 'v1.49' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.5": { + "Error": "golangci-lint version 'v1.5' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.50": { + "Error": "golangci-lint version 'v1.50' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.51": { + "Error": "golangci-lint version 'v1.51' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.52": { + "Error": "golangci-lint version 'v1.52' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.53": { + "Error": "golangci-lint version 'v1.53' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.54": { + "Error": "golangci-lint version 'v1.54' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.55": { + "Error": "golangci-lint version 'v1.55' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.56": { + "Error": "golangci-lint version 'v1.56' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.57": { + "Error": "golangci-lint version 'v1.57' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.58": { + "Error": "golangci-lint version 'v1.58' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.59": { + "Error": "golangci-lint version 'v1.59' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.6": { + "Error": "golangci-lint version 'v1.6' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.60": { + "Error": "golangci-lint version 'v1.60' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.61": { + "Error": "golangci-lint version 'v1.61' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.62": { + "Error": "golangci-lint version 'v1.62' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.63": { + "Error": "golangci-lint version 'v1.63' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.7": { + "Error": "golangci-lint version 'v1.7' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.8": { + "Error": "golangci-lint version 'v1.8' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.9": { + "Error": "golangci-lint version 'v1.9' isn't supported: we support only v2.0.0 and later versions" + } + } +} diff --git a/scripts/gen_github_action_config/main.go b/scripts/gen_github_action_config/main.go index c5597db340b9..7e2cfe44ea22 100644 --- a/scripts/gen_github_action_config/main.go +++ b/scripts/gen_github_action_config/main.go @@ -54,6 +54,13 @@ func run(ctx context.Context) error { return fmt.Errorf("failed to generate v1: %w", err) } + destV2 := filepath.Join(filepath.Dir(dest), strings.TrimSuffix(filepath.Base(dest), ext)+"-v2"+ext) + + err = generate(allReleases, version{major: 2, minor: 0, patch: 0}, destV2) + if err != nil { + return fmt.Errorf("failed to generate v2: %w", err) + } + return nil } diff --git a/scripts/gen_github_action_config/main_test.go b/scripts/gen_github_action_config/main_test.go index 8b9da594a38a..aa110b75ec76 100644 --- a/scripts/gen_github_action_config/main_test.go +++ b/scripts/gen_github_action_config/main_test.go @@ -29,6 +29,12 @@ func Test_buildConfig(t *testing.T) { minVersion: version{major: 1, minor: 28, patch: 3}, expected: "github-action-config-v1.json", }, + { + desc: "v2", + inputPath: "all-releases-v2.json", + minVersion: version{major: 2, minor: 0, patch: 0}, + expected: "github-action-config-v2.json", + }, } for _, test := range testCases { diff --git a/scripts/gen_github_action_config/testdata/github-action-config-v2.json b/scripts/gen_github_action_config/testdata/github-action-config-v2.json new file mode 100644 index 000000000000..510ff98a8ef5 --- /dev/null +++ b/scripts/gen_github_action_config/testdata/github-action-config-v2.json @@ -0,0 +1,193 @@ +{ + "MinorVersionToConfig": { + "latest": { + "TargetVersion": "v2.0.0" + }, + "v1.10": { + "Error": "golangci-lint version 'v1.10' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.11": { + "Error": "golangci-lint version 'v1.11' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.12": { + "Error": "golangci-lint version 'v1.12' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.13": { + "Error": "golangci-lint version 'v1.13' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.14": { + "Error": "golangci-lint version 'v1.14' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.15": { + "Error": "golangci-lint version 'v1.15' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.16": { + "Error": "golangci-lint version 'v1.16' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.17": { + "Error": "golangci-lint version 'v1.17' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.18": { + "Error": "golangci-lint version 'v1.18' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.19": { + "Error": "golangci-lint version 'v1.19' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.20": { + "Error": "golangci-lint version 'v1.20' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.21": { + "Error": "golangci-lint version 'v1.21' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.22": { + "Error": "golangci-lint version 'v1.22' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.23": { + "Error": "golangci-lint version 'v1.23' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.24": { + "Error": "golangci-lint version 'v1.24' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.25": { + "Error": "golangci-lint version 'v1.25' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.26": { + "Error": "golangci-lint version 'v1.26' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.27": { + "Error": "golangci-lint version 'v1.27' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.28": { + "Error": "golangci-lint version 'v1.28' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.29": { + "Error": "golangci-lint version 'v1.29' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.3": { + "Error": "golangci-lint version 'v1.3' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.30": { + "Error": "golangci-lint version 'v1.30' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.31": { + "Error": "golangci-lint version 'v1.31' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.32": { + "Error": "golangci-lint version 'v1.32' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.33": { + "Error": "golangci-lint version 'v1.33' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.34": { + "Error": "golangci-lint version 'v1.34' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.35": { + "Error": "golangci-lint version 'v1.35' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.36": { + "Error": "golangci-lint version 'v1.36' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.37": { + "Error": "golangci-lint version 'v1.37' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.38": { + "Error": "golangci-lint version 'v1.38' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.39": { + "Error": "golangci-lint version 'v1.39' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.4": { + "Error": "golangci-lint version 'v1.4' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.40": { + "Error": "golangci-lint version 'v1.40' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.41": { + "Error": "golangci-lint version 'v1.41' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.42": { + "Error": "golangci-lint version 'v1.42' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.43": { + "Error": "golangci-lint version 'v1.43' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.44": { + "Error": "golangci-lint version 'v1.44' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.45": { + "Error": "golangci-lint version 'v1.45' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.46": { + "Error": "golangci-lint version 'v1.46' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.47": { + "Error": "golangci-lint version 'v1.47' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.48": { + "Error": "golangci-lint version 'v1.48' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.49": { + "Error": "golangci-lint version 'v1.49' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.5": { + "Error": "golangci-lint version 'v1.5' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.50": { + "Error": "golangci-lint version 'v1.50' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.51": { + "Error": "golangci-lint version 'v1.51' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.52": { + "Error": "golangci-lint version 'v1.52' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.53": { + "Error": "golangci-lint version 'v1.53' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.54": { + "Error": "golangci-lint version 'v1.54' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.55": { + "Error": "golangci-lint version 'v1.55' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.56": { + "Error": "golangci-lint version 'v1.56' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.57": { + "Error": "golangci-lint version 'v1.57' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.58": { + "Error": "golangci-lint version 'v1.58' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.59": { + "Error": "golangci-lint version 'v1.59' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.6": { + "Error": "golangci-lint version 'v1.6' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.60": { + "Error": "golangci-lint version 'v1.60' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.61": { + "Error": "golangci-lint version 'v1.61' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.62": { + "Error": "golangci-lint version 'v1.62' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.63": { + "Error": "golangci-lint version 'v1.63' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.7": { + "Error": "golangci-lint version 'v1.7' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.8": { + "Error": "golangci-lint version 'v1.8' isn't supported: we support only v2.0.0 and later versions" + }, + "v1.9": { + "Error": "golangci-lint version 'v1.9' isn't supported: we support only v2.0.0 and later versions" + }, + "v2.0": { + "TargetVersion": "v2.0.0" + } + } +} From 72c02e6bfa0d58d2b8ed7349d65d09ef51c5a213 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sun, 9 Feb 2025 17:39:01 +0100 Subject: [PATCH 2/4] chore: flags assets as generated --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 55f26a1624b2..2b25f38602f0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ go.sum linguist-generated +assets/* linguist-generated * text=auto eol=lf *.ps1 text eol=crlf From 13deb2b28070adee49ace90b24a2a8d3c4b21df9 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 11 Feb 2025 23:35:07 +0100 Subject: [PATCH 3/4] chore: add v1.64 --- assets/github-action-config-v2.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/github-action-config-v2.json b/assets/github-action-config-v2.json index ea02764b05e9..31f0ddb3fab0 100644 --- a/assets/github-action-config-v2.json +++ b/assets/github-action-config-v2.json @@ -175,6 +175,9 @@ "v1.63": { "Error": "golangci-lint version 'v1.63' isn't supported: we support only v2.0.0 and later versions" }, + "v1.64": { + "Error": "golangci-lint version 'v1.64' isn't supported: we support only v2.0.0 and later versions" + }, "v1.7": { "Error": "golangci-lint version 'v1.7' isn't supported: we support only v2.0.0 and later versions" }, From e1c898f9fb6c0a678f1dd31215257c253e05d010 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Fri, 14 Feb 2025 13:09:14 +0100 Subject: [PATCH 4/4] review --- scripts/gen_github_action_config/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_github_action_config/main.go b/scripts/gen_github_action_config/main.go index 7e2cfe44ea22..2324b7de7505 100644 --- a/scripts/gen_github_action_config/main.go +++ b/scripts/gen_github_action_config/main.go @@ -25,7 +25,7 @@ func main() { func run(ctx context.Context) error { if len(os.Args) != 2 { - return fmt.Errorf("usage: go run .../main.go out-path.json") + return fmt.Errorf("usage: %s out-path.json", filepath.Base(os.Args[0])) } allReleases, err := fetchAllReleases(ctx)