Skip to content

Commit

Permalink
feat: add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
gitstart-dub authored Oct 18, 2023
1 parent 54db743 commit 335a45d
Showing 1 changed file with 101 additions and 0 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Playwright Tests
on:
push:
jobs:
web-playwright-test:
name: Check dub web playwright tests
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get Node.js version
id: nvm
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.6.10
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Install Playwright Browsers
run: pnpm -r --filter='dub-web' run playwright:install-browsers
- name: Run Playwright tests
run: pnpm -r --filter='dub-web' run playwright:test
- uses: actions/upload-artifact@v3
if: always()
with:
name: apps-web-playwright-report
path: apps/web/playwright-report/
retention-days: 30

ui-package-playwright-test:
name: Check ui package playwright tests
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get Node.js version
id: nvm
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.6.10
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Install Playwright Browsers
run: pnpm -r --filter='@dub/ui' run playwright:install-browsers
- name: Run Playwright tests
run: pnpm -r --filter='@dub/ui' run playwright:test-ct
- uses: actions/upload-artifact@v3
if: always()
with:
name: packages-ui-playwright-report
path: packages/ui/playwright-report/
retention-days: 30

0 comments on commit 335a45d

Please sign in to comment.