Skip to content

chore(deps): bump the nuget-tests group across 1 directory with 3 upd… #3294

chore(deps): bump the nuget-tests group across 1 directory with 3 upd…

chore(deps): bump the nuget-tests group across 1 directory with 3 upd… #3294

name: .NET Agent Unit Tests and Code Coverage
on:
push:
branches:
- main # runs after a completed PR to main
- feature/* # runs after a push to a feature branch
pull_request: # runs on a PR to any branch
workflow_dispatch: # allows for manual trigger
env:
DOTNET_NOLOGO: true
NR_DEV_BUILD_HOME: false
# only allow one instance of this workflow to be running per PR or branch, cancels any that are already running
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check-modified-files:
name: Check if source files were modified, skip remaining jobs if not
uses: ./.github/workflows/check_modified_files.yml
secrets: inherit
permissions:
contents: read
pull-requests: read
run-unit-tests:
name: Run Unit Tests
needs: check-modified-files
runs-on: windows-latest
# don't run this job if triggered by Dependabot, will cause all other jobs to be skipped as well
# run this job if non-workflow files were modified, or if triggered by a manual execution or by a push (not a PR)
if: github.actor != 'dependabot[bot]' && (needs.check-modified-files.outputs.non-workflow-files-changed == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'push')
env:
test_results_path: tests\TestResults
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Restore NuGet Packages
run: dotnet restore
- name: Build & Run Unit Tests
run: dotnet test --verbosity minimal --no-restore --settings tests\UnitTests.runsettings --results-directory ${{ env.test_results_path }}
- name: Upload coverage reports to Codecov.io
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
flags: Agent
directory: ${{ env.test_results_path }}
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage report artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: UnitTestResults # Artifact name
path: ${{ env.test_results_path }} # Directory containing files to upload