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 13 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
59 changes: 52 additions & 7 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,6 +64,30 @@ jobs:
- name: Запуск тестов
run: oscript ${{ inputs.test_script_path }}

- name: Сохранение артефактов покрытия
uses: actions/upload-artifact@v4
with:
name: coverage
path: out/*overage*.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
path: out

Copy link
Contributor

Choose a reason for hiding this comment

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

Задача sonar была переименована, но здесь она все еще упоминается под старым именем. Это может вызвать путаницу. Убедитесь, что это изменение было сделано намеренно и что все зависимости между задачами корректно обновлены.

-  sonar:
+  test:

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
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
path: out
test:
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
path: out

- name: Извлечение версии пакета
shell: bash
run: echo "version=`cat packagedef | grep ".Версия(" | sed 's|[^"]*"||' | sed -r 's/".+//'`" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -93,3 +118,23 @@ 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 }}

codecov:
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
path: out
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: autumn-library/autumn
directory: out
nixel2007 marked this conversation as resolved.
Show resolved Hide resolved