From 485ee929f83f67c1830b23976080a2328344edb0 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Tue, 23 Jan 2024 22:32:32 +0100 Subject: [PATCH 1/7] Update test.yml with additional test script arguments and JUnit report decoration --- .github/workflows/test.yml | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 12fae4f..9c0fa2c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -57,4 +68,22 @@ jobs: opm install -l --dev - name: Тестирование - run: oscript ${{ inputs.test_script_path}} + run: oscript ${{ inputs.test_script_path}} ${{ inputs.test_script_args }} + + - name: Проверка существтования директории с результатами тестов + id: check_files + uses: andstor/file-existence-action@v2 + with: + files: ${{ inputs.junit_report_path }} + + - name: Сохранение результатов тестирования + if: always() && steps.check_files.outputs.files_exists == 'true' && matrix.os == 'ubuntu-latest' + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + junit_files: "**/test-results/test/**/*.xml" + + - name: Сохранение результатов тестирования + if: always() && steps.check_files.outputs.files_exists == 'true' && matrix.os != 'ubuntu-latest' + uses: EnricoMi/publish-unit-test-result-action/composite@v2 + with: + junit_files: "**/test-results/test/**/*.xml" \ No newline at end of file From 3fc14db1e579cd556422366218fbe959c4979946 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Tue, 23 Jan 2024 22:38:29 +0100 Subject: [PATCH 2/7] Commented out permissions in test.yml workflow --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c0fa2c..a32bb1b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,9 +22,9 @@ on: jobs: build: - permissions: - checks: write - pull-requests: write + # permissions: + # checks: write + # pull-requests: write runs-on: ${{ matrix.os }} strategy: fail-fast: false From c3be72425f058c014087d3542a811cb8db5e8088 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Tue, 23 Jan 2024 22:40:05 +0100 Subject: [PATCH 3/7] Fix typo in test workflow step name --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a32bb1b..f07ffd5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,7 +70,7 @@ jobs: - name: Тестирование run: oscript ${{ inputs.test_script_path}} ${{ inputs.test_script_args }} - - name: Проверка существтования директории с результатами тестов + - name: Проверка существования директории с результатами тестов id: check_files uses: andstor/file-existence-action@v2 with: From 0593db45ebdc40f64a672299ef1a003f7f9b61eb Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Tue, 23 Jan 2024 22:40:41 +0100 Subject: [PATCH 4/7] Update junit_files path in test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f07ffd5..72da730 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -80,10 +80,10 @@ jobs: if: always() && steps.check_files.outputs.files_exists == 'true' && matrix.os == 'ubuntu-latest' uses: EnricoMi/publish-unit-test-result-action@v2 with: - junit_files: "**/test-results/test/**/*.xml" + junit_files: ${{ inputs.junit_report_path }} - name: Сохранение результатов тестирования if: always() && steps.check_files.outputs.files_exists == 'true' && matrix.os != 'ubuntu-latest' uses: EnricoMi/publish-unit-test-result-action/composite@v2 with: - junit_files: "**/test-results/test/**/*.xml" \ No newline at end of file + junit_files: ${{ inputs.junit_report_path }} \ No newline at end of file From a2058d96d785e29c69235c883fce6cb64e7f10ef Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Tue, 23 Jan 2024 22:45:36 +0100 Subject: [PATCH 5/7] Update junit_files path in test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 72da730..a32d7d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -80,10 +80,10 @@ jobs: if: always() && steps.check_files.outputs.files_exists == 'true' && matrix.os == 'ubuntu-latest' uses: EnricoMi/publish-unit-test-result-action@v2 with: - junit_files: ${{ inputs.junit_report_path }} + junit_files: "${{ inputs.junit_report_path }}/**/*.xml" - name: Сохранение результатов тестирования if: always() && steps.check_files.outputs.files_exists == 'true' && matrix.os != 'ubuntu-latest' uses: EnricoMi/publish-unit-test-result-action/composite@v2 with: - junit_files: ${{ inputs.junit_report_path }} \ No newline at end of file + junit_files: "${{ inputs.junit_report_path }}/**/*.xml" \ No newline at end of file From bcc65645926fff723ad5e7d35e36f1e2095f60ff Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Tue, 23 Jan 2024 23:02:18 +0100 Subject: [PATCH 6/7] Add test artifacts upload and test results publishing --- .github/workflows/test.yml | 39 +++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a32d7d7..39bb613 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,20 +70,41 @@ jobs: - name: Тестирование 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: ${{ inputs.junit_report_path }} + files: artifacts/**/*.xml - name: Сохранение результатов тестирования - if: always() && steps.check_files.outputs.files_exists == 'true' && matrix.os == 'ubuntu-latest' + if: steps.check_files.outputs.files_exists == 'true' uses: EnricoMi/publish-unit-test-result-action@v2 with: - junit_files: "${{ inputs.junit_report_path }}/**/*.xml" - - - name: Сохранение результатов тестирования - if: always() && steps.check_files.outputs.files_exists == 'true' && matrix.os != 'ubuntu-latest' - uses: EnricoMi/publish-unit-test-result-action/composite@v2 - with: - junit_files: "${{ inputs.junit_report_path }}/**/*.xml" \ No newline at end of file + files: "artifacts/**/*.xml" From be839bf4eda9de509aec845844237946e8bf6470 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Thu, 22 Feb 2024 10:18:55 +0100 Subject: [PATCH 7/7] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B8=20=D0=BE=D1=82=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B2=20codecov=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=83=D1=80=D0=BE=D0=B2=D0=BD=D0=B5=20sonar.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonar.yml | 53 ++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 9ba803d..23f3dcd 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -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/branch-name@v1.0.1 - 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/branch-name@v1.0.1 + + - 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/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: autumn-library/autumn + + \ No newline at end of file