From d164befb371e61334ad864ea94b50acd90016238 Mon Sep 17 00:00:00 2001 From: gitstart-dub <135832731+gitstart-dub@users.noreply.github.com> Date: Tue, 31 Oct 2023 06:24:14 +0100 Subject: [PATCH] Create playwright.yml --- .github/workflows/playwright.yml | 101 +++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 .github/workflows/playwright.yml 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