-
Notifications
You must be signed in to change notification settings - Fork 38
96 lines (84 loc) · 3.57 KB
/
Copy pathqa.yml
File metadata and controls
96 lines (84 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# MIT License
# Copyright (C) 2020 Tymko Oleg <olegtymko@yandex.ru> and contributors
# All rights reserved.
name: Контроль качества
# Любой пуш и pr в проекте но с фильтром по основному проекту
on: [push, pull_request]
env:
# отключение безопасности установки, от 2020-10-01
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
YARD_RELEASES_USER: ${{ secrets.YARD_RELEASES_USER }}
YARD_RELEASES_PWD: ${{ secrets.YARD_RELEASES_PWD }}
SONAR_SCANNER_SKIP_JRE_PROVISIONING: true
jobs:
build:
if: github.repository == 'arkuznetsov/yard'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
oscript_version: ['1.9.3']
steps:
# Загрузка проекта
- name: Актуализация
uses: actions/checkout@v6
with:
fetch-depth: 0
# https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
- name: Извлечение имени текущей ветки
shell: bash
run: |
BRANCH=$(echo ${GITHUB_REF#refs/heads/})
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
id: extract_branch
# Установка OneScript конкретной версии
- name: Установка OneScript
uses: otymko/setup-onescript@v1.5.1
with:
version: ${{ matrix.oscript_version }}
# Установка зависимостей пакета
- name: Установка зависимостей
run: |
opm install opm
opm install --dev
- name: Установка Java
uses: actions/setup-java@v5
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '21'
# Запуск тестов и сбор покрытия кода
- name: Покрытие кода
run: oscript ./tasks/coverage.os
- name: Извлечение версии пакета
shell: bash
run: |
VERSION=$(cat packagedef | grep ".Версия(" | sed 's|[^"]*"||' | sed -r 's/".+//')
echo "version=$VERSION" >> $GITHUB_OUTPUT
id: extract_version
# Анализ проекта в SonarQube (ветка)
- name: Анализ в SonarQube (branch)
if: github.event_name == 'push'
uses: SonarSource/sonarqube-scan-action@v8.2.0
env:
SONAR_HOST_URL: ${{ vars.SONARQUBE_HOST }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
with:
args: >
-Dsonar.branch.name=${{ steps.extract_branch.outputs.branch }}
-Dsonar.projectVersion=${{ steps.extract_version.outputs.version }}
# Анализ проекта в SonarQube (PR)
# https://docs.sonarqube.org/latest/analysis/pull-request/
- name: Анализ в SonarQube (pull-request)
if: github.event_name == 'pull_request'
uses: SonarSource/sonarqube-scan-action@v8.2.0
env:
SONAR_HOST_URL: ${{ vars.SONARQUBE_HOST }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
with:
args: >
-Dsonar.branch.name=${{ steps.extract_branch.outputs.branch }}
-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 }}