diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 0000000000..6cefedde28 --- /dev/null +++ b/.github/workflows/playwright.yml @@ -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