Skip to content

[FOLIO-4572] Go workflow allows test-coverage location to be specifed - #173

Merged
dcrossleyau merged 5 commits into
folio-org:masterfrom
MikeTaylor:FOLIO-4572--configurable-test-coverage-location-go
Sep 22, 2026
Merged

dcrossleyau merged 5 commits into
folio-org:masterfrom
MikeTaylor:FOLIO-4572--configurable-test-coverage-location-go

Conversation

@MikeTaylor

Copy link
Copy Markdown
Contributor

In Java and JS, it's conventional for the source code to be in a src directory and code-coverage information generated by tests to be in src/coverage.*. But in Go, it’s convention for the bulk of the code to be in a directory named after the package it’s in — for example, reporting for mod-reporting — so code-coverage information is in reporting/coverage.*.

This PR extends the Go workflow to support an optional coverage-path parameter (defaulting to the existing hardwired value of src/coverage.*), allowing modules that follow the Go directory layout convention to specify where the converage files are.

(Also: if the files are missing, I think that should be an immediate hard error, rather than letting it slip past so that the subsequent SonarCloud Analysis phase fails, as in
Fix text expecations for root · folio-org/mod-reporting@d911062. Feel free to push back on that part if you disagree.)

Comment thread .github/workflows/go-build.yml Outdated
Comment thread .github/workflows/go-build.yml Outdated
Comment thread .github/workflows/go-build.yml Outdated
I think that we do not need the leading "target/" in the use of the
environment variable that we see in commit ab11aef: that seems to be
just modifying how `make` is run rather than being part of the GitHub
Actions syntax.
@MikeTaylor

Copy link
Copy Markdown
Contributor Author

OK, it looks like this is in decent shape. I'll run a build against it.

@MikeTaylor

Copy link
Copy Markdown
Contributor Author

Hmm, no, it still fails: https://github.com/folio-org/mod-reporting/actions/runs/35361903659/job/106296755084

I suspect the double quotes around $COVERAGE_PATH, which are needed to defeat shell expansion in the case of the make rule above, and not wanted here. I will delete them and try again.

@MikeTaylor

Copy link
Copy Markdown
Contributor Author

Nope — I am still seeing

Error: No files were found with the provided path: $COVERAGE_PATH. No artifacts will be uploaded.
https://github.com/folio-org/mod-reporting/actions/runs/35361903659/job/106301112267

I'm all out of ideas in this area where I lack experience or expertise. Please advise.

@MikeTaylor

Copy link
Copy Markdown
Contributor Author

I spoke too soon, I'm now trying with explicit env-var expansion, ${{ env.COVERAGE_PATH }}.

@MikeTaylor

Copy link
Copy Markdown
Contributor Author

All right, now we're getting somewhere! https://github.com/folio-org/mod-reporting/actions/runs/35361903659/job/106305485611 still fails, but this time it's in the "Run Sonar scan" section, with

10:53:44.116 ERROR Not authorized or project not found. Please check the 'SONAR_TOKEN' environment variable, the 'sonar.projectKey' and 'sonar.organization' properties, or contact the project administrator to verify the token's permissions. A project with the same key may already exist in another organization.

That suggests to me that once this is brought within the folio-org umbrella, the secrets will be available and all should be well.

@dcrossleyau Do you agree?

@dcrossleyau
dcrossleyau merged commit 1088f72 into folio-org:master Sep 22, 2026
2 checks passed
MikeTaylor added a commit to folio-org/mod-reporting that referenced this pull request Sep 22, 2026
This reverts commit 080ecd1.

We no longer need it, since folio-org/.github#173 has been merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants