Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
53 changes: 46 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
Expand Down Expand Up @@ -63,6 +64,23 @@ jobs:
- name: Запуск тестов
run: oscript ${{ inputs.test_script_path }}

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
Expand Down Expand Up @@ -93,3 +111,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
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

Comment on lines +116 to +133
Copy link
Contributor

Choose a reason for hiding this comment

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

Добавлена новая задача coverage для загрузки отчетов о покрытии в Codecov. Это улучшение способствует более тесной интеграции с Codecov и улучшает визуализацию покрытия кода тестами. Однако, условие в строке 119 (if: ${{ inputs.github_repository }} == true) кажется некорректным, так как inputs.github_repository является строкой. Возможно, имелось в виду другое условие для активации этой задачи.

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

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
coverage:
runs-on: ubuntu-latest
needs: [test]
if: ${{ inputs.github_repository }} == true
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
coverage:
runs-on: ubuntu-latest
needs: [test]
if: ${{ inputs.codecov }} == true
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


52 changes: 51 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,20 @@ on:
required: false
type: string
default: ./tasks/test.os
test_script_args:
required: false
type: string
default: ""
junit_report_path:
required: false
type: string
default: "out/JUnit"

jobs:
build:
# permissions:
# checks: write
# pull-requests: write
Comment on lines +25 to +27
Copy link
Contributor

Choose a reason for hiding this comment

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

Раздел с разрешениями закомментирован. Рекомендуется раскомментировать и настроить разрешения для checks и pull-requests, чтобы обеспечить правильную функциональность рабочего процесса, особенно если в будущем планируется использовать эти разрешения.

-    # permissions:
-    #   checks: write
-    #   pull-requests: write
+    permissions:
+      checks: write
+      pull-requests: write

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
# permissions:
# checks: write
# pull-requests: write
permissions:
checks: write
pull-requests: write

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -57,4 +68,43 @@ jobs:
opm install -l --dev

- name: Тестирование
run: oscript ${{ inputs.test_script_path}}
run: oscript ${{ inputs.test_script_path}} ${{ inputs.test_script_args }}

- name: Загрузка артефактов тестирования
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (oscript ${{ matrix.oscript_version }} on ${{ matrix.os }})
path: ${{ inputs.junit_report_path }}
if-no-files-found: ignore

publish-test-results:
name: "Publish Tests Results"
needs: build
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
# only needed for private repository
# contents: read
# only needed for private repository
# issues: read
if: always()

steps:
- name: Скачивание артефактов тестирования
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Проверка существования директории с результатами тестов
id: check_files
uses: andstor/file-existence-action@v2
with:
files: artifacts/**/*.xml

- name: Сохранение результатов тестирования
if: steps.check_files.outputs.files_exists == 'true'
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "artifacts/**/*.xml"