Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/assets/validate-registry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,29 @@ func main() {
os.Exit(1)
}

validTypes := map[string]bool{
"Arduino": true,
"Contributed": true,
"Partner": true,
"Recommended": true,
"Retired": true,
}

nameMap := make(map[string]bool)
for _, entry := range rawRepos {
// Check entry types
if len(entry.Types) == 0 {
fmt.Fprintf(os.Stderr, "error: Type not specified for library \"%s\"\n", entry.LibraryName)
os.Exit(1)
}
for _, entryType := range entry.Types {
if _, valid := validTypes[entryType]; !valid {
fmt.Fprintf(os.Stderr, "error: Invalid type \"%s\" used by library \"%s\"\n", entryType, entry.LibraryName)
os.Exit(1)
}
}

// Check library name of the entry
if _, found := nameMap[entry.LibraryName]; found {
fmt.Fprintf(os.Stderr, "error: Registry data file contains duplicates of name %s\n", entry.LibraryName)
os.Exit(1)
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/assets/validate-registry/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
("nonexistent.txt", False),
("invalid-data-format.txt", False),
("invalid-url-format.txt", False),
("no-type.txt", False),
("invalid-type.txt", False),
("duplicate-url.txt", False),
("duplicate-name.txt", False),
("valid.txt", True),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/arduino-libraries/Scheduler.git|Arduino|Scheduler
https://github.com/arduino-libraries/SD.git|foo|SD
https://github.com/arduino-libraries/Servo.git|Recommended|Servo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/arduino-libraries/Scheduler.git|Arduino|Scheduler
https://github.com/arduino-libraries/SD.git||SD
https://github.com/arduino-libraries/Servo.git|Recommended|Servo