Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
update 10
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro-neal committed Aug 22, 2024
1 parent 7fce74e commit 7bc929c
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions reports/sdks.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ var (
func GetAllReports() ([]Report, error) {
ctx := context.Background()

err := CheckSubmoduleStatus2(context.Background())
if err != nil {
fmt.Println("Error checking submodufle status: %v", err)
}

var reports []Report
for _, sdk := range SDKs {
slog.Info("Processing: " + sdk.Name)
Expand Down Expand Up @@ -152,11 +157,6 @@ func GetAllReports() ([]Report, error) {
fmt.Println("No Test Vector Suites found.")
}

err = CheckSubmoduleStatus2(context.Background())
if err != nil {
fmt.Println("Error checking submodule status: %v", err)
}

var report Report
if sdk.Name == "web5-rs" {
report, err = sdk.buildReportWeb5Rs(web5TestVectorSuites)
Expand Down Expand Up @@ -346,6 +346,11 @@ func CheckSubmoduleStatus2(ctx context.Context) error {
}

for _, sdk := range SDKs {

// default values
sdk.SubmoduleCommit = "-"
sdk.SubmoduleCommitBehind = -1

owner, repo, _ := strings.Cut(sdk.Repo, "/")

// Determine the submodule path based on the SDK type
Expand All @@ -369,17 +374,19 @@ func CheckSubmoduleStatus2(ctx context.Context) error {

submoduleCommitSHA := *submoduleFileContent.SHA
fmt.Printf("Current submodule commit for %s in %s: %s \n", submodulePath, sdk.Repo, submoduleCommitSHA)
sdk.SubmoduleCommit = submoduleCommitSHA

// Check how far behind the submodule commit is from the allCommits
counter := 0
found := false
for _, commit := range allCommits {
counter++
if *commit.SHA == submoduleCommitSHA {
fmt.Printf("%s is behind by %d commits in %s \n", sdk.Repo, counter, submodulePath)
sdk.SubmoduleCommitBehind = counter
found = true
break
}
counter++
}

if !found {
Expand Down

0 comments on commit 7bc929c

Please sign in to comment.