Skip to content

Commit

Permalink
ci: deploy playwright report
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Dec 8, 2023
1 parent 18c9dc0 commit f0f3636
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GH pages
name: Publish unit test coverage

on:
push:
Expand Down
56 changes: 51 additions & 5 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Playwright Tests
name: Integration Tests

env:
CI: true
Expand Down Expand Up @@ -73,9 +73,55 @@ jobs:
run: xvfb-run yarn playwright test tests/specs --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --workers=1
env:
TEST_ACCOUNT_SECRET_KEY: ${{ secrets.TEST_ACCOUNT_SECRET_KEY }}
- uses: actions/upload-artifact@v3

- name: Upload blob report to GitHub Actions Artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: all-blob-reports
path: blob-report
retention-days: 1
if-no-files-found: error

merge-reports:
name: Merge reports
if: always()
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v3
with:
name: all-blob-reports
path: all-blob-reports

- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./all-blob-reports

- name: Upload HTML report
uses: actions/upload-artifact@v3
with:
name: html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 14

- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'pull_request'
with:
name: playwright-report
path: playwright-report/
retention-days: 10
personal_token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
external_repository: leather-wallet/playwright-reports
publish_branch: main
publish_dir: ./playwright-report
destination_dir: ${{ steps.extract_branch.outputs.branch }}
5 changes: 4 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export default defineConfig({
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [[process.env.CI ? 'github' : 'list'], ['html', { open: 'never' }]],
reporter: [
[process.env.CI ? 'github' : 'list'],
[process.env.CI ? 'blob' : 'html', { open: 'never' }],
],
use: {
trace: 'on-first-retry',
},
Expand Down

0 comments on commit f0f3636

Please sign in to comment.