diff --git a/dashboard/constants.bal b/dashboard/constants.bal index ed8564ff..0e7e10a0 100644 --- a/dashboard/constants.bal +++ b/dashboard/constants.bal @@ -16,7 +16,7 @@ // Names const BALLERINA_ORG_NAME = "ballerina-platform"; -const BALLERINA_STANDARD_LIBRARY = "ballerina-standard-library"; +const BALLERINA_STANDARD_LIBRARY = "ballerina-library"; // Links const BALLERINA_ORG_URL = "https://github.com/ballerina-platform"; @@ -57,5 +57,6 @@ const BALX_TITLE = "## Ballerina Extended Modules"; // Workflow files const WORKFLOW_MASTER_BUILD = "build-timestamped-master.yml"; const WORKFLOW_TRIVY = "trivy-scan.yml"; +const WORKFLOW_MASTER_CI_BUILD = "ci.yml"; const WORKFLOW_PROCESS_LOAD_TESTS = "process-load-test-result.yml"; const WORKFLOW_BAL_TEST_NATIVE = "build-with-bal-test-graalvm.yml"; diff --git a/dashboard/remote.bal b/dashboard/remote.bal index b1245422..fc8320f8 100644 --- a/dashboard/remote.bal +++ b/dashboard/remote.bal @@ -69,7 +69,7 @@ function count(github:Issue issue) { issueCount += 1; } -function openUrl(string page, string url) returns http:Response|error? { +function openUrl(string page, string url) returns http:Response|error { http:Client httpClient = check new (page, config = { auth: { token: os:getEnv(BALLERINA_BOT_TOKEN) diff --git a/dashboard/tests/utils_test.bal b/dashboard/tests/utils_test.bal index 56ba778b..f1cd565c 100644 --- a/dashboard/tests/utils_test.bal +++ b/dashboard/tests/utils_test.bal @@ -2,6 +2,7 @@ import ballerina/test; const IO_MODULE = "module-ballerina-io"; const JAVA_ARRAYS_MODULE = "module-ballerina-jballerina.java.arrays"; +const GMAIL_MODULE = "module-ballerinax-googleapis.gmail"; @test:Config function getRepoLinkTest() { @@ -13,14 +14,20 @@ function getReleaseBadgeTest() { test:assertEquals(getReleaseBadge(IO_MODULE), "[![GitHub Release](https://img.shields.io/github/v/release/ballerina-platform/module-ballerina-io?sort=semver&color=30c955&label=)](https://github.com/ballerina-platform/module-ballerina-io/releases)"); } -@test:Config +@test:Config { + enable: false +} function getBuildStatusBadgeTest() { test:assertEquals(getBuildStatusBadge(IO_MODULE, "master"), "[![Build](https://img.shields.io/github/actions/workflow/status/ballerina-platform/module-ballerina-io/build-timestamped-master.yml?branch=master&label=)](https://github.com/ballerina-platform/module-ballerina-io/actions/workflows/build-timestamped-master.yml)"); + test:assertEquals(getBuildStatusBadge(GMAIL_MODULE, "master"), "[![Build](https://img.shields.io/github/actions/workflow/status/ballerina-platform/module-ballerinax-googleapis.gmail/ci.yml?branch=master&label=)](https://github.com/ballerina-platform/module-ballerinax-googleapis.gmail/actions/workflows/ci.yml)" ); } -@test:Config +@test:Config { + enable: false +} function getTrivyBadgeTest() { test:assertEquals(getTrivyBadge(IO_MODULE, "master"), "[![Trivy](https://img.shields.io/github/actions/workflow/status/ballerina-platform/module-ballerina-io/trivy-scan.yml?branch=master&label=)](https://github.com/ballerina-platform/module-ballerina-io/actions/workflows/trivy-scan.yml)"); + test:assertEquals(getTrivyBadge(GMAIL_MODULE, "master"), "[![Trivy](https://img.shields.io/badge/-N%2FA-yellow)](https://github.com/ballerina-platform/module-ballerinax-googleapis.gmail/actions/workflows/trivy-scan.yml)"); } @test:Config @@ -45,5 +52,5 @@ function getLoadTestsBadgeTest() { enable: false } function getBugsBadgeTest() { - test:assertEquals(getBugsBadge(JAVA_ARRAYS_MODULE), "[![Bugs](https://img.shields.io/github/issues-search/ballerina-platform/ballerina-standard-library?query=is%3Aopen%20label%3Amodule%2Fjava.arrays%20label%3AType%2FBug&label=&color=30c955)](https://github.com/ballerina-platform/ballerina-standard-library/issues?q=is%3Aopen%20label%3Amodule%2Fjava.arrays%20label%3AType%2FBug)"); + test:assertEquals(getBugsBadge(JAVA_ARRAYS_MODULE), "[![Bugs](https://img.shields.io/github/issues-search/ballerina-platform/ballerina-library?query=is%3Aopen%20label%3Amodule%2Fjava.arrays%20label%3AType%2FBug&label=&color=30c955)](https://github.com/ballerina-platform/ballerina-library/issues?q=is%3Aopen%20label%3Amodule%2Fjava.arrays%20label%3AType%2FBug)"); } diff --git a/dashboard/utils.bal b/dashboard/utils.bal index 927701ac..23638155 100644 --- a/dashboard/utils.bal +++ b/dashboard/utils.bal @@ -28,8 +28,8 @@ function getDashboardRow(Module module, string level) returns string|error { } string repoLink = getRepoLink(moduleName); string releaseBadge = getReleaseBadge(moduleName); - string buildStatusBadge = getBuildStatusBadge(moduleName, defaultBranch); - string trivyBadge = getTrivyBadge(moduleName, defaultBranch); + string buildStatusBadge = check getBuildStatusBadge(moduleName, defaultBranch); + string trivyBadge = check getTrivyBadge(moduleName, defaultBranch); string codecovBadge = getCodecovBadge(moduleName, defaultBranch); string bugsBadge = check getBugsBadge(moduleName); string pullRequestsBadge = getPullRequestsBadge(moduleName); @@ -56,15 +56,26 @@ function getReleaseBadge(string moduleName) returns string { return string `[![GitHub Release](${badgeUrl})](${repoUrl})`; } -function getBuildStatusBadge(string moduleName, string defaultBranch) returns string { - string badgeUrl = getGithubBadgeUrl(moduleName, WORKFLOW_MASTER_BUILD, defaultBranch, ""); - string repoUrl = string `${BALLERINA_ORG_URL}/${moduleName}/actions/workflows/${WORKFLOW_MASTER_BUILD}`; +function getBuildStatusBadge(string moduleName, string defaultBranch) returns string|error { + string workflowName = WORKFLOW_MASTER_BUILD; + string workflowFileUrl = string `/${BALLERINA_ORG_NAME}/${moduleName}/master/.github/workflows/${workflowName}`; + http:Response openUrlResponse = check openUrl(GITHUB_RAW_LINK, workflowFileUrl); + if openUrlResponse.statusCode == http:STATUS_NOT_FOUND { + workflowName = WORKFLOW_MASTER_CI_BUILD; + } + string repoUrl = string `${BALLERINA_ORG_URL}/${moduleName}/actions/workflows/${workflowName}`; + string badgeUrl = getGithubBadgeUrl(moduleName, workflowName, defaultBranch, ""); return string `[![Build](${badgeUrl})](${repoUrl})`; } -function getTrivyBadge(string moduleName, string defaultBranch) returns string { +function getTrivyBadge(string moduleName, string defaultBranch) returns string|error { + string workflowFileUrl = string `/${BALLERINA_ORG_NAME}/${moduleName}/master/.github/workflows/${WORKFLOW_TRIVY}`; + http:Response openUrlResponse = check openUrl(GITHUB_RAW_LINK, workflowFileUrl); string badgeUrl = getGithubBadgeUrl(moduleName, WORKFLOW_TRIVY, defaultBranch, ""); string repoUrl = string `${BALLERINA_ORG_URL}/${moduleName}/actions/workflows/${WORKFLOW_TRIVY}`; + if openUrlResponse.statusCode == http:STATUS_NOT_FOUND { + badgeUrl = NABADGE; + } return string `[![Trivy](${badgeUrl})](${repoUrl})`; } diff --git a/release/src/commons/functions.bal b/release/src/commons/functions.bal index b83ea20c..6a1de057 100644 --- a/release/src/commons/functions.bal +++ b/release/src/commons/functions.bal @@ -189,7 +189,7 @@ public function publishModule(Module module, string accessToken, http:Client htt public function checkCurrentPublishWorkflows() { log:printInfo("Checking for already running workflows"); http:Request request = createRequest(); - string apiPath = "/ballerina-standard-library/actions/workflows/build_stdlib_modules.yml/runs?per_page=2"; + string apiPath = "/ballerina-library/actions/workflows/build_stdlib_modules.yml/runs?per_page=2"; var result = trap httpClient->get(apiPath, request); if (result is error) { log:printWarn("Error occurred while checking the current workflow status"); @@ -209,7 +209,7 @@ public function checkCurrentPublishWorkflows() { } function cancelWorkflow(string id) { - string path = "/ballerina-standard-library/actions/runs/" + id + "/cancel"; + string path = "/ballerina-library/actions/runs/" + id + "/cancel"; http:Request request = createRequest(); var result = trap httpClient->post(path, request); if (result is error) { diff --git a/resources/scripts/build_standard_library.py b/resources/scripts/build_standard_library.py index cc90c119..1fbe68e0 100644 --- a/resources/scripts/build_standard_library.py +++ b/resources/scripts/build_standard_library.py @@ -10,7 +10,7 @@ from pathlib import Path from urllib import request -MODULE_LIST = "https://raw.githubusercontent.com/ballerina-platform/ballerina-standard-library/main/release/resources/stdlib_modules.json" +MODULE_LIST = "https://raw.githubusercontent.com/ballerina-platform/ballerina-library/main/release/resources/stdlib_modules.json" # Module Fields FIELD_BRANCH = "branch"