-
Notifications
You must be signed in to change notification settings - Fork 10
126 lines (112 loc) · 5.38 KB
/
Copy pathqa.yml
File metadata and controls
126 lines (112 loc) · 5.38 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# MIT License
# Copyright (C) 2022 Artem Kuznetsov <ArKuznetsov@gmail.com> and contributors
# All rights reserved.
name: Контроль качества
# Любой пуш и pr в проекте но с фильтром по основному проекту
on:
push:
branches:
- main
- master
- develop
pull_request:
branches:
- develop
env:
# отключение безопасности установки, от 2020-10-01
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
PROJECT_KEY: "clientSSH"
JAVA_HOME: "C:\\Program Files\\Java\\zulu-jdk-fx-17.0.12"
jobs:
build:
if: github.repository == 'arkuznetsov/clientSSH'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [clientSSH]
steps:
# Загрузка проекта
- name: Актуализация
uses: actions/checkout@v2
with:
# Disabling shadow clone is recomended
fetch-depth: 0
# Установка NUnit3
- name: Установка NUnit3
shell: pwsh
run: |
curl -o "./tools/nuget.exe" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
./tools/nuget.exe restore ./src
./tools/nuget.exe install NUnit.ConsoleRunner -Version 3.6.1 -OutputDirectory ./tools
# Установка инструментов .NET
- name: Установка инструментов .NET
run: |
dotnet tool update --global dotnet-sonarscanner
dotnet tool update --global dotnet-coverage
# Сборка и запуск контейнера OpenSSH
- name: Сборка и запуск контейнера OpenSSH
env:
SSH_TEST_USER: ${{ secrets.SSH_TEST_USER }}
SSH_TEST_PWD: ${{ secrets.SSH_TEST_PWD }}
run: |
echo PWD: $PWD
mkdir -p ./tools/openssh/upload
chmod -R 700 ./tools/openssh/upload
docker-compose --file ./tools/docker-compose.yml up --build -d
# Извлечение версии пакета
- name: Получение packagedef
shell: pwsh
run: echo "::set-output name=data::$(type ./build/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
# Начало анализа проекта в SonarQube (ветка)
- name: Начало анализа проекта в SonarQube (branch)
if: github.event_name == 'push'
run: dotnet sonarscanner begin
/s:${{ github.workspace }}/SonarQube.Analysis.xml
/k:${{ env.PROJECT_KEY }}
/v:${{ steps.extract_version.outputs.group1 }}
/d:sonar.host.url="${{ secrets.SONARQUBE_HOST }}"
/d:sonar.login="${{ secrets.SONARQUBE_TOKEN }}"
/d:sonar.branch.name="${{ env.BRANCH_NAME }}"
/d:sonar.cs.vscoveragexml.reportsPaths=./build/reports/coverage.xml
/d:sonar.cs.nunit.reportsPaths=./build/reports/nunit-result.xml
# Начало анализа проекта в SonarQube (PR)
# https://docs.sonarqube.org/latest/analysis/pull-request/
- name: Начало анализа проекта в SonarQube (pull-request)
if: github.event_name == 'pull_request'
run: dotnet sonarscanner begin
/s:${{ github.workspace }}/SonarQube.Analysis.xml
/k:${{ env.PROJECT_KEY }}
/d:sonar.host.url="${{ secrets.SONARQUBE_HOST }}"
/d:sonar.login="${{ secrets.SONARQUBE_TOKEN }}"
/d:sonar.branch.name="${{ env.BRANCH_NAME }}"
/d:sonar.pullrequest.key=${{ github.event.pull_request.number }}
/d:sonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
/d:sonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
/d:sonar.scm.revision=${{ github.event.pull_request.head.sha }}
/d:sonar.cs.vscoveragexml.reportsPaths=./build/reports/coverage.xml
/d:sonar.cs.nunit.reportsPaths=./build/reports/nunit-result.xml
# Сборка компоненты для тестирования
- name: Сборка компоненты для тестирования
run: |
dotnet restore ./src
dotnet build ./src --configuration Debug
# Запуск тестов NUnit3
- name: Запуск тестов NUnit3 и сборка покрытия
env:
SSH_TEST_USER: ${{ secrets.SSH_TEST_USER }}
SSH_TEST_PWD: ${{ secrets.SSH_TEST_PWD }}
run: |
mkdir "./build/reports"
dotnet-coverage collect -o ./build/reports/coverage.xml -f xml "./tools/NUnit.ConsoleRunner.3.6.1/tools/nunit3-console.exe ./src/NUnitTests/bin/Debug/net48/NUnitTests.dll --result=./build/reports/nunit-result.xml"
# Завершение анализа проекта в SonarQube
- name: Завершение анализа проекта в SonarQube
run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONARQUBE_TOKEN }}"