Merge pull request #51 from GlumNihil/patch-1 #183
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/setup-onescript@v1.0 | |
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 }} |