Merge pull request #8 from Servant-Software-LLC/7-add-alter-table-add… #99
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: Build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
BuildConfiguration: Release | |
CoreId: SqlBuildingBlocks.Core | |
GrammarsAnsiSQLId: SqlBuildingBlocks.Grammars.AnsiSQL | |
GrammarsMySQLId: SqlBuildingBlocks.Grammars.MySQL | |
GrammarsPostgreSQLId: SqlBuildingBlocks.Grammars.PostgreSQL | |
GrammarsSQLServerId: SqlBuildingBlocks.Grammars.SQLServer | |
PackageVersion: 1.0.0.${{github.run_number}} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 7.0.x | |
- name: Set version number | |
run: '& ${{github.workspace}}/.github/workflows/UpdateVersion.ps1 ${{github.run_number}}' | |
shell: pwsh | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore --configuration $BuildConfiguration | |
- name: Test | |
run: dotnet test --configuration $BuildConfiguration --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage | |
- name: Create nuget packages | |
run: dotnet pack --configuration $BuildConfiguration --no-build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Nuget Packages | |
path: ${{github.workspace}}/src/**/*.nupkg | |
- name: Push to nuget.org (Core) | |
if: github.ref == 'refs/heads/main' | |
run: dotnet nuget push ${{github.workspace}}/src/bin/$BuildConfiguration/$CoreId.$PackageVersion.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_ORG_API_KEY }} --skip-duplicate | |
- name: Push to nuget.org (Grammars.AnsiSQL) | |
if: github.ref == 'refs/heads/main' | |
run: dotnet nuget push ${{github.workspace}}/src/bin/$BuildConfiguration/$GrammarsAnsiSQLId.$PackageVersion.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_ORG_API_KEY }} --skip-duplicate | |
- name: Push to nuget.org (Grammars.MySQL) | |
if: github.ref == 'refs/heads/main' | |
run: dotnet nuget push ${{github.workspace}}/src/bin/$BuildConfiguration/$GrammarsMySQLId.$PackageVersion.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_ORG_API_KEY }} --skip-duplicate | |
- name: Push to nuget.org (Grammars.PostgreSQL) | |
if: github.ref == 'refs/heads/main' | |
run: dotnet nuget push ${{github.workspace}}/src/bin/$BuildConfiguration/$GrammarsPostgreSQLId.$PackageVersion.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_ORG_API_KEY }} --skip-duplicate | |
- name: Push to nuget.org (Grammars.SQLServer) | |
if: github.ref == 'refs/heads/main' | |
run: dotnet nuget push ${{github.workspace}}/src/bin/$BuildConfiguration/$GrammarsSQLServerId.$PackageVersion.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_ORG_API_KEY }} --skip-duplicate | |
- name: Code Coverage Report | |
uses: irongut/CodeCoverageSummary@v1.3.0 | |
continue-on-error: true | |
with: | |
filename: coverage/**/coverage.cobertura.xml | |
badge: true | |
fail_below_min: false | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: true | |
indicators: true | |
output: both | |
thresholds: '40 60' | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
recreate: true | |
path: code-coverage-results.md | |