Story/fix formulas (#18) #293
This file contains hidden or 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 with test coverage and code quality analysis | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
| name: .NET Tests | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_call: # this is the trigger for the tests job | |
| jobs: | |
| test: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore --configuration Release | |
| - name: Run Tests | |
| env: | |
| spreadsheets:gig: ${{ secrets.GIG_SPREADSHEET_ID }} | |
| spreadsheets:stock: ${{ secrets.STOCK_SPREADSHEET_ID }} | |
| google_credentials:type: ${{ secrets.GOOGLE_CREDENTIALS_TYPE }} | |
| google_credentials:private_key_id: ${{ secrets.GOOGLE_CREDENTIALS_PRIVATE_KEY_ID }} | |
| google_credentials:private_key: ${{ secrets.GOOGLE_CREDENTIALS_PRIVATE_KEY }} | |
| google_credentials:client_email: ${{ secrets.GOOGLE_CREDENTIALS_CLIENT_EMAIL }} | |
| google_credentials:client_id: ${{ secrets.GOOGLE_CREDENTIALS_CLIENT_ID }} | |
| run: | | |
| dotnet test --no-build --configuration Release --logger trx --verbosity normal | |
| echo "(Coverage collected only in code-quality job for SonarCloud)" | |
| code-quality: | |
| name: Code Quality Analysis | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Cache SonarCloud packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~\sonar\cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - name: Cache SonarCloud scanner | |
| id: cache-sonar-scanner | |
| uses: actions/cache@v4 | |
| with: | |
| path: .\.sonar\scanner | |
| key: ${{ runner.os }}-sonar-scanner | |
| restore-keys: ${{ runner.os }}-sonar-scanner | |
| - name: Install SonarCloud scanner | |
| if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
| shell: bash | |
| run: | | |
| mkdir -p ./.sonar/scanner | |
| dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Begin SonarCloud Scan | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| shell: bash | |
| run: | | |
| ./.sonar/scanner/dotnet-sonarscanner begin \ | |
| /k:"khanjal_RaptorSheets" \ | |
| /o:"ironraptor" \ | |
| /d:sonar.token="$SONAR_TOKEN" \ | |
| /d:sonar.host.url="https://sonarcloud.io" \ | |
| /d:sonar.cs.opencover.reportsPaths="TestResults/**/coverage.opencover.xml" \ | |
| /d:sonar.cs.vstest.reportsPaths="TestResults/*.trx" \ | |
| /d:sonar.cpd.exclusions=RaptorSheets.Gig/Entities/**/*.cs \ | |
| /d:sonar.exclusions=RaptorSheets.Core/Entities/Generated/**,RaptorSheets.Gig/Entities/Generated/**,RaptorSheets.Stock/Entities/Generated/**,**/coverage*.xml,**/TestResults/**,**/coverage/**,**/*.coverage | |
| - name: Build for SonarCloud | |
| run: dotnet build --configuration Release | |
| - name: Test with Coverage for SonarCloud | |
| run: | | |
| dotnet test --no-build --configuration Release \ | |
| --collect:"XPlat Code Coverage" \ | |
| --results-directory ./TestResults \ | |
| --logger trx \ | |
| --verbosity normal \ | |
| -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover | |
| - name: End SonarCloud Scan | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| shell: bash | |
| run: ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN" |