From d6d52512d69cbac874e9a876bf82fb3ee5f2db75 Mon Sep 17 00:00:00 2001 From: skudasov Date: Fri, 13 Sep 2024 14:25:18 +0200 Subject: [PATCH] cleanup --- RELEASE.md | 6 + .../.changeset/v1.999.0-test-release.md | 5 - .../.changeset/v1.999.1-test-release.md | 5 - scripts/test-package-release.py | 7 - tools/breakingchanges/main_test.go | 126 ------------------ 5 files changed, 6 insertions(+), 143 deletions(-) delete mode 100644 k8s-test-runner/.changeset/v1.999.0-test-release.md delete mode 100644 k8s-test-runner/.changeset/v1.999.1-test-release.md delete mode 100644 tools/breakingchanges/main_test.go diff --git a/RELEASE.md b/RELEASE.md index 47ff2cd2f..6c860c5bd 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -37,6 +37,9 @@ module github.com/smartcontractkit/chainlink-testing-framework/wasp/v2 - Push the tags and visit https://github.com/smartcontractkit/chainlink-testing-framework/releases to check the release. - Check Dependabot pipeline to analyze scope of changes across other repositories +### Binary releases +If your module have `cmd/main.go` we build binary automatically for various platforms and attach it to the release page. + ## Debug Release Pipeline Since some components of pipeline are relying on published Go modules index and Dependabot we have a test script to verify the release pipeline: @@ -46,6 +49,9 @@ nix develop python ./scripts/test-package-release.py -tag k8s-test-runner/v1.999.0-test-release -package ./k8s-test-runner ``` +[Pipeline for releasing Go modules](.github/workflows/release-go-module.yml) +[Dependabot summary pipeline](.github/workflows/dependabot-consumers-summary.yaml) + ## Check breaking changes locally We have a simple wrapper to check breaking changes for all the packages. Commit all your changes and run: ``` diff --git a/k8s-test-runner/.changeset/v1.999.0-test-release.md b/k8s-test-runner/.changeset/v1.999.0-test-release.md deleted file mode 100644 index 09c71890f..000000000 --- a/k8s-test-runner/.changeset/v1.999.0-test-release.md +++ /dev/null @@ -1,5 +0,0 @@ -Initial release of ./k8s-test-runner test runner - -Features added: -- One -- Two diff --git a/k8s-test-runner/.changeset/v1.999.1-test-release.md b/k8s-test-runner/.changeset/v1.999.1-test-release.md deleted file mode 100644 index 09c71890f..000000000 --- a/k8s-test-runner/.changeset/v1.999.1-test-release.md +++ /dev/null @@ -1,5 +0,0 @@ -Initial release of ./k8s-test-runner test runner - -Features added: -- One -- Two diff --git a/scripts/test-package-release.py b/scripts/test-package-release.py index bbb61c049..d16590d60 100644 --- a/scripts/test-package-release.py +++ b/scripts/test-package-release.py @@ -77,16 +77,9 @@ def main(): args = parser.parse_args() - # Remove the specified tag if it exists remove_tag(args.tag) - - # Add release file to the package directory add_release_file(args.package, args.tag) - - # Add (or re-add) the tag add_tag(args.tag) - - # Push remaining changes and all tags push_changes() if __name__ == "__main__": diff --git a/tools/breakingchanges/main_test.go b/tools/breakingchanges/main_test.go deleted file mode 100644 index 4d52a9965..000000000 --- a/tools/breakingchanges/main_test.go +++ /dev/null @@ -1,126 +0,0 @@ -package breakingchanges - -import ( - "bufio" - "bytes" - "os" - "os/exec" - "path/filepath" - "strings" - "testing" -) - -func TestDetectBreakingChanges(t *testing.T) { - t.Skip("This test describe what should be done to test the changes, however, it is infeasible to test because you need a published commit for gorelease to work") - // Create a temporary directory - tempDir, err := os.MkdirTemp("", "testrepo") - if err != nil { - t.Fatalf("Failed to create temp directory: %v", err) - } - defer os.RemoveAll(tempDir) // Clean up - - // Initialize a Git repository - runCommand(t, tempDir, "git", "init") - runCommand(t, tempDir, "git", "config", "user.name", "test") - runCommand(t, tempDir, "git", "config", "user.email", "test@example.com") - - // Configure Git to not use any signing key - runCommand(t, tempDir, "git", "config", "commit.gpgSign", "false") - runCommand(t, tempDir, "git", "config", "tag.gpgSign", "false") - - // Create a simple Go program with an external method - mainGo := `package main - -import "fmt" - -func ExternalMethod(a int, b int) { - fmt.Println(a, b) -} - -func main() { - ExternalMethod(1, 2) -} -` - writeFile(t, tempDir, "main.go", mainGo) - - // Initialize a Go module within the scope of the test - runCommand(t, tempDir, "go", "mod", "init", "github.com/testtest/breaking_changes") - - // Add and commit the initial version - runCommand(t, tempDir, "git", "add", ".") - runCommand(t, tempDir, "git", "commit", "-m", "Initial commit") - initialTag := "github.com/testtest/breaking_changes/v1.0.0" - runCommand(t, tempDir, "git", "tag", initialTag) - - // Modify the ExternalMethod to introduce a breaking change - mainGoV2 := `package main - -import "fmt" - -func ExternalMethod(a int, b int, c int) { - fmt.Println(a, b, c) -} - -func main() { - ExternalMethod(1, 2, 3) -} -` - writeFile(t, tempDir, "main.go", mainGoV2) - - // Add and commit the breaking change - runCommand(t, tempDir, "git", "add", ".") - runCommand(t, tempDir, "git", "commit", "-m", "Introduce breaking change") - runCommand(t, tempDir, "git", "tag", "github.com/testtest/breaking_changes/v1.1.0") - - // Capture the output of DetectBreakingChanges - var output bytes.Buffer - runDetectBreakingChanges(tempDir, initialTag, &output) - - // Scan output lines for "incompatible changes" - scanner := bufio.NewScanner(&output) - foundIncompatibleChanges := false - for scanner.Scan() { - if strings.Contains(scanner.Text(), "incompatible changes") { - foundIncompatibleChanges = true - break - } - } - - if !foundIncompatibleChanges { - t.Errorf("Expected output to contain 'incompatible changes', but got:\n%s", output.String()) - } -} - -// Helper function to run commands -func runCommand(t *testing.T, dir string, name string, args ...string) { - cmd := exec.Command(name, args...) - cmd.Dir = dir - out, err := cmd.CombinedOutput() - if err != nil { - t.Fatalf("Command %s %v failed with error: %v and output: %s", name, args, err, string(out)) - } -} - -// Helper function to write files -func writeFile(t *testing.T, dir, filename, content string) { - filePath := filepath.Join(dir, filename) - err := os.WriteFile(filePath, []byte(content), 0644) - if err != nil { - t.Fatalf("Failed to write file %s: %v", filePath, err) - } -} - -// Helper function to run DetectBreakingChanges and capture output -func runDetectBreakingChanges(dir, baseTag string, output *bytes.Buffer) { - // Temporarily change working directory - originalDir, _ := os.Getwd() - defer os.Chdir(originalDir) - os.Chdir(dir) - - // Run the gorelease command with the base tag - cmd := exec.Command("gorelease", "-base", baseTag) - cmd.Dir = dir - cmd.Stdout = output - cmd.Stderr = output - cmd.Run() -}