feat: output playwright code coverage report url #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright Tests | |
on: | |
pull_request: | |
branches: [master] | |
jobs: | |
e2e-test: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Start Express Server | |
run: npm run start:server & | |
- name: Run Playwright tests | |
run: npm run e2e | |
- name: Upload playwright report to Artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
- name: Upload playwright code coverage to Artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: coverage-e2e | |
path: coverage-e2e/lcov-report | |
retention-days: 30 | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: coverage-e2e/lcov-report | |
- name: Deploy Playwright result to Github Pages | |
id: code-coverage | |
uses: actions/deploy-pages@v2 | |
- name: update job summary | |
run: echo "# Deployed playwright code coverage result to ${{ steps.deployment.outputs.page_url }}" >> $GITHUB_STEP_SUMMARY |