1
0
mirror of https://github.com/bia-technologies/yaxunit.git synced 2024-12-12 09:04:01 +02:00
yaxunit/.github/workflows/sq.yml

63 lines
2.4 KiB
YAML
Raw Normal View History

2023-02-03 08:37:56 +02:00
name: sq-analyze
2023-02-08 20:09:38 +02:00
on: [push, pull_request]
2023-02-03 08:37:56 +02:00
jobs:
SonarScanner:
runs-on: ubuntu-latest
2023-02-13 12:43:01 +02:00
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name
2023-02-03 08:37:56 +02:00
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 0
- name: Configure env vars for SonarCloud scan
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
echo "::set-env name=PATH::/opt/sonar-scanner/bin:$PATH"
- name: Compute branch name
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
uses: nixel2007/branch-name@v3
- name: Extract version
2023-02-08 20:38:19 +02:00
if: github.event_name == 'push'
2023-02-03 08:37:56 +02:00
shell: bash
2023-02-03 08:46:11 +02:00
run: echo "##[set-output name=version;]` cat ./exts/yaxunit/src/Configuration/Configuration.mdo | grep -oP '(?<=<version>)[\d.]+'`"
2023-02-03 08:37:56 +02:00
id: extract_version
2023-02-08 20:41:48 +02:00
- name: Setup sonarqube
uses: warchant/setup-sonar-scanner@v3
# Анализ проекта в SonarQube (ветка)
2023-02-08 20:38:19 +02:00
- name: Анализ в SonarQube (branch)
if: github.event_name == 'push'
2023-02-03 08:37:56 +02:00
env:
2023-02-08 20:38:19 +02:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: sonar-scanner
2023-02-03 08:37:56 +02:00
-Dsonar.host.url=https://sonar.openbsl.ru
2023-02-08 20:38:19 +02:00
-Dsonar.branch.name=${{ env.BRANCH_NAME }}
2023-02-03 08:37:56 +02:00
-Dsonar.projectVersion=${{ steps.extract_version.outputs.version }}
-Dsonar.qualitygate.wait=true
-Dsonar.qualitygate.timeout=300
2023-02-08 20:38:19 +02:00
# Анализ проекта в SonarQube (PR)
# https://docs.sonarqube.org/latest/analysis/pull-request/
- name: Анализ в SonarQube (pull-request)
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: sonar-scanner
-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