Skip to content

Commit

Permalink
Merge pull request #6066 from RDPerera/main
Browse files Browse the repository at this point in the history
Add Twilio to status dashboard
  • Loading branch information
niveathika authored Feb 16, 2024
2 parents e389df2 + 626c6fc commit a860f71
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
6 changes: 6 additions & 0 deletions dashboard/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ version = "1.0.0"

[build-options]
observabilityIncluded = true

[[dependency]]
org = "ballerinax"
name = "github"
version = "4.6.0"

12 changes: 10 additions & 2 deletions dashboard/graph.bal
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Module record {|
boolean release?;
string[] dependents?;
string gradle_properties?;
boolean display_code_cov_badge?;
|};

public function main() returns error? {
Expand Down Expand Up @@ -105,19 +106,26 @@ function initializeModuleInfo(Module module) returns Module|error {

string versionKey = getVersionKey(module);
string moduleVersion = check getVersion(moduleName, gradleProperties);

boolean displayCodeCovBadge = getDisplayCodeCovBadge(module);
return {
name: moduleName,
module_version: moduleVersion,
level: 1,
default_branch: defaultBranch,
version_key: versionKey,
release: true,
display_code_cov_badge: displayCodeCovBadge,
dependents: [],
gradle_properties: gradleProperties
};
}

function getDisplayCodeCovBadge(Module module) returns boolean {
boolean? displayCodeCovBadge = module.display_code_cov_badge;
if displayCodeCovBadge is boolean {
return displayCodeCovBadge;
}
return true;
}
function getVersionKey(Module module) returns string {
string? versionKey = module.version_key;
if versionKey is string {
Expand Down
2 changes: 1 addition & 1 deletion dashboard/tests/utils_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function getTrivyBadgeTest() {

@test:Config
function getCodecovBadgeTest() {
test:assertEquals(getCodecovBadge(IO_MODULE, "master"), "[![CodeCov](https://codecov.io/gh/ballerina-platform/module-ballerina-io/branch/master/graph/badge.svg)](https://codecov.io/gh/ballerina-platform/module-ballerina-io)");
test:assertEquals(getCodecovBadge(IO_MODULE, "master", true), "[![CodeCov](https://codecov.io/gh/ballerina-platform/module-ballerina-io/branch/master/graph/badge.svg)](https://codecov.io/gh/ballerina-platform/module-ballerina-io)");
}

@test:Config
Expand Down
14 changes: 10 additions & 4 deletions dashboard/utils.bal
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ isolated function getLibraryDashboardRow(Module module, string level) returns st
isolated function getToolsDashboardRow(Module module) returns string|error {
string moduleName = module.name;
string defaultBranch = module.default_branch ?: "";
boolean displayCodeCovBadge = module.display_code_cov_badge ?: true;

string repoLink = getRepoLink(moduleName);
string releaseBadge = getReleaseBadge(moduleName);
string buildStatusBadge = check getBuildStatusBadge(moduleName, defaultBranch);
string trivyBadge = check getTrivyBadge(moduleName, defaultBranch);
string codecovBadge = getCodecovBadge(moduleName, defaultBranch);
string codecovBadge = getCodecovBadge(moduleName, defaultBranch, displayCodeCovBadge);
string bugsBadge = check getBugsBadge(moduleName);
string pullRequestsBadge = getPullRequestsBadge(moduleName);

Expand All @@ -40,11 +41,13 @@ isolated function getToolsDashboardRow(Module module) returns string|error {
isolated function getDashboardRow(Module module) returns string|error {
string moduleName = module.name;
string defaultBranch = module.default_branch ?: "";
boolean displayCodeCovBadge = module.display_code_cov_badge ?: true;

string repoLink = getRepoLink(moduleName);
string releaseBadge = getReleaseBadge(moduleName);
string buildStatusBadge = check getBuildStatusBadge(moduleName, defaultBranch);
string trivyBadge = check getTrivyBadge(moduleName, defaultBranch);
string codecovBadge = getCodecovBadge(moduleName, defaultBranch);
string codecovBadge = getCodecovBadge(moduleName, defaultBranch, displayCodeCovBadge);
string bugsBadge = check getBugsBadge(moduleName);
string pullRequestsBadge = getPullRequestsBadge(moduleName);
string loadTestsBadge;
Expand Down Expand Up @@ -94,9 +97,12 @@ isolated function getTrivyBadge(string moduleName, string defaultBranch) returns
return string `[![Trivy](${badgeUrl})](${repoUrl})`;
}

isolated function getCodecovBadge(string moduleName, string defaultBranch) returns string {
string badgeUrl = string `${CODECOV_BADGE_URL}/${BALLERINA_ORG_NAME}/${moduleName}/branch/${defaultBranch}/graph/badge.svg`;
isolated function getCodecovBadge(string moduleName, string defaultBranch, boolean displayCodeCov) returns string {
string repoUrl = string `${CODECOV_BADGE_URL}/${BALLERINA_ORG_NAME}/${moduleName}`;
string badgeUrl = string `${CODECOV_BADGE_URL}/${BALLERINA_ORG_NAME}/${moduleName}/branch/${defaultBranch}/graph/badge.svg`;
if !displayCodeCov {
badgeUrl = NABADGE;
}
return string `[![CodeCov](${badgeUrl})](${repoUrl})`;
}

Expand Down
1 change: 1 addition & 0 deletions docs/module-owners.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ In the event of a change in ownership, the new owner is accountable for updating
| [tcp](https://github.com/ballerina-platform/module-ballerina-tcp) | [@Bhashinee](https://github.com/Bhashinee) | [@MohamedSabthar](https://github.com/MohamedSabthar) |
| [time](https://github.com/ballerina-platform/module-ballerina-time) | [@sahanHe](https://github.com/sahanHe) | [@daneshk](https://github.com/daneshk) |
| [toml](https://github.com/ballerina-platform/module-ballerina-toml) | [@RDPerera](https://github.com/RDPerera) | |
| [twilio](https://github.com/ballerina-platform/module-ballerinax-twilio) | [@RDPerera](https://github.com/RDPerera) | |
| [udp](https://github.com/ballerina-platform/module-ballerina-udp) | [@Bhashinee](https://github.com/Bhashinee) | [@MohamedSabthar](https://github.com/MohamedSabthar) |
| [url](https://github.com/ballerina-platform/module-ballerina-url) |[@TharmiganK](https://github.com/TharmiganK) |[@ayeshLK](https://github.com/ayeshLK), [@dilanSachi](https://github.com/dilanSachi)|
| [uuid](https://github.com/ballerina-platform/module-ballerina-uuid) | [@daneshk](https://github.com/daneshk) | [@Bhashinee](https://github.com/Bhashinee) |
Expand Down
4 changes: 4 additions & 0 deletions release/resources/module_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@
},
{
"name": "module-ballerinax-aws.redshift"
},
{
"name": "module-ballerinax-twilio",
"display_code_cov_badge": false
}
],
"tools": [
Expand Down

0 comments on commit a860f71

Please sign in to comment.