Pre-PR CI #1569
Workflow file for this run
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 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" ] | |
# push: | |
# branches: [ "main" ] | |
jobs: | |
lint-build-test: | |
name: Lint, Build, Unit Test & Sonar Scan | |
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: '9.x' | |
- 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 dotnet solution | |
run: dotnet format --verify-no-changes | |
- name: Lint check angular workspace | |
run: npm run lint | |
- name: Build dotnet | |
run: dotnet build | |
- name: Build angular workspace | |
run: npm run build | |
- name: Test dotnet | |
run: dotnet test | |
- name: Test angular workspace | |
run: npm run test --code-coverage | |
- name: Set up JDK 17 | |
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'zulu' # Alternative distribution options are available. | |
- name: Install dotnet Sonar scanner | |
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' | |
run: dotnet tool install --global dotnet-sonarscanner | |
- name: Sonar Analysis angular workspace | |
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
args: > | |
-Dsonar.organization=kathanika | |
-Dsonar.projectKey=ts-projects | |
-Dsonar.sources="src/app-projects/kn-ui/src","src/app-projects/ils-web/src" | |
-Dsonar.javascript.lcov.reportPaths="coverage/lcov-report/kn-ui/lcov.info","coverage/lcov-report/ils-web/lcov.info" | |
-Dsonar.tests="src/app-projects/kn-ui/src","src/app-projects/ils-web/src" | |
-Dsonar.test.inclusions=**/*.spec.ts | |
-Dsonar.coverage.exclusions="**/*.stories.ts","**/*.config.ts","**/*.routes.ts","**/*.server.ts","**/main.ts","**/environment.ts",,"**/test-setup.ts" | |
# -Dsonar.qualitygate.wait=true | |
# -Dsonar.verbose=true | |
- name: .NET Sonar analysis | |
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
dotnet sonarscanner begin /k:"kathanika-server-sln" /o:"kathanika" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths=**\TestResults\**\coverage.opencover.xml /d:sonar.coverage.exclusions="**\Program.cs","**\graphql\**" | |
dotnet build | |
dotnet test --collect:"XPlat Code Coverage;Format=opencover" | |
dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |