I'm SOOO close to having this working, but I don't know enough yaml-foo to see a solution.
It's clear that there's no way to tell coverlet (https://github.com/coverlet-coverage/coverlet) to NOT use a random GUID in the results path:
(from https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/VSTestIntegration.md).
I'm doing a bunch of code coverage reporting and as part of that, I want to generate a GitHub badge for the project using https://github.com/simon-k/dotnet-code-coverage-badge.
My build workflow:
name: Build Terminal.Gui with .NET Core
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings
- name: Create Test Coverage Badge
uses: simon-k/[email protected]
id: create_coverage_badge
with:
label: Unit Test Coverage
color: brightgreen
path: UnitTest/TestResults/<uuid>/coverage.opencover.xml
gist-filename: code-coverage.json
# https://gist.github.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27
gist-id: 90ef67a684cb71db1817921a970f8d27
gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
The badge tool needs a path to the opencover.xml file. I can generate the file just fine, but it ends up on a folder UnitTests/TestResults/<UUID>/coverage.opencover.xml
.
Per the above, I can't (yet, apparently) change VSTest's behavior. So I need to figure out a way of capturing that UUID in the output into a variable and using it in path:
.
That UUID is sitting right there in the test run results and I just need to somehow grab it:
Is this possible? Or, is there some way to do a copy command using a wildcard that would copy the contents of UnitTest/TestResults/*/
to somewhere deterministic?
I've figured it out and am answering my own question in case some other YAML noob has a similar question:
Just use the Linux mv command to move the file: