This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
actions: bump docker/metadata-action from 3 to 5 #239
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: Sonarqube code analysis | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
inputs: | |
application: | |
required: false | |
type: choice | |
default: "" | |
description: Specific application to analyze | |
options: | |
- "" | |
- Appserver | |
- Frontend | |
jobs: | |
sonarqube: | |
name: Quality of ${{ matrix.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: appserver | |
path: appserver | |
extraArgs: > | |
-Dsonar.tests=tests/ | |
-Dsonar.exclusions=tests/** | |
- name: frontend | |
path: client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Check if code was changed in project path | |
- name: Check code changes | |
uses: marceloprado/has-changed-path@v1 | |
if: github.event_name != 'workflow_dispatch' | |
id: changed | |
with: | |
paths: ${{ matrix.path }} | |
# Scan if code was changed or if workflow was triggered manually | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
if: steps.changed.outputs.changed == 'true' || github.event.inputs.application == matrix.name || github.event.inputs.application == '' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_ORGANIZATION: lifelike | |
with: | |
projectBaseDir: ${{ matrix.path }} | |
args: > | |
-Dsonar.organization=${{ env.SONAR_ORGANIZATION }} | |
-Dsonar.projectKey=${{ env.SONAR_ORGANIZATION }}-${{ matrix.name }} | |
-Dsonar.projectName=${{ matrix.name }} | |
${{ matrix.extraArgs }} |