From d575692fbc3707f18d8c5e777644d30e4873db38 Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Wed, 17 Aug 2022 21:05:24 +0200 Subject: [PATCH 01/11] Add coverlet.collector --- Directory.Packages.props | 1 + .../Silk.NET.Maths.Tests.csproj | 15 ++++++++------- .../Silk.NET.SilkTouch.Emitter.Tests.csproj | 5 +++-- .../Silk.NET.SilkTouch.IntegrationTests.csproj | 1 + .../Silk.NET.SilkTouch.Scraper.Tests.csproj | 1 + .../Silk.NET.SilkTouch.Symbols.Tests.csproj | 2 +- ...Silk.NET.SilkTouch.TypeResolution.Tests.csproj | 1 + 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 62b1029d17..9230c84167 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -51,5 +51,6 @@ + diff --git a/tests/Silk.NET.Maths.Tests/Silk.NET.Maths.Tests.csproj b/tests/Silk.NET.Maths.Tests/Silk.NET.Maths.Tests.csproj index 2a07d06be0..e286fbfe93 100644 --- a/tests/Silk.NET.Maths.Tests/Silk.NET.Maths.Tests.csproj +++ b/tests/Silk.NET.Maths.Tests/Silk.NET.Maths.Tests.csproj @@ -8,16 +8,17 @@ - + - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/tests/Silk.NET.SilkTouch.Emitter.Tests/Silk.NET.SilkTouch.Emitter.Tests.csproj b/tests/Silk.NET.SilkTouch.Emitter.Tests/Silk.NET.SilkTouch.Emitter.Tests.csproj index b8353a9609..4dce798b28 100644 --- a/tests/Silk.NET.SilkTouch.Emitter.Tests/Silk.NET.SilkTouch.Emitter.Tests.csproj +++ b/tests/Silk.NET.SilkTouch.Emitter.Tests/Silk.NET.SilkTouch.Emitter.Tests.csproj @@ -17,8 +17,9 @@ - - + + + diff --git a/tests/Silk.NET.SilkTouch.IntegrationTests/Silk.NET.SilkTouch.IntegrationTests.csproj b/tests/Silk.NET.SilkTouch.IntegrationTests/Silk.NET.SilkTouch.IntegrationTests.csproj index 3a41f39a8e..68794c0e8a 100644 --- a/tests/Silk.NET.SilkTouch.IntegrationTests/Silk.NET.SilkTouch.IntegrationTests.csproj +++ b/tests/Silk.NET.SilkTouch.IntegrationTests/Silk.NET.SilkTouch.IntegrationTests.csproj @@ -22,6 +22,7 @@ + diff --git a/tests/Silk.NET.SilkTouch.Scraper.Tests/Silk.NET.SilkTouch.Scraper.Tests.csproj b/tests/Silk.NET.SilkTouch.Scraper.Tests/Silk.NET.SilkTouch.Scraper.Tests.csproj index 62b6c2eb78..cd7d135e00 100644 --- a/tests/Silk.NET.SilkTouch.Scraper.Tests/Silk.NET.SilkTouch.Scraper.Tests.csproj +++ b/tests/Silk.NET.SilkTouch.Scraper.Tests/Silk.NET.SilkTouch.Scraper.Tests.csproj @@ -21,6 +21,7 @@ + diff --git a/tests/Silk.NET.SilkTouch.Symbols.Tests/Silk.NET.SilkTouch.Symbols.Tests.csproj b/tests/Silk.NET.SilkTouch.Symbols.Tests/Silk.NET.SilkTouch.Symbols.Tests.csproj index 148734aba4..5d18889e62 100644 --- a/tests/Silk.NET.SilkTouch.Symbols.Tests/Silk.NET.SilkTouch.Symbols.Tests.csproj +++ b/tests/Silk.NET.SilkTouch.Symbols.Tests/Silk.NET.SilkTouch.Symbols.Tests.csproj @@ -15,13 +15,13 @@ all + - diff --git a/tests/Silk.NET.SilkTouch.TypeResolution.Tests/Silk.NET.SilkTouch.TypeResolution.Tests.csproj b/tests/Silk.NET.SilkTouch.TypeResolution.Tests/Silk.NET.SilkTouch.TypeResolution.Tests.csproj index 2f2e681cdb..5682c58de8 100644 --- a/tests/Silk.NET.SilkTouch.TypeResolution.Tests/Silk.NET.SilkTouch.TypeResolution.Tests.csproj +++ b/tests/Silk.NET.SilkTouch.TypeResolution.Tests/Silk.NET.SilkTouch.TypeResolution.Tests.csproj @@ -16,6 +16,7 @@ + From 018d97b8d798077c69ebad4d63865c2ecf072f3d Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Wed, 17 Aug 2022 21:25:51 +0200 Subject: [PATCH 02/11] Collect Coverage during test runs --- .github/workflows/test.yml | 39 +++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 933fc36621..7d88c9bc2e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,8 +18,10 @@ jobs: # between datacenter versions and home versions - rid: win-x64 os: windows-latest + name: win-x64 - rid: win-x86 os: windows-latest + name: win-x86 # given there appear to be significant differences # we test all available ubuntu versions here @@ -31,6 +33,7 @@ jobs: - rid: ubuntu.20.04-x64 os: ubuntu-20.04 + name: ubuntu-20.04-x64 # Ubuntu raises an SEH exception, see https://discord.com/channels/521092042781229087/1004867182787838043/1004887853500739684 # - rid: ubuntu.18.04-x64 @@ -42,11 +45,13 @@ jobs: os: macos-12 xcode_sdk: macosx12.3 # macos-12 image is currently (5th August 2022) on MacOS 12.5 but the latest sdk is macosx12.3 xcode_version: Xcode_13.4.1 + name: macosx12.3-xcode13 - rid: osx.11.0-x64 os: macos-11 xcode_sdk: macosx11.3 xcode_version: Xcode_12.5.1 + name: macosx11.3-xcode12 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -54,6 +59,7 @@ jobs: submodules: "true" - name: Setup .NET uses: actions/setup-dotnet@v2 + - name: Restore run: dotnet restore --runtime ${{ matrix.rid }} # Build can't be done in a separate step as building for a specific runtime & configuration is unsupported for some reason... @@ -63,6 +69,37 @@ jobs: if: matrix.xcode_version != 0 run: sudo xcode-select -switch /Applications/${{ matrix.xcode_version }}.app - name: Test - run: dotnet test -c Release --no-restore --runtime ${{ matrix.rid }} + run: dotnet test -c Release --no-restore --runtime ${{ matrix.rid }} --collect:"XPlat Code Coverage" --results-directory ./coverage env: SILK_DOTNET_Scraper__XcodeSdk: ${{ matrix.xcode_sdk }} + - name: Upload Coverage Results + uses: actions/upload-artifact@v3 + with: + name: coverage-${{ matrix.name }} + path: ./coverage/**/coverage.cobertura.xml + Report Coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + path: ./coverage + - name: Setup .NET Core # Required to execute ReportGenerator + - uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.300 + + - name: ReportGenerator + uses: danielpalme/ReportGenerator-GitHub-Action@5.1.9 + with: + reports: './coverage/**/**/coverage.cobertura.xml' + targetdir: './coveragereport' + reporttypes: 'MarkdownSummary;Cobertura' + # historydir: '' # Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution. + # plugins: '' # Optional plugin files for custom reports or custom history storage (separated by semicolon). + verbosity: 'Info' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off + # title: '' # Optional title. + tag: '${{ github.run_number }}_${{ github.run_id }}' # Optional tag or build version. + - uses: actions/upload-artifact@v3 + with: + name: coverage-final + path: ./coveragereport/* \ No newline at end of file From 60a0741439ce7e22fa3267196e3db9d583f57327 Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Wed, 17 Aug 2022 21:28:59 +0200 Subject: [PATCH 03/11] Fix File --- .github/workflows/test.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d88c9bc2e..1e10a6f663 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -84,7 +84,7 @@ jobs: with: path: ./coverage - name: Setup .NET Core # Required to execute ReportGenerator - - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v1 with: dotnet-version: 6.0.300 @@ -102,4 +102,10 @@ jobs: - uses: actions/upload-artifact@v3 with: name: coverage-final - path: ./coveragereport/* \ No newline at end of file + path: ./coveragereport/* + - name: Add Coverage PR Comment + - uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' + with: + header: coverage-results + path: code-coverage-results.md \ No newline at end of file From c10c92e302cb91b035a8aaa4d749397ac48b2dcd Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Wed, 17 Aug 2022 21:29:42 +0200 Subject: [PATCH 04/11] Add Job dependency --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e10a6f663..4ead5325ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,6 +79,7 @@ jobs: path: ./coverage/**/coverage.cobertura.xml Report Coverage: runs-on: ubuntu-latest + needs: Test steps: - uses: actions/download-artifact@v3 with: From 17d0701c458bfe15483f918e8aab02a4fd8c7840 Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Wed, 17 Aug 2022 21:30:21 +0200 Subject: [PATCH 05/11] Fix File --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ead5325ff..997d2b0619 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -104,8 +104,8 @@ jobs: with: name: coverage-final path: ./coveragereport/* - - name: Add Coverage PR Comment - - uses: marocchino/sticky-pull-request-comment@v2 + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@v2 if: github.event_name == 'pull_request' with: header: coverage-results From fc316eecf7985457654381455b2e5b64a8a34316 Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Wed, 17 Aug 2022 21:30:46 +0200 Subject: [PATCH 06/11] Fix File --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 997d2b0619..e4853e9ebd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -77,7 +77,7 @@ jobs: with: name: coverage-${{ matrix.name }} path: ./coverage/**/coverage.cobertura.xml - Report Coverage: + Report_Coverage: runs-on: ubuntu-latest needs: Test steps: From dcbe313e82ee68da9afaada489b6afe536ee692f Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Wed, 17 Aug 2022 21:38:26 +0200 Subject: [PATCH 07/11] Comment the Correct File --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4853e9ebd..7bd7f87a06 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -109,4 +109,4 @@ jobs: if: github.event_name == 'pull_request' with: header: coverage-results - path: code-coverage-results.md \ No newline at end of file + path: ./coveragereport/Summary.md \ No newline at end of file From 479292c117192107d3c1d966cece433ed243ab72 Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Wed, 17 Aug 2022 21:47:13 +0200 Subject: [PATCH 08/11] PR write perms? --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7bd7f87a06..b9a80619e5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -80,6 +80,8 @@ jobs: Report_Coverage: runs-on: ubuntu-latest needs: Test + permissions: + pull-requests: write steps: - uses: actions/download-artifact@v3 with: From f6325c7359d4b2fab5cb8c7dbc7d98bab71a45e6 Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Wed, 17 Aug 2022 22:32:59 +0200 Subject: [PATCH 09/11] Try marocchino generator --- .github/workflows/test.yml | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b9a80619e5..1f3ac04f7a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -86,29 +86,21 @@ jobs: - uses: actions/download-artifact@v3 with: path: ./coverage - - name: Setup .NET Core # Required to execute ReportGenerator - uses: actions/setup-dotnet@v1 + - name: Generate Summary + uses: irongut/CodeCoverageSummary@v1.3.0 with: - dotnet-version: 6.0.300 - - - name: ReportGenerator - uses: danielpalme/ReportGenerator-GitHub-Action@5.1.9 - with: - reports: './coverage/**/**/coverage.cobertura.xml' - targetdir: './coveragereport' - reporttypes: 'MarkdownSummary;Cobertura' - # historydir: '' # Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution. - # plugins: '' # Optional plugin files for custom reports or custom history storage (separated by semicolon). - verbosity: 'Info' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off - # title: '' # Optional title. - tag: '${{ github.run_number }}_${{ github.run_id }}' # Optional tag or build version. - - uses: actions/upload-artifact@v3 - with: - name: coverage-final - path: ./coveragereport/* + filename: './coverage/**/**/coverage.cobertura.xml' + badge: true + fail_below_min: true + format: markdown + hide_branch_rate: false + hide_complexity: true + indicators: true + output: file + thresholds: '60 80' - name: Add Coverage PR Comment uses: marocchino/sticky-pull-request-comment@v2 if: github.event_name == 'pull_request' with: header: coverage-results - path: ./coveragereport/Summary.md \ No newline at end of file + path: code-coverage-results.md \ No newline at end of file From d86dc1b88ba902629257395d3938ac0923519099 Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Wed, 17 Aug 2022 22:41:28 +0200 Subject: [PATCH 10/11] Does this work? --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f3ac04f7a..c782c91957 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -100,7 +100,7 @@ jobs: thresholds: '60 80' - name: Add Coverage PR Comment uses: marocchino/sticky-pull-request-comment@v2 - if: github.event_name == 'pull_request' + if: always() && github.event_name == 'pull_request' with: header: coverage-results path: code-coverage-results.md \ No newline at end of file From 7b6a0d9361ff0a13114d8d3828cea43dded70588 Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Wed, 17 Aug 2022 22:50:42 +0200 Subject: [PATCH 11/11] ALL THE POWER --- .github/workflows/test.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c782c91957..ee7532372b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -86,10 +86,25 @@ jobs: - uses: actions/download-artifact@v3 with: path: ./coverage + - name: Setup .NET Core # Required to execute ReportGenerator + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.300 + + - name: ReportGenerator + uses: danielpalme/ReportGenerator-GitHub-Action@5.1.9 + with: + reports: './coverage/**/**/coverage.cobertura.xml' + targetdir: './coveragereport' + reporttypes: 'Cobertura' + # historydir: '' # Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution. + # plugins: '' # Optional plugin files for custom reports or custom history storage (separated by semicolon). + verbosity: 'Info' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off + tag: '${{ github.run_number }}_${{ github.run_id }}' # Optional tag or build version. - name: Generate Summary uses: irongut/CodeCoverageSummary@v1.3.0 with: - filename: './coverage/**/**/coverage.cobertura.xml' + filename: './coveragereport/Cobertura.xml' badge: true fail_below_min: true format: markdown