Update README.md #155
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: BUILD & RUN TESTS | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
env: | |
AUDIT_NET_AZUREDOCDBAUTHKEY: ${{ secrets.AUDIT_NET_AZUREDOCDBAUTHKEY }} | |
AUDIT_NET_AZUREDOCDBURL: ${{ secrets.AUDIT_NET_AZUREDOCDBURL }} | |
AUDIT_NET_AZURETABLECNNSTRING: ${{ secrets.AUDIT_NET_AZURETABLECNNSTRING }} | |
AUDIT_NET_AZUREBLOBSERVICEURL: ${{ secrets.AUDIT_NET_AZUREBLOBSERVICEURL }} | |
AUDIT_NET_AZUREBLOBACCOUNTNAME: ${{ secrets.AUDIT_NET_AZUREBLOBACCOUNTNAME }} | |
AUDIT_NET_AZUREBLOBACCOUNTKEY: ${{ secrets.AUDIT_NET_AZUREBLOBACCOUNTKEY }} | |
jobs: | |
build_and_test: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
2.1.x | |
3.1.x | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@v1.0.2 | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' | |
with: | |
nuget-version: '6.x' | |
- name: Install SQL Server | |
uses: Particular/install-sql-server-action@v1.0.0 | |
with: | |
connection-string-env-var: SQL_SERVER_CONNECTION_STRING | |
catalog: Audit | |
extra-params: "Encrypt=False;" | |
- name: Extra SQL | |
shell: pwsh | |
run: | | |
echo "Execute SqlScript.sql" | |
sqlcmd -i ".\src\Audit.NET.SqlServer\SqlScript.sql" -d "master" -I | |
echo "Execute Demo.sql" | |
sqlcmd -i ".\test\Audit.EntityFramework.Core.UnitTest\Demo.sql" -d "master" -I | |
- name: Dotnet Restore | |
run: dotnet restore | |
- name: Dotnet Build Audit.NET.sln | |
run: dotnet build .\Audit.NET.sln --no-restore --configuration release | |
- name: Install Required Tools | |
run: | | |
dotnet new tool-manifest | |
dotnet tool install dotnet-reportgenerator-globaltool | |
dotnet tool install dotnet-coverage | |
- name: Run unit tests (no integration) | |
run: | | |
dotnet coverage collect dotnet test --no-build --configuration release -m:1 --filter=TestCategory!=Integration --output ${{ github.workspace }}/Tests/Coverage.UnitTest.cobertura.xml --output-format cobertura | |
- name: Run integration tests (SqlServer) | |
run: | | |
dotnet coverage collect dotnet test --no-build --configuration release -m:1 --filter=TestCategory=SqlServer --output ${{ github.workspace }}/Tests/Coverage.SqlServer.cobertura.xml --output-format cobertura | |
- name: Generate Code Coverage Report | |
run: | | |
dotnet reportgenerator -reports:${{ github.workspace }}/Tests/Coverage.*.cobertura.xml -targetdir:"${{ github.workspace }}/Tests/coveragereport" -reporttypes:"MarkdownSummary;Html" "-assemblyfilters:+Audit.*;-*UnitTest;-Audit.NET.AmazonQLDB;-Audit.NET.Azure*;-Audit.NET.DynamoDB;-Audit.NET.ElasticSearch;-Audit.NET.Kafka;-Audit.NET.MongoDB;-Audit.NET.MySql;-Audit.NET.PostgreSql;-Audit.NET.RavenDB;-Audit.NET.Redis" | |
- name: Upload Code Coverage Report artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coveragereport | |
path: ${{ github.workspace }}/Tests/coveragereport | |
- name: Rename summary coverage file | |
run: mv -force "${{ github.workspace }}/Tests/coveragereport/Summary.md" "${{ github.workspace }}/CODE_COVERAGE.md" | |
- name: Commit CODE_COVERAGE.md | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Commit CODE_COVERAGE.md | |
file_pattern: 'CODE_COVERAGE.md' |