diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f69954b1af..8af417560d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -99,6 +99,8 @@ jobs: name: Run Central Server system tests needs: BuildAndPackageWithUnitTests runs-on: ubuntu-22.04 + outputs: + cs-artifacts-url: ${{ steps.cs-artifacts-step.outputs.artifact-url }} services: registry: image: registry:2 @@ -149,15 +151,48 @@ jobs: name: Central Server system test path: src/central-server/admin-service/ui-system-test/build/test-results/**/TEST-*.xml reporter: java-junit - - name: Upload CS screenshots - if: failure() + - name: Fix ui-system-test build dir permissions + run: sudo chown -R $USER src/central-server/admin-service/ui-system-test/build/cs-container-logs/ && sudo chown -R $USER src/central-server/admin-service/ui-system-test/build/ca-container-logs/ + if: always() + - name: Upload CS report + id: cs-artifacts-step uses: actions/upload-artifact@v4 + if: always() + with: + name: CS System Test report + path: | + src/central-server/admin-service/ui-system-test/cs-container-logs/ + src/central-server/admin-service/ui-system-test/ca-container-logs/ + src/central-server/admin-service/ui-system-test/reports/test-automation/selenide-failures/*.png + - name: Load test report history + uses: actions/checkout@v4 + if: always() + continue-on-error: true + with: + ref: allure-gh-pages + path: allure-reports + + - name: Build test report + uses: simple-elf/allure-report-action@v1.9 + if: always() with: - name: CS System Test screenshots - path: src/central-server/admin-service/ui-system-test/build/reports/test-automation/selenide-failures/*.png + gh_pages: allure-reports + subfolder: central-server/ui-system-test + allure_history: allure-history + allure_results: src/central-server/admin-service/ui-system-test/build/allure-results + + - name: Publish test report + uses: peaceiris/actions-gh-pages@v4 + if: always() + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: allure-gh-pages + publish_dir: allure-history RunSSSystemTests: name: Run Security Server system tests needs: BuildAndPackageWithUnitTests + outputs: + ss-artifacts-url: ${{ steps.ss-artifacts-step.outputs.artifact-url }} runs-on: ubuntu-22.04 services: registry: @@ -209,10 +244,11 @@ jobs: reporter: java-junit - name: Fix system-test build dir permissions run: sudo chown -R $USER src/security-server/system-test/build/ss-container-logs/ && sudo chown -R $USER src/security-server/system-test/build/ca-container-logs/ - if: failure() + if: always() - name: Upload SS report + id: ss-artifacts-step uses: actions/upload-artifact@v4 - if: failure() + if: always() with: name: SS System Test report path: | @@ -220,10 +256,38 @@ jobs: src/security-server/system-test/build/ss-container-logs/ src/security-server/system-test/build/ca-container-logs/ src/security-server/system-test/build/reports/test-automation/selenide-failures/*.png + - name: SS report artifact URL + run: echo 'Artifact URL is ${{ steps.ss-artifacts-step.outputs.artifact-url }}' + - name: Load test report history + uses: actions/checkout@v4 + if: always() + continue-on-error: true + with: + ref: allure-gh-pages + path: allure-reports + + - name: Build test report + uses: simple-elf/allure-report-action@v1.9 + if: always() + with: + gh_pages: allure-reports + subfolder: security-server/system-test + allure_history: allure-history + allure_results: src/security-server/system-test/build/allure-results + + - name: Publish test report + uses: peaceiris/actions-gh-pages@v4 + if: always() + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: allure-gh-pages + publish_dir: allure-history RunE2ETests: name: Run E2E tests needs: BuildAndPackageWithUnitTests runs-on: ubuntu-22.04 + outputs: + e2e-artifacts-url: ${{ steps.e2e-artifacts-step.outputs.artifact-url }} services: registry: image: registry:2 @@ -293,9 +357,58 @@ jobs: path: src/security-server/e2e-test/build/test-results/**/TEST-*.xml reporter: java-junit - name: Upload E2E report + id: e2e-artifacts-step uses: actions/upload-artifact@v4 if: failure() with: name: E2E report path: | src/security-server/e2e-test/build/allure-report/ + - name: Load test report history + uses: actions/checkout@v4 + if: always() + continue-on-error: true + with: + ref: allure-gh-pages + path: allure-reports + + - name: Build test report + uses: simple-elf/allure-report-action@v1.9 + if: always() + with: + gh_pages: allure-reports + subfolder: e2e + allure_history: allure-history + allure_results: src/security-server/e2e-test/build/allure-results + - name: Publish test report + uses: peaceiris/actions-gh-pages@v4 + if: always() + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: allure-gh-pages + publish_dir: allure-history + CreateAllureLinks: + name: Create Allure links + needs: [RunCSSystemTests, RunSSSystemTests, RunE2ETests] + runs-on: ubuntu-22.04 + steps: + - name: Generate links table + uses: actions/github-script@v7 + with: + script: | + const csArtifactsUrl = `${{ needs.RunCSSystemTests.outputs.cs-artifacts-url }}`; + const ssArtifactsUrl = `${{ needs.RunSSSystemTests.outputs.ss-artifacts-url }}`; + const e2eArtifactsUrl = `${{ needs.RunE2ETests.outputs.e2e-artifacts-url }}`; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `## Allure reports for run ${{ github.run_number }} + + | Test suite | Report URL | Artifacts | + |-----------------|------------|-----------| + | Central Server | Report | ${csArtifactsUrl !== '' ? 'Artifacts' : 'N/A'} | + | Security Server | Report | ${ssArtifactsUrl !== '' ? 'Artifacts' : 'N/A'} | + | E2E | Report | ${e2eArtifactsUrl !== '' ? 'Artifacts' : 'N/A'} | + ` + }) diff --git a/src/build.gradle b/src/build.gradle index fc0f75bec2..ffc7a4c7cb 100644 --- a/src/build.gradle +++ b/src/build.gradle @@ -261,3 +261,4 @@ tasks.register("installGitHooks", Copy) { } assemble.dependsOn installGitHooks tasks.sonar.dependsOn testCodeCoverageReport +tasks.sonar.onlyIf { System.env['SONAR_TOKEN'] != null }