forked from arkuznetsov/cpdb
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (96 loc) · 4.45 KB
/
qa.yml
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Контроль качества
# Любой пуш и pr в проекте но с фильтром по основному проекту
on: [push, pull_request]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
build:
if: github.repository == 'arkuznetsov/cpdb'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [cpdb]
oscript_version: ['1.8.3']
steps:
# Загрузка проекта
- name: Актуализация
uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
lfs: true
# Установка OneScript конкретной версии
- name: Установка OneScript
uses: otymko/[email protected]
with:
version: ${{ matrix.oscript_version }}
# Установка зависимостей пакета
- name: Установка зависимостей
run: |
opm install opm
opm install --dev
# Запуск контейнеров NextCloud и OpenSSH
- name: Запуск контейнеров NextCloud и OpenSSH
env:
NC_TEST_ADDRESS: ${{ secrets.NC_TEST_ADDRESS }}
NC_TEST_ADMIN_NAME: ${{ secrets.NC_TEST_ADMIN_NAME }}
NC_TEST_ADMIN_PWD: ${{ secrets.NC_TEST_ADMIN_PWD }}
SFTP_TEST_ADDRESS: ${{ secrets.SFTP_TEST_ADDRESS }}
SFTP_TEST_USER: ${{ secrets.SFTP_TEST_USER }}
SFTP_TEST_PWD: ${{ secrets.SFTP_TEST_PWD }}
run: |
docker-compose --file ./tools/docker-compose.yml up --build -d
oscript ./tools/nextcloud/checkenv.os
# Запуск тестов и сбор покрытия кода
- name: Покрытие кода
env:
CPDB_SQL_SRVR: ${{ secrets.CPDB_SQL_SRVR }}
CPDB_SQL_USER: ${{ secrets.CPDB_SQL_USER }}
CPDB_SQL_PWD: ${{ secrets.CPDB_SQL_PWD }}
NC_TEST_ADDRESS: ${{ secrets.NC_TEST_ADDRESS }}
NC_TEST_ADMIN_NAME: ${{ secrets.NC_TEST_ADMIN_NAME }}
NC_TEST_ADMIN_PWD: ${{ secrets.NC_TEST_ADMIN_PWD }}
SFTP_TEST_ADDRESS: ${{ secrets.SFTP_TEST_ADDRESS }}
SFTP_TEST_USER: ${{ secrets.SFTP_TEST_USER }}
SFTP_TEST_PWD: ${{ secrets.SFTP_TEST_PWD }}
YADISK_TOKEN: ${{ secrets.YADISK_TOKEN }}
LOGOS_CONFIG : "logger.oscript.app.cpdb=INFO"
run: oscript ./tasks/coverage.os
# Остановка и удаление контейнеров NextCloud и OpenSSH
- name: Остановка и удаление контейнеров NextCloud и OpenSSH
run: docker-compose --file ./tools/docker-compose.yml down
- name: Получение packagedef
shell: pwsh
run: echo "::set-output name=data::$(type packagedef)\n"
id: packagedef_data
- name: Извлечение версии пакета
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ steps.packagedef_data.outputs.data }}
regex: '.Версия\("((?:\d+\.)+\d+)"\)'
id: extract_version
- name: Установка Sonar-scanner
uses: warchant/setup-sonar-scanner@v1
# Анализ проекта в SonarQube (ветка)
- name: Анализ в SonarQube (branch)
if: github.event_name == 'push'
shell: cmd
run: sonar-scanner
-Dsonar.login=${{ secrets.SONARQUBE_TOKEN }}
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
-Dsonar.branch.name=${{ env.BRANCH_NAME }}
-Dsonar.projectVersion=${{ steps.extract_version.outputs.group1 }}
# Анализ проекта в SonarQube (PR)
# https://docs.sonarqube.org/latest/analysis/pull-request/
- name: Анализ в SonarQube (pull-request)
if: github.event_name == 'pull_request'
shell: cmd
run: sonar-scanner
-Dsonar.login=${{ secrets.SONARQUBE_TOKEN }}
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
-Dsonar.branch.name=${{ env.BRANCH_NAME }}
-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 }}