Merge pull request #3 from kreuka/argos #34
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: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
setup-and-run-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
shard: [1/2, 2/2] | |
env: | |
EMAIL: ${{ secrets.EMAIL }} | |
PASSWORD: ${{ secrets.PASSWORD }} | |
API_BASE_URL: ${{ secrets.API_BASE_URL }} | |
TRELLO_API_KEY: ${{ secrets.TRELLO_API_KEY }} | |
TRELLO_API_TOKEN: ${{ secrets.TRELLO_API_TOKEN }} | |
TRELLO_API_SECRET: ${{ secrets.TRELLO_API_SECRET }} | |
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install chromium | |
- name: Run Playwright tests | |
run: npx playwright test --shard ${{ matrix.shard }} | |
- name: Upload blob report to GitHub Actions Artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: merged-reports-as-blob | |
path: blob-report | |
retention-days: 14 | |
merge-reports-and-upload: | |
if: always() | |
needs: [setup-and-run-tests] | |
runs-on: ubuntu-latest | |
outputs: | |
timestamp: ${{ steps.timestampid.outputs.timestamp }} | |
steps: | |
- name: Set a timestamp | |
id: timestampid | |
run: echo "timestamp=$(date --utc +%Y%m%d_%H%M%SZ)" >> "$GITHUB_OUTPUT" | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci | |
- name: Download blob reports from GitHub Actions Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: merged-reports-as-blob | |
path: downloaded-merged-reports-as-blob | |
- name: Merge the blobs into one single HTML Report | |
run: npx playwright merge-reports --reporter html ./downloaded-merged-reports-as-blob | |
- name: Upload full html report to artifacts for history | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: playwright-report-${{ steps.timestampid.outputs.timestamp }} | |
path: playwright-report | |
retention-days: 14 | |
- name: Push the new files to github pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./playwright-report | |
destination_dir: ${{ steps.timestampid.outputs.timestamp }} | |
- name: Write URL in summary | |
run: echo "### Test results (link available after 20 secs) - https://${{ github.repository_owner }}.github.io/trello-typescript-playwright/${{ steps.timestampid.outputs.timestamp }}/" >> $GITHUB_STEP_SUMMARY |