icons aren't related to project #519
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: [push, pull_request] | |
| jobs: | |
| Core: | |
| runs-on: ubuntu-latest # release-drafter/release-drafter@v5 only works on Linux: https://github.com/release-drafter/release-drafter/issues/558 | |
| steps: | |
| - name: Update draft on GitHub Releases | |
| id: release_drafter | |
| uses: release-drafter/release-drafter@v6 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Build and Test | |
| env: | |
| RELEASE_NOTES: | | |
| # ${{ steps.release_drafter.outputs.name }} | |
| ${{ steps.release_drafter.outputs.body }} | |
| run: | | |
| # .NET Core MSBuild cannot parse , and ; correctly so we replace them with substitutions: https://github.com/dotnet/msbuild/issues/471#issuecomment-366268743 | |
| # https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion | |
| # ${parameter/pattern/string} If pattern begins with '/', all matches of pattern are replaced with string. Normally only the first match is replaced. | |
| RELEASE_NOTES=${RELEASE_NOTES//,/%2C} | |
| RELEASE_NOTES=${RELEASE_NOTES//;/%3B} | |
| # --collect:"XPlat Code Coverage" means collect test coverage with https://github.com/coverlet-coverage/coverlet | |
| # Coverlet settings come after --: https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/VSTestIntegration.md#advanced-options-supported-via-runsettings | |
| dotnet test CSharpMath.CrossPlatform.slnf -c Release -l GitHubActions --blame --collect:"XPlat Code Coverage" --results-directory .testcoverage -p:PackageReleaseNotes="$RELEASE_NOTES" -p:PackageVersion=${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }} -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.IncludeTestAssembly=true | |
| - name: Run ReportGenerator on Test Coverage results | |
| uses: danielpalme/ReportGenerator-GitHub-Action@5 | |
| with: | |
| reports: '.testcoverage/**/*.*' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported. | |
| targetdir: '.testcoverage/report' # REQUIRED # The directory where the generated report should be saved. | |
| reporttypes: 'Html' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary | |
| title: 'CSharpMath test coverage results' # Optional title. | |
| tag: ${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }} # Optional tag or build version. | |
| - name: Upload CSharpMath test coverage results as CI artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: CSharpMath test coverage results | |
| path: .testcoverage/ | |
| - name: Upload CSharpMath test coverage results to codecov.io | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: .testcoverage/**/*.xml # optional | |
| name: CSharpMath test coverage # optional | |
| fail_ci_if_error: true # optional (default = false) | |
| - name: Upload CSharpMath.Rendering.Tests results as CI artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() # Run even when a previous step failed: https://stackoverflow.com/a/58859404/5429648 | |
| with: | |
| name: CSharpMath.Rendering.Tests results | |
| path: CSharpMath.Rendering.Tests/*/*.png | |
| - name: Upload CSharpMath.Xaml.Tests.NuGet results as CI artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: CSharpMath.Xaml.Tests.NuGet results | |
| path: CSharpMath.Xaml.Tests.NuGet/*.png | |
| - name: Upload NuGet packages as CI artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: NuGet packages | |
| path: .nupkgs/ | |
| - name: Push CI artifacts to GitHub Packages registry | |
| if: github.ref == 'refs/heads/master' | |
| run: | | |
| # "dotnet nuget push" with "dotnet nuget add source" to GitHub Packages is unstable for project names with a dot: https://github.com/NuGet/Home/issues/9775#issuecomment-714509211 | |
| # So we must specify api-key directly in "dotnet nuget push" instead of following the GitHub Packages documentation | |
| # We use quotes to avoid shell globbing: https://github.com/NuGet/Home/issues/4393#issuecomment-667618120 | |
| # --no-symbols true to not let GitHub Releases interpret .snupkg as .nupkg | |
| dotnet nuget push '.nupkgs/*.nupkg' --source 'https://nuget.pkg.github.com/verybadcat/index.json' --api-key ${{ github.token }} --skip-duplicate --no-symbols true |