Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage #15

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 53 additions & 8 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,25 @@ on:
test_script_path:
required: false
type: string
default: ./tasks/coverage.os
default: ./tasks/coverage.os
codecov:
required: false
type: boolean
default: false
secrets:
SONAR_TOKEN:
required: false
CODECOV_TOKEN:
required: false

jobs:
sonar:
test:
if: (github.repository == ${{ inputs.github_repository }} ) && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name)
runs-on: ubuntu-latest

steps:
- name: Актуализация
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Вычисление имени ветки
uses: nelonoel/[email protected]

- name: Вычисление версии OneScript
shell: bash
nixel2007 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -63,13 +64,36 @@ jobs:
- name: Запуск тестов
run: oscript ${{ inputs.test_script_path }}

- name: Сохранение артефактов покрытия
uses: actions/upload-artifact@v4
with:
name: coverage
path: out/coverage.xml
if-no-files-found: ignore
sonar:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Актуализация
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Вычисление имени ветки
uses: nelonoel/[email protected]

- name: Скачивание артефактов
uses: actions/download-artifact@v4
with:
name: coverage

- name: Извлечение версии пакета
shell: bash
run: echo "version=`cat packagedef | grep ".Версия(" | sed 's|[^"]*"||' | sed -r 's/".+//'`" >> $GITHUB_OUTPUT
id: extract_version

- name: Настройка sonar-scanner
uses: warchant/setup-sonar-scanner@v8
uses: warchant/setup-sonar-scanner@v7

- name: Анализ в SonarQube (branch)
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
Expand All @@ -93,3 +117,24 @@ jobs:
-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 }}


coverage:
runs-on: ubuntu-latest
needs: [test]
if: ${{ inputs.github_repository }} == true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Условие if: ${{ inputs.github_repository }} == true в работе coverage потенциально некорректно, так как inputs.github_repository предполагается быть строкой с именем репозитория, а не логическим значением. Это может привести к тому, что условие никогда не выполнится как ожидается. Рекомендуется пересмотреть логику этого условия.

-    if: ${{ inputs.github_repository }} == true
+    if: ${{ inputs.github_repository }} != ''

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if: ${{ inputs.github_repository }} == true
if: ${{ inputs.github_repository }} != ''

steps:
- name: Актуализация
uses: actions/checkout@v4

- name: Скачивание артефактов
uses: actions/download-artifact@v4
with:
name: coverage
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: autumn-library/autumn

nixel2007 marked this conversation as resolved.
Show resolved Hide resolved