Skip to content

Commit

Permalink
Post a summary of the flaky tests to the commit (#45798)
Browse files Browse the repository at this point in the history
* Post a summary of the flaky tests to the commit

* Add test for rendering commit comment

* Update name from admin to puppeteer
  • Loading branch information
kevin940726 authored Dec 16, 2022
1 parent 9c1b457 commit 6888113
Show file tree
Hide file tree
Showing 14 changed files with 656 additions and 340 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/end2end-test-playwright.yml

This file was deleted.

97 changes: 94 additions & 3 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ concurrency:
cancel-in-progress: true

jobs:
admin:
name: Admin - ${{ matrix.part }}
e2e-puppeteer:
name: Puppeteer - ${{ matrix.part }}
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
strategy:
Expand Down Expand Up @@ -60,6 +60,97 @@ jobs:
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: flaky-tests-report-${{ matrix.part }}
name: flaky-tests-report
path: flaky-tests
if-no-files-found: ignore

e2e-playwright:
name: Playwright
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false

steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Use desired version of NodeJS
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm

- name: Npm install and build
run: |
npm ci
npm run build
- name: Install Playwright dependencies
run: |
npx playwright install chromium firefox webkit --with-deps
- name: Install WordPress and start the server
run: |
npm run wp-env start
- name: Run the tests
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e:playwright
- name: Archive debug artifacts (screenshots, traces)
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: failures-artifacts
path: artifacts/test-results
if-no-files-found: ignore

- name: Archive flaky tests report
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: flaky-tests-report
path: flaky-tests
if-no-files-found: ignore

report-to-issues:
name: Report to GitHub
needs: [e2e-puppeteer, e2e-playwright]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
# Checkout defaults to using the branch which triggered the event, which
# isn't necessarily `trunk` (e.g. in the case of a merge).
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
ref: trunk

- uses: actions/download-artifact@v3
id: download_artifact
# Don't fail the job if there isn't any flaky tests report.
continue-on-error: true
with:
name: flaky-tests-report
path: flaky-tests

- name: Use desired version of NodeJS
if: ${{ steps.download_artifact.outcome == 'success' }}
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm

- name: Npm install and build
if: ${{ steps.download_artifact.outcome == 'success' }}
# TODO: We don't have to build the entire project, just the action itself.
run: |
npm ci
npm run build:packages
- name: Report flaky tests
if: ${{ steps.download_artifact.outcome == 'success' }}
uses: ./packages/report-flaky-tests
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
label: '[Type] Flaky Test'
artifact-path: flaky-tests
38 changes: 0 additions & 38 deletions .github/workflows/flaky-tests.yml

This file was deleted.

Loading

1 comment on commit 6888113

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3711190830
📝 Reported issues:

Please sign in to comment.