Skip to content

Merge master and update with example #1

Merge master and update with example

Merge master and update with example #1

Workflow file for this run

name: Upload test results and nightly builds
on: push
jobs:
Everything:
runs-on: windows-latest
steps:
- name: Update draft on GitHub Releases
id: release_drafter
uses: release-drafter/[email protected] # Pinned to v6.0.0 to avoid v6.1.0 bug: https://github.com/release-drafter/release-drafter/issues/1425
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v6
with:
submodules: 'recursive'
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.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
# PowerShell string replacement
$env:RELEASE_NOTES = $env:RELEASE_NOTES -replace ',','%2C' -replace ';','%3B'
dotnet workload restore
dotnet test --solution CSharpMath.sln -c Release -p:PackageReleaseNotes="$env:RELEASE_NOTES" -p:PackageVersion=${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }}
#### Awaiting coverlet.MTP at https://github.com/coverlet-coverage/coverlet/pull/1788
# # --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 --solution CSharpMath.sln -c Release --collect:"XPlat Code Coverage" --results-directory .testcoverage -p:PackageReleaseNotes="$env: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
# shell: pwsh
#- 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: false # 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
shell: pwsh