Add the ReleaseKit source profile
This commit is contained in:
@@ -43,7 +43,7 @@ are prepared. If the new tool dependency itself requires a higher minimum,
|
|||||||
handle that compatibility change together with the cutover rather than
|
handle that compatibility change together with the cutover rather than
|
||||||
leaving the current release checker unusable.
|
leaving the current release checker unusable.
|
||||||
|
|
||||||
## Stage 2: Add ConfigKit's ReleaseKit profile
|
## Stage 2: Add ConfigKit's ReleaseKit profile — Complete
|
||||||
|
|
||||||
1. Add `releasekit.json` at the repository root with `product` set to
|
1. Add `releasekit.json` at the repository root with `product` set to
|
||||||
`ConfigKit`, `remote` set to `origin`, and `expected_push_url` set to
|
`ConfigKit`, `remote` set to `origin`, and `expected_push_url` set to
|
||||||
|
|||||||
12
releasekit.json
Normal file
12
releasekit.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"product": "ConfigKit",
|
||||||
|
"remote": "origin",
|
||||||
|
"expected_push_url": "https://gitea.maximumdirect.net/eric/ConfigKit.git",
|
||||||
|
"validation": {
|
||||||
|
"go": {
|
||||||
|
"race": true,
|
||||||
|
"full_vet": true,
|
||||||
|
"compile_targets": ["linux/amd64", "linux/arm64"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
53
releasekit_profile_test.go
Normal file
53
releasekit_profile_test.go
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
package configkit
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestReleaseKitProfile(t *testing.T) {
|
||||||
|
data, err := os.ReadFile("releasekit.json")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var profile struct {
|
||||||
|
Product string `json:"product"`
|
||||||
|
Remote string `json:"remote"`
|
||||||
|
ExpectedPushURL string `json:"expected_push_url"`
|
||||||
|
Validation struct {
|
||||||
|
Go struct {
|
||||||
|
Race bool `json:"race"`
|
||||||
|
FullVet bool `json:"full_vet"`
|
||||||
|
CompileTargets []string `json:"compile_targets"`
|
||||||
|
} `json:"go"`
|
||||||
|
} `json:"validation"`
|
||||||
|
}
|
||||||
|
|
||||||
|
decoder := json.NewDecoder(bytes.NewReader(data))
|
||||||
|
decoder.DisallowUnknownFields()
|
||||||
|
if err := decoder.Decode(&profile); err != nil {
|
||||||
|
t.Fatalf("decode release profile: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if profile.Product != "ConfigKit" {
|
||||||
|
t.Errorf("product = %q, want ConfigKit", profile.Product)
|
||||||
|
}
|
||||||
|
if profile.Remote != "origin" {
|
||||||
|
t.Errorf("remote = %q, want origin", profile.Remote)
|
||||||
|
}
|
||||||
|
if profile.ExpectedPushURL != "https://gitea.maximumdirect.net/eric/ConfigKit.git" {
|
||||||
|
t.Errorf("expected push URL = %q", profile.ExpectedPushURL)
|
||||||
|
}
|
||||||
|
goValidation := profile.Validation.Go
|
||||||
|
if !goValidation.Race || !goValidation.FullVet {
|
||||||
|
t.Errorf("race and full vet must be selected: race=%t full_vet=%t", goValidation.Race, goValidation.FullVet)
|
||||||
|
}
|
||||||
|
wantTargets := []string{"linux/amd64", "linux/arm64"}
|
||||||
|
if !reflect.DeepEqual(goValidation.CompileTargets, wantTargets) {
|
||||||
|
t.Errorf("compile targets = %v, want %v", goValidation.CompileTargets, wantTargets)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user