Skip to content

⬆️ Bump Microsoft.CodeAnalysis.CSharp #487

⬆️ Bump Microsoft.CodeAnalysis.CSharp

⬆️ Bump Microsoft.CodeAnalysis.CSharp #487

Workflow file for this run

name: "Run tests"
on:
push:
pull_request:
paths:
- "**.cs"
- "**.csproj"
permissions:
contents: read
pull-requests: write
# https://www.meziantou.net/how-to-cancel-github-workflows-when-pushing-new-commits-on-a-branch.htm
concurrency:
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: test-${{matrix.os}}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
matrix:
os: [ubuntu-latest]
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4.1.7
# https://github.com/adamralph/minver?tab=readme-ov-file#why-is-the-default-version-sometimes-used-in-github-actions-azure-pipelines-and-travis-ci-when-a-version-tag-exists-in-the-history
with:
fetch-depth: 0
filter: tree:0
- name: Setup .NET Core
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: "8.x"
dotnet-quality: "ga"
cache: true
cache-dependency-path: "**/packages.lock.json"
- name: Install dotnet-coverage tool
run: dotnet tool install -g dotnet-coverage
- name: Install dependencies
run: |
if ${{ contains(github.event.pull_request.user.login, 'dependabot') || contains(github.event.issue.user.login, 'dependabot') }} ; then
dotnet restore --force-evaluate
else
dotnet restore
fi
- name: Build
run: dotnet build --configuration Release --no-restore --tl
- name: Test
run: dotnet test -s .runsettings --no-restore --verbosity normal --logger "GitHubActions;summary.includeNotFoundTests=false"
- name: Code coverage
uses: codecov/codecov-action@v4.4.1
with:
flags: unittests
verbose: true
- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@5.3.5
with:
reports: './**/TestResults/**/*.cobertura.xml'
targetdir: '${{ github.workspace }}/coveragereport'
reporttypes: 'MarkdownSummaryGithub;MarkdownAssembliesSummary'
classfilters: '-System.*;-Microsoft.*;-Newtonsoft.*;-System.Text.RegularExpressions.*;-xunit.*;-NUnit.*'
- uses: 8BitJonny/gh-get-current-pr@3.0.0
with:
# This will work no matter the trigger event and no matter if it is the first PR commit or not.
sha: ${{ github.event.pull_request.head.sha }}
# By default it returns PRs in any state.
filterOutClosed: true
# By default it returns PRs in any state.
filterOutDraft: true
id: pr-check
# https://github.com/danielpalme/ReportGenerator/issues/431
- name: Publish coverage summary
uses: marocchino/sticky-pull-request-comment@v2
if: steps.pr-check.outputs.pr_found == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
hide: true # Hide previous comment
hide_classify: "OUTDATED"
skip_unchanged: true
number: ${{ steps.pr-check.outputs.number }}
path: coveragereport/Summary.md
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
header: "Code coverage"
- name: Publish coverage in build summary
run: cat $GITHUB_WORKSPACE/coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
shell: bash
- name: Merge code coverage results
run: dotnet-coverage merge **/*/*.cobertura.xml -f cobertura -o ./cobertura.xml
shell: bash
# In v4, Artifacts are immutable (unless deleted). So you must change
# each of the uploaded Artifacts to have a different name and filter the
# downloads by name to achieve the same effect
- name: Archive code coverage results
# https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ matrix.os }}
path: |
./cobertura.xml
coveragereport/*.md