1- # MIT License
2- # Copyright (C) 2020 Tymko Oleg <[email protected] > and contributors3- # All rights reserved.
41
52name : Контроль качества
63# Любой пуш и pr в проекте но с фильтром по основному проекту
74on : [push, pull_request]
85
96env :
107 ACTIONS_ALLOW_UNSECURE_COMMANDS : true
8+ BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
119
1210jobs :
1311 build :
@@ -16,21 +14,16 @@ jobs:
1614 strategy :
1715 fail-fast : false
1816 matrix :
19- os : [ubuntu-latest ]
20- oscript_version : ['1.4 .0']
17+ os : [cpdb ]
18+ oscript_version : ['1.7 .0']
2119
2220 steps :
2321 # Загрузка проекта
2422 - name : Актуализация
25- uses : actions/checkout@v2.3.4
23+ uses : actions/checkout@v3
2624 with :
2725 fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
28-
29- # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
30- - name : Извлечение имени текущей ветки
31- shell : bash
32- run : echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
33- id : extract_branch
26+ lfs : true
3427
3528 # Установка OneScript конкретной версии
3629 - name : Установка OneScript
@@ -44,13 +37,39 @@ jobs:
4437 opm install opm
4538 opm install --dev
4639
40+ # Запуск контейнера NextCloud
41+ - name : Запуск контейнера NextCloud
42+ env :
43+ NC_ADDRESS : ${{ secrets.NC_ADDRESS }}
44+ NC_ADMIN_NAME : ${{ secrets.NC_ADMIN_NAME }}
45+ NC_ADMIN_PWD : ${{ secrets.NC_ADMIN_PWD }}
46+ run : ./tools/nextcloud/startenv.bat
47+
4748 # Запуск тестов и сбор покрытия кода
4849 - name : Покрытие кода
50+ env :
51+ CPDB_SQL_SRVR : ${{ secrets.CPDB_SQL_SRVR }}
52+ CPDB_SQL_USER : ${{ secrets.CPDB_SQL_USER }}
53+ CPDB_SQL_PWD : ${{ secrets.CPDB_SQL_PWD }}
54+ NC_ADDRESS : ${{ secrets.NC_ADDRESS }}
55+ NC_ADMIN_NAME : ${{ secrets.NC_ADMIN_NAME }}
56+ NC_ADMIN_PWD : ${{ secrets.NC_ADMIN_PWD }}
4957 run : oscript ./tasks/coverage.os
5058
59+ # Удаление контейнера NextCloud
60+ - name : Удаление контейнера NextCloud
61+ run : ./tools/nextcloud/stopenv.bat
62+
63+ - name : Получение packagedef
64+ shell : pwsh
65+ run : echo "::set-output name=data::$(type packagedef)\n"
66+ id : packagedef_data
67+
5168 - name : Извлечение версии пакета
52- shell : bash
53- run : echo "##[set-output name=version;]`cat packagedef | grep ".Версия(" | sed 's|[^"]*"||' | sed -r 's/".+//'`"
69+ uses : actions-ecosystem/action-regex-match@v2
70+ with :
71+ text : ${{ steps.packagedef_data.outputs.data }}
72+ regex : ' .Версия\("((?:\d+\.)+\d+)"\)'
5473 id : extract_version
5574
5675 - name : Установка Sonar-scanner
@@ -59,20 +78,22 @@ jobs:
5978 # Анализ проекта в SonarQube (ветка)
6079 - name : Анализ в SonarQube (branch)
6180 if : github.event_name == 'push'
81+ shell : cmd
6282 run : sonar-scanner
6383 -Dsonar.login=${{ secrets.SONARQUBE_TOKEN }}
6484 -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
65- -Dsonar.branch.name=${{ steps.extract_branch.outputs.branch }}
66- -Dsonar.projectVersion=${{ steps.extract_version.outputs.version }}
85+ -Dsonar.branch.name=${{ env.BRANCH_NAME }}
86+ -Dsonar.projectVersion=${{ steps.extract_version.outputs.group1 }}
6787
6888 # Анализ проекта в SonarQube (PR)
6989 # https://docs.sonarqube.org/latest/analysis/pull-request/
7090 - name : Анализ в SonarQube (pull-request)
7191 if : github.event_name == 'pull_request'
92+ shell : cmd
7293 run : sonar-scanner
7394 -Dsonar.login=${{ secrets.SONARQUBE_TOKEN }}
7495 -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
75- -Dsonar.branch.name=${{ steps.extract_branch.outputs.branch }}
96+ -Dsonar.branch.name=${{ env.BRANCH_NAME }}
7697 -Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
7798 -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
7899 -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
0 commit comments