Merge pull request #359 from peter-szrnka/358-gms-179-auto-validate-s… #1295
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: Code quality check of application | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'code/**' | |
branches: | |
- '*' | |
- '*/*' | |
- '**' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
analize_backend: | |
name: Backend | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'ci-skip')" | |
steps: | |
- uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
# - name: Cache Maven packages | |
# uses: actions/cache@v3 | |
# with: | |
# path: ~/.m2 | |
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
# restore-keys: ${{ runner.os }}-m2 | |
- name: Sonarcloud scan | |
working-directory: ./code/gms-backend | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: mvn clean verify -Pcodecov org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=peter-szrnka_give-my-secret-backend | |
analize_frontend: | |
name: Frontend | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'ci-skip')" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Build with NPM | |
working-directory: ./code/gms-frontend | |
run: npm install | |
- name: Run tests | |
working-directory: ./code/gms-frontend | |
run: npm run test | |
- name: Sonarcloud scan | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_FRONTEND }} | |
uses: SonarSource/sonarcloud-github-action@master | |
with: | |
args: > | |
-Dsonar.projectKey=peter-szrnka_give-my-secret-frontend | |
-Dsonar.organization=peter-szrnka | |
-Dsonar.test.inclusions=**/*.spec.ts | |
-Dsonar.exclusions=**/*.java,**/*.class,**/*.scss,**/*.html,**/*.json,**/*.xml,**/*.js,**/environments/*.*,**/polyfills.ts,**/*module.ts,**/main.ts,**/mock-config.ts,**/*.provider.ts | |
-Dsonar.typescript.lcov.reportPaths=./code/gms-frontend/coverage/lcov.info | |
-Dsonar.javascript.lcov.reportPaths=./code/gms-frontend/coverage/lcov.info | |
-Dsonar.sources=./code/gms-frontend/src |