Skip to content

Commit 759615d

Browse files
authored
Create qa.yml
1 parent 63203a0 commit 759615d

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/qa.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# MIT License
2+
# Copyright (C) 2020 Tymko Oleg <olegtymko@yandex.ru> and contributors
3+
# All rights reserved.
4+
5+
name: Контроль качества
6+
# Любой пуш и pr в проекте но с фильтром по основному проекту
7+
on: [push, pull_request]
8+
jobs:
9+
build:
10+
if: (github.repository == 'nixel2007/oscript-fluent') && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name)
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest]
16+
oscript_version: ['stable']
17+
18+
steps:
19+
# Загрузка проекта
20+
- name: Актуализация
21+
uses: actions/checkout@v2
22+
23+
# Вычисление имени ветки
24+
- name: Compute branch name
25+
uses: nelonoel/branch-name@v1.0.1
26+
27+
# Установка OneScript конкретной версии
28+
- name: Установка OneScript
29+
uses: otymko/setup-onescript@v1.1
30+
with:
31+
version: ${{ matrix.oscript_version }}
32+
33+
# Установка зависимостей пакета
34+
- name: Установка зависимостей
35+
run: |
36+
opm install opm
37+
opm install -l --dev
38+
39+
# Запуск тестов и сбор покрытия кода
40+
- name: Покрытие кода
41+
run: oscript ./tasks/coverage.os
42+
43+
- name: Извлечение версии пакета
44+
shell: bash
45+
run: echo "##[set-output name=version;]`cat packagedef | grep ".Версия(" | sed 's|[^"]*"||' | sed -r 's/".+//'`"
46+
id: extract_version
47+
48+
- name: Setup sonarqube
49+
uses: warchant/setup-sonar-scanner@v3
50+
51+
# Анализ проекта в SonarQube (ветка)
52+
- name: Анализ в SonarQube (branch)
53+
if: github.event_name == 'push'
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
57+
run: sonar-scanner
58+
-Dsonar.host.url=https://sonar.openbsl.ru
59+
-Dsonar.branch.name=${{ env.BRANCH_NAME }}
60+
-Dsonar.projectVersion=${{ steps.extract_version.outputs.version }}
61+
62+
# Анализ проекта в SonarQube (PR)
63+
# https://docs.sonarqube.org/latest/analysis/pull-request/
64+
- name: Анализ в SonarQube (pull-request)
65+
if: github.event_name == 'pull_request'
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
69+
run: sonar-scanner
70+
-Dsonar.host.url=https://sonar.openbsl.ru
71+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
72+
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
73+
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
74+
-Dsonar.scm.revision=${{ github.event.pull_request.head.sha }}

0 commit comments

Comments
 (0)