lfs отключил #9
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: Проверка Sonar | |
on: | |
- push | |
- pull_request_target | |
jobs: | |
SonarQualityGate: | |
name: 'Проверка Sonar' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Извлечение исходников PR | |
if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request' | |
uses: actions/checkout@v4 | |
with: | |
ref: refs/pull/${{ github.event.number }}/merge # Для поддержки pull_request и pull_request_target | |
fetch-depth: 0 # Получение полной истории (все тэги и ветки) | |
- name: Извлечение исходников ветки ${{ github.ref_name }} | |
if: github.event_name == 'push' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Получение полной истории (все тэги и ветки) | |
- name: Извлечение версии проекта | |
uses: ./.github/actions/extract-version | |
with: | |
path: ./src/Инструменты/src | |
id: extract_version | |
# Анализ проекта в SonarQube (ветка) | |
- name: Анализ в SonarQube (${{ github.ref_name }}) | |
if: github.event_name == 'push' | |
uses: sonarsource/sonarqube-scan-action@v2.3.0 | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
LC_ALL: "ru_RU.UTF-8" | |
with: | |
args: > | |
-Dsonar.host.url=https://sonar.openbsl.ru | |
-Dsonar.branch.name=${{ github.ref_name }} | |
-Dsonar.projectVersion=${{ steps.extract_version.outputs.version }} | |
-Dsonar.qualitygate.wait=true | |
-Dsonar.qualitygate.timeout=300 | |
-Dsonar.projectKey=tools_ui_1c | |
# Анализ проекта в SonarQube (PR) | |
# https://docs.sonarqube.org/latest/analysis/pull-request/ | |
- name: Анализ в SonarQube (pull-request ${{ github.event.number }}) | |
if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request' | |
uses: sonarsource/sonarqube-scan-action@v2.3.0 | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
args: > | |
-Dsonar.host.url=https://sonar.openbsl.ru | |
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} | |
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} | |
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} | |
-Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} | |
-Dsonar.qualitygate.wait=true | |
-Dsonar.qualitygate.timeout=300 | |
PublishResult: | |
name: Публикация результата ревью | |
runs-on: ubuntu-latest | |
if: github.event_name != 'push' && (success()||failure()) | |
needs: SonarQualityGate | |
steps: | |
- name: Извлечение исходников | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Получение полной истории (все тэги и ветки) | |
- name: Публикация результата проверки PR | |
uses: 1CDevFlow/sonar-review-action@main | |
with: | |
sonar_branch_plugin: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |