doc: report project metadata update time (#286)
This commit is contained in:
committed by
GitHub
parent
bdaad2bb98
commit
88c126385a
19
tests/thirdparty/config.go
vendored
19
tests/thirdparty/config.go
vendored
@@ -11,6 +11,7 @@ import (
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// GithubRepository specifies a repository on github.
|
||||
@@ -355,7 +356,11 @@ func (p Projects) Top(n int) Projects {
|
||||
|
||||
// Suite defines a third-party test suite.
|
||||
type Suite struct {
|
||||
// Projects to test.
|
||||
Projects Projects `json:"projects"`
|
||||
|
||||
// Time of the last update to project metadata.
|
||||
MetadataLastUpdate time.Time `json:"metadata_last_update"`
|
||||
}
|
||||
|
||||
func (s *Suite) defaults(set bool) {
|
||||
@@ -364,7 +369,19 @@ func (s *Suite) defaults(set bool) {
|
||||
|
||||
// Validate the test suite.
|
||||
func (s *Suite) Validate() error {
|
||||
return s.Projects.Validate()
|
||||
if s.MetadataLastUpdate.IsZero() {
|
||||
return errors.New("empty metadata update time")
|
||||
}
|
||||
|
||||
if s.MetadataLastUpdate.Location() != time.UTC {
|
||||
return errors.New("metadata update time not in UTC")
|
||||
}
|
||||
|
||||
if err := s.Projects.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadSuite loads a test suite from JSON format.
|
||||
|
||||
5
tests/thirdparty/metadata_test.go
vendored
5
tests/thirdparty/metadata_test.go
vendored
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"flag"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/mmcloughlin/avo/internal/github"
|
||||
"github.com/mmcloughlin/avo/internal/test"
|
||||
@@ -50,6 +51,10 @@ func TestSuiteFileMetadata(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if *update {
|
||||
s.MetadataLastUpdate = time.Now().UTC()
|
||||
}
|
||||
|
||||
if err := StoreSuiteFile("suite.json", s); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
15
tests/thirdparty/suite.json
vendored
15
tests/thirdparty/suite.json
vendored
@@ -7,7 +7,7 @@
|
||||
},
|
||||
"metadata": {
|
||||
"description": "XXH3 algorithm in Go",
|
||||
"stars": 240
|
||||
"stars": 241
|
||||
},
|
||||
"default_branch": "master",
|
||||
"version": "v1.0.0-rc1",
|
||||
@@ -145,7 +145,7 @@
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Pure Go implementation of BLAKE3 with AVX2 and SSE4.1 acceleration",
|
||||
"stars": 288
|
||||
"stars": 289
|
||||
},
|
||||
"default_branch": "master",
|
||||
"version": "25dba572f0e78ec108f0dd79c9c15288f542d7d9",
|
||||
@@ -230,7 +230,7 @@
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Optimized Go Compression Packages",
|
||||
"stars": 2894
|
||||
"stars": 2896
|
||||
},
|
||||
"default_branch": "master",
|
||||
"version": "2f236383d7c2faa8ef7e354ccecb926a5b47a24d",
|
||||
@@ -634,7 +634,7 @@
|
||||
"metadata": {
|
||||
"description": "[mirror] Go supplementary cryptography libraries",
|
||||
"homepage": "https://golang.org/x/crypto",
|
||||
"stars": 2416
|
||||
"stars": 2417
|
||||
},
|
||||
"default_branch": "master",
|
||||
"version": "089bfa5675191fd96a44247682f76ebca03d7916",
|
||||
@@ -746,7 +746,7 @@
|
||||
"metadata": {
|
||||
"description": "The Go programming language",
|
||||
"homepage": "https://go.dev",
|
||||
"stars": 98831
|
||||
"stars": 98856
|
||||
},
|
||||
"default_branch": "master",
|
||||
"version": "go1.17.3",
|
||||
@@ -788,7 +788,7 @@
|
||||
"metadata": {
|
||||
"description": "CIRCL: Cloudflare Interoperable Reusable Cryptographic Library",
|
||||
"homepage": "http://blog.cloudflare.com/introducing-circl",
|
||||
"stars": 616
|
||||
"stars": 617
|
||||
},
|
||||
"default_branch": "master",
|
||||
"version": "v1.1.0",
|
||||
@@ -831,5 +831,6 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"metadata_last_update": "2022-05-09T00:15:10.660584088Z"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user