Pre-PR CI #2505
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 do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
| name: CI | |
| run-name: Pre-PR CI | |
| on: | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| dotnet-lint-build-test: | |
| name: .NET Lint, Build & Unit Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.x' | |
| - name: Lint check dotnet solution | |
| run: dotnet format --verify-no-changes | |
| - name: Build dotnet | |
| run: dotnet build | |
| - name: Test dotnet | |
| run: dotnet test --collect:"XPlat Code Coverage;Format=opencover" --results-directory ./coverage | |
| - name: Upload .NET coverage reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dotnet-coverage | |
| path: ./coverage/**/*.xml | |
| retention-days: 1 | |
| node-lint-build-test: | |
| name: Node.js Lint, Build & Unit Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js 22 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Installing Packages | |
| run: npm ci | |
| - name: Lint check angular workspace | |
| run: npm run lint | |
| - name: Build angular workspace | |
| run: npm run build | |
| - name: Test angular workspace | |
| run: npm run test -- --coverage --watch=false | |
| - name: Upload Node.js coverage reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: node-coverage | |
| path: coverage/ | |
| retention-days: 1 | |
| sonar-analysis: | |
| name: Sonar Analysis | |
| runs-on: ubuntu-latest | |
| needs: [dotnet-lint-build-test, node-lint-build-test] | |
| if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download .NET coverage reports | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dotnet-coverage | |
| path: ./coverage/dotnet | |
| - name: Download Node.js coverage reports | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: node-coverage | |
| path: ./coverage/node | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| distribution: 'zulu' | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.x' | |
| - name: Setup Node.js 22 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: | | |
| dotnet tool install --global dotnet-sonarscanner | |
| npm ci | |
| - name: Multi-language Sonar analysis | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: | | |
| dotnet sonarscanner begin \ | |
| /k:"hard-rox_kathanika" \ | |
| /o:"kathanika" \ | |
| /d:sonar.host.url="https://sonarcloud.io" \ | |
| /d:sonar.token="${{ secrets.SONAR_TOKEN }}" \ | |
| /d:sonar.sources="src" \ | |
| /d:sonar.tests="tests" \ | |
| /d:sonar.test.inclusions="**/*.spec.ts,**/*.cy.ts" \ | |
| /d:sonar.cs.opencover.reportsPaths="./coverage/dotnet/**/*.xml" \ | |
| /d:sonar.javascript.lcov.reportPaths="./coverage/node/**/lcov.info" \ | |
| /d:sonar.typescript.lcov.reportPaths="./coverage/node/**/lcov.info" \ | |
| /d:sonar.coverage.exclusions="**/Program.cs,**/graphql/**,**/*Validator.cs,src/infrastructure/Kathanika.Infrastructure.Graphql/Schema/**.cs,src/infrastructure/Kathanika.Infrastructure.Graphql/Types/**.cs,**/*.spec.ts,**/*.cy.ts" | |
| dotnet build | |
| dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |