From ce1c1d696a59d7c244cfd391f0b80611ad8dea16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:16:44 -0600 Subject: [PATCH 1/2] update(ci): pubhlish playwright and allure report --- .github/workflows/automated-tests.yml | 99 ++++++++++++++++++++++----- 1 file changed, 83 insertions(+), 16 deletions(-) diff --git a/.github/workflows/automated-tests.yml b/.github/workflows/automated-tests.yml index 6dcba9a19..dcec549bd 100644 --- a/.github/workflows/automated-tests.yml +++ b/.github/workflows/automated-tests.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest container: - image: mcr.microsoft.com/playwright:v1.47.2-jammy + image: mcr.microsoft.com/playwright:v1.48.0-jammy strategy: fail-fast: false matrix: @@ -36,6 +36,7 @@ jobs: with: repository: Satellite-im/automated-tests-web path: automated-tests + ref: luis/playwright-report - name: Setup Node.js for Uplink Web 🔨 uses: actions/setup-node@v4.0.4 @@ -57,8 +58,8 @@ jobs: if: always() with: name: playwright-report-${{ matrix.project }} - path: automated-tests/playwright-report/ - retention-days: 5 + path: automated-tests/blob-report/ + retention-days: 1 - name: Upload Allure results as artifact if: always() @@ -66,7 +67,7 @@ jobs: with: name: allure-results-${{ matrix.project }} path: automated-tests/allure-results - retention-days: 5 + retention-days: 1 - name: Add label if any of build jobs failed if: failure() @@ -77,33 +78,94 @@ jobs: Failed Automated Test type: add - generate-report: + merge-reports: if: always() needs: playwright-run runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.48.0-jammy + steps: + - name: Download Blob Report from Desktop + uses: actions/download-artifact@v4 + with: + name: playwright-report-desktop-chrome + path: blob-report + + - name: Download Blob Report from Mobile + uses: actions/download-artifact@v4 + with: + name: playwright-report-mobile-chrome + path: blob-report + + - name: Merge Blob Reports into HTML Report + run: npx playwright merge-reports --reporter html ./blob-report + + - name: Upload Merged Report + if: always() + uses: actions/upload-artifact@v4 + with: + name: playwright-merged-report + path: playwright-report + retention-days: 5 + + - name: Delete temporary artifacts + uses: geekyeggo/delete-artifact@v5 + with: + name: | + playwright-report-desktop-chrome + playwright-report-mobile-chrome + + publish-report: + if: always() + needs: merge-reports + runs-on: ubuntu-latest permissions: checks: write pull-requests: write contents: write issues: read steps: + - name: Download Merged Report + uses: actions/download-artifact@v4 + with: + name: playwright-merged-report + path: playwright-report + + - name: Set a timestamp one + id: timestampidone + run: echo "timestamp=$(date --utc +%Y%m%d_%H%M%SZ)" >> "$GITHUB_OUTPUT" + + - name: Deploy Playwright HTML report to Github Pages + if: success() + uses: peaceiris/actions-gh-pages@v4 + with: + deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} + external_repository: Satellite-im/test-reports + keep_files: true + publish_branch: gh-pages + publish_dir: ./playwright-report + destination_dir: ${{ steps.timestampidone.outputs.timestamp }} + + - name: Stop ssh-agent job from first deploy required for deploying a second time + run: killall ssh-agent + - name: Download Allure results artifact for desktop uses: actions/download-artifact@v4.1.8 with: name: allure-results-desktop-chrome - path: automated-tests/allure/desktop-chrome + path: allure/desktop-chrome - name: Download Allure results artifact for mobile uses: actions/download-artifact@v4.1.8 with: name: allure-results-mobile-chrome - path: automated-tests/allure/mobile-chrome + path: allure/mobile-chrome - name: Merge Allure results run: | - mkdir -p automated-tests/allure-results - cp -r automated-tests/allure/desktop-chrome/* automated-tests/allure-results/ - cp -r automated-tests/allure/mobile-chrome/* automated-tests/allure-results/ + mkdir -p allure-results + cp -r allure/desktop-chrome/* allure-results/ + cp -r allure/mobile-chrome/* allure-results/ - name: Get Allure history uses: actions/checkout@v4.2.0 @@ -119,10 +181,16 @@ jobs: uses: simple-elf/allure-report-action@master with: gh_pages: gh-pages - allure_results: automated-tests/allure-results + allure_results: allure-results allure_report: allure-report allure_history: allure-history keep_reports: 100 + github_repo: Satellite-im/test-reports + github_repo_owner: Satellite-im + + - name: Set a timestamp two + id: timestampidtwo + run: echo "timestamp=$(date --utc +%Y%m%d_%H%M%SZ)" >> "$GITHUB_OUTPUT" - name: Deploy report to Github Pages if: success() @@ -131,19 +199,19 @@ jobs: deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} external_repository: Satellite-im/test-reports publish_branch: gh-pages - publish_dir: allure-history + publish_dir: ./allure-history - name: Comment PR with Allure test results if: always() && github.event_name == 'pull_request' uses: mshick/add-pr-comment@v2.8.2 with: message: | - Playwright test execution is complete! You can find the test results report [here](https://satellite-im.github.io/test-reports/${{ github.run_number }}) + Automated tests execution is complete! You can find the Playwright test report [here](https://satellite-im.github.io/test-reports/${{ steps.timestampidone.outputs.timestamp }}/) and the Allure Test Report [here](https://satellite-im.github.io/test-reports/${{ github.run_number }}) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} remove-label: - needs: [playwright-run, generate-report] + needs: [playwright-run, merge-reports, publish-report] runs-on: ubuntu-latest permissions: checks: write @@ -159,8 +227,7 @@ jobs: uses: geekyeggo/delete-artifact@v5.1.0 with: name: | - playwright-report-desktop-chrome - playwright-report-mobile-chrome + playwright-merged-report allure-results-desktop-chrome allure-results-mobile-chrome From 38636e0e95a56d2f73688e69741b574b3a52d025 Mon Sep 17 00:00:00 2001 From: Sara Tavares <29093946+stavares843@users.noreply.github.com> Date: Mon, 14 Oct 2024 22:54:51 +0100 Subject: [PATCH 2/2] Update .github/workflows/automated-tests.yml --- .github/workflows/automated-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/automated-tests.yml b/.github/workflows/automated-tests.yml index dcec549bd..d30cf7bd6 100644 --- a/.github/workflows/automated-tests.yml +++ b/.github/workflows/automated-tests.yml @@ -36,7 +36,6 @@ jobs: with: repository: Satellite-im/automated-tests-web path: automated-tests - ref: luis/playwright-report - name: Setup Node.js for Uplink Web 🔨 uses: actions/setup-node@v4.0.4