Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Twilio to status dashboard #6066

Merged
merged 7 commits into from
Feb 16, 2024
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
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
Loading