Merged PR 8150: Added new Filter Feature + More repository Result ext… #107
This file contains 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: CI | |
on: [ push ] | |
permissions: # needed for test reporter | |
pull-requests: write | |
contents: write | |
statuses: write | |
checks: write | |
actions: write | |
env: # https://docs.github.com/en/actions/learn-github-actions/variables | |
# Solution_Name: '**/*.sln' | |
Build_Configuration: Debug # cannot use Release due to assembly signing with missing .snk | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_NOLOGO: true | |
# NuGet_Directory: ${{ github.workspace}}/nuget | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
version: | |
name: Version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/[email protected] | |
with: | |
dotnet-version: 8.x | |
- run: dotnet --info | |
- name: Install minver tool | |
run: dotnet tool install --global minver-cli --version 4.3.0 | |
- name: Calculate version # make VERSION available as env.version | |
run: | | |
VERSION=$(minver -v d) | |
echo $VERSION | |
echo "version=$VERSION" >> "$GITHUB_ENV" | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
needs: version | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Setup .NET | |
uses: actions/[email protected] | |
with: | |
dotnet-version: 8.x | |
- run: dotnet --info | |
- name: Cache nuget packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Restore nuget packages | |
run: dotnet restore --verbosity Normal | |
- name: Build solution | |
run: dotnet build --configuration ${{ env.Build_Configuration }} --no-restore --nologo | |
- name: Vulnerability scan (nuget) | |
run: | | |
dotnet list package --vulnerable --include-transitive 2>&1 | tee build.log | |
echo "Analyze dotnet list package command log output..." | |
grep -q -i "critical\|high\|moderate\|low" build.log; [ $? -eq 0 ] && echo "Security Vulnerabilities found on the log output" && exit 1 | |
- name: Run tests | |
run: dotnet test --configuration ${{ env.Build_Configuration }} --no-restore --no-build --nologo --filter "FullyQualifiedName!~Examples" --logger "trx;LogFileName=test-results.trx" || true | |
- name: Report test results # https://octopus.com/blog/githubactions-running-unit-tests | |
uses: dorny/test-reporter@v1 | |
# if: always() | |
with: | |
name: Tests | |
path: "**/test-results.trx" | |
reporter: dotnet-trx | |
fail-on-error: true | |
# - name: Package pack (nuget) | |
# run: dotnet pack --configuration ${{ env.Build_Configuration }} --no-restore --no-build --nologo ${{ env.Solution_Name }} --no-build --output ${{ env.NuGet_Directory }} | |
# - name: Package push (nuget) # Push only when creating a GitHub Release | |
# env: | |
# SOURCE: ${{ secrets.NUGET_PUSH_SOURCE }} # https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions | |
# API_KEY: ${{ secrets.\_PUSH_API_KEY }} | |
# if: github.event_name == 'release' && (env.SOURCE != '' || env.API_KEY != '') | |
# run: dotnet nuget push ${{ env.NuGet_Directory }}/*.nupkg --source ${{ env.SOURCE }} --api-key ${{ env.API_KEY }} | |
# - name: Publish package artifacts | |
# uses: actions/[email protected] | |
# with: | |
# name: NuGet packages | |
# if-no-files-found: error | |
# retention-days: 7 | |
# path: ${{ env.NuGet_Directory }}/*.nupkg |