diff --git a/README.md b/README.md index f9eac314..c054a12c 100644 --- a/README.md +++ b/README.md @@ -340,7 +340,7 @@ instrument the code under test, but not the tester: `bisect-ppx-report` can send reports to [**Coveralls**](https://coveralls.io) and [**Codecov**](https://codecov.io/) directly from **Travis**, **CircleCI**, -and **GitHub Actions**. To do this, run +**GitHub Actions**, and **GitLab**. To do this, run ``` bisect-ppx-report send-to Coveralls @@ -393,6 +393,7 @@ follows: | Jenkins | `jenkins` | `$BUILD_ID` | | Codeship | `codeship` | `$CI_BUILD_NUMBER` | | GitHub Actions | `github` | `$GITHUB_RUN_NUMBER` | +| GitLab | `gitlab` | `$CI_JOB_ID` | Note that Coveralls-style reports are less precise than the HTML reports generated by Bisect_ppx, because Coveralls considers entire lines as visited or diff --git a/src/report/coveralls.ml b/src/report/coveralls.ml index e47bb5e4..d5c27132 100644 --- a/src/report/coveralls.ml +++ b/src/report/coveralls.ml @@ -149,6 +149,7 @@ type ci = [ | `CircleCI | `Travis | `GitHub + | `GitLab ] module CI : @@ -169,22 +170,26 @@ struct environment_variable "CIRCLECI" "true" `CircleCI @@ fun () -> environment_variable "TRAVIS" "true" `Travis @@ fun () -> environment_variable "GITHUB_ACTIONS" "true" `GitHub @@ fun () -> + environment_variable "GITLAB_CI" "true" `GitLab @@ fun () -> None let pretty_name = function | `CircleCI -> "CircleCI" | `Travis -> "Travis" | `GitHub -> "GitHub Actions" + | `GitLab -> "GitLab CI" let name_in_report = function | `CircleCI -> "circleci" | `Travis -> "travis-ci" | `GitHub -> "github" + | `GitLab -> "gitlab" let job_id_variable = function | `CircleCI -> "CIRCLE_BUILD_NUM" | `Travis -> "TRAVIS_JOB_ID" | `GitHub -> "GITHUB_RUN_NUMBER" + | `GitLab -> "CI_JOB_ID" end type coverage_service = [ @@ -220,12 +225,14 @@ struct match ci, service with | `CircleCI, `Coveralls -> Some "CIRCLE_PULL_REQUEST" | `GitHub, `Coveralls -> Some "PULL_REQUEST_NUMBER" + | `GitLab, `Coveralls -> Some "CI_EXTERNAL_PULL_REQUEST_IID" | _ -> None let needs_repo_token ci service = match ci, service with | `CircleCI, `Coveralls -> true | `GitHub, `Coveralls -> true + | `GitLab, `Coveralls -> true | _ -> false let repo_token_variables = function @@ -236,6 +243,7 @@ struct match ci, service with | `CircleCI, `Coveralls -> true | `GitHub, `Coveralls -> true + | `GitLab, `Coveralls -> true | _ -> false end