-
-
Notifications
You must be signed in to change notification settings - Fork 676
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(releaser): add MODULE.bazel boilerplate
- Loading branch information
1 parent
203aa70
commit 18e43af
Showing
5 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestGenBoilerplate(t *testing.T) { | ||
version := "v1.2.3" | ||
shasum := "abcd1234" | ||
goVersion := "1.23" | ||
rnotesData := "Release notes" | ||
|
||
actual := genBoilerplate(version, shasum, goVersion, rnotesData) | ||
|
||
expectedPath := filepath.Join(".", "testdata", "boilerplate.md") | ||
expectedBytes, err := os.ReadFile(expectedPath) | ||
if err != nil { | ||
t.Fatalf("failed to read expected boilerplate: %v", err) | ||
} | ||
expected := strings.TrimSpace(string(expectedBytes)) | ||
actual = strings.TrimSpace(actual) | ||
|
||
if actual != expected { | ||
t.Errorf("generated boilerplate does not match expected\nExpected:\n%s\nActual:\n%s", expected, actual) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Release notes | ||
|
||
## `MODULE.bazel` code | ||
|
||
``` | ||
bazel_dep(name = "rules_go", version = "1.2.3") | ||
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") | ||
go_sdk.download(version = "1.23") | ||
``` | ||
|
||
## `WORKSPACE` code | ||
|
||
``` | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
http_archive( | ||
name = "io_bazel_rules_go", | ||
sha256 = "abcd1234", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/v1.2.3/rules_go-v1.2.3.zip", | ||
"https://github.com/bazel-contrib/rules_go/releases/download/v1.2.3/rules_go-v1.2.3.zip", | ||
], | ||
) | ||
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") | ||
go_rules_dependencies() | ||
go_register_toolchains(version = "1.23") | ||
``` |