-
Notifications
You must be signed in to change notification settings - Fork 5
Update test.yml with additional test script arguments and JUnit report decoration #13
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
base: main
Are you sure you want to change the base?
Changes from all commits
485ee92
3fc14db
c3be724
0593db4
a2058d9
bcc6564
be839bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Раздел с разрешениями закомментирован. Рекомендуется раскомментировать и настроить разрешения для - # permissions:
- # checks: write
- # pull-requests: write
+ permissions:
+ checks: write
+ pull-requests: writeCommittable suggestion
Suggested change
|
||||||||||||||
| runs-on: ${{ matrix.os }} | ||||||||||||||
| strategy: | ||||||||||||||
| fail-fast: false | ||||||||||||||
|
|
@@ -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" | ||||||||||||||
There was a problem hiding this comment.
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является строкой. Возможно, имелось в виду другое условие для активации этой задачи.Committable suggestion