From c37e7f19429d97c092e22d30a3bf71becf972fc9 Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Thu, 19 Sep 2024 09:37:40 -0400 Subject: [PATCH 1/4] chore: add efps github actions --- .github/workflows/efps.yml | 67 ++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/efps.yml diff --git a/.github/workflows/efps.yml b/.github/workflows/efps.yml new file mode 100644 index 00000000000..ea93fc3218f --- /dev/null +++ b/.github/workflows/efps.yml @@ -0,0 +1,67 @@ +name: eFPS Test +on: + pull_request: +jobs: + install: + timeout-minutes: 30 + runs-on: ubuntu-latest + env: + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + TURBO_TEAM: ${{ vars.TURBO_TEAM }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + id: pnpm-install + with: + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Cache node modules + id: cache-node-modules + uses: actions/cache@v4 + env: + cache-name: cache-node-modules + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + v1-${{ runner.os }}-pnpm-store-${{ env.cache-name }}- + v1-${{ runner.os }}-pnpm-store- + v1-${{ runner.os }}- + + - name: Install project dependencies + run: pnpm install + + - name: Store Playwright's Version + run: | + PLAYWRIGHT_VERSION=$(npx playwright --version | sed 's/Version //') + echo "Playwright's Version: $PLAYWRIGHT_VERSION" + echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV + + - name: Cache Playwright Browsers for Playwright's Version + id: cache-playwright-browsers + uses: actions/cache@v4 + with: + path: ~/.cache/ms-playwright + key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} + + - name: Install Playwright Browsers + if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' + run: npx playwright install --with-deps + + - name: Run eFPS tests + env: + VITE_PERF_EFPS_PROJECT_ID: ${{ secrets.PERF_EFPS_PROJECT_ID }} + VITE_PERF_EFPS_DATASET: ${{ secrets.PERF_EFPS_DATASET }} + PERF_EFPS_SANITY_TOKEN: ${{ secrets.SANITY_E2E_SESSION_TOKEN_NEW }} + run: pnpm efps:test diff --git a/package.json b/package.json index 923d3610000..4409c9635de 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "e2e:setup": "node -r dotenv-flow/config -r esbuild-register scripts/e2e/setup", "e2e:start": "pnpm --filter studio-e2e-testing preview", "etl": "node -r dotenv-flow/config -r esbuild-register scripts/etl", + "efps:test": "cd perf/efps && pnpm test", "example:blog-studio": "cd examples/blog-studio && pnpm start", "example:clean-studio": "cd examples/blog-studio && pnpm start", "example:ecommerce-studio": "cd examples/blog-studio && pnpm start", From 807197f7063ad8dee1ca7467727b8c8e0e82c41c Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Thu, 19 Sep 2024 09:54:37 -0400 Subject: [PATCH 2/4] chore: use different token for efps tests --- .github/workflows/efps.yml | 2 +- perf/efps/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/efps.yml b/.github/workflows/efps.yml index ea93fc3218f..80f15bc8573 100644 --- a/.github/workflows/efps.yml +++ b/.github/workflows/efps.yml @@ -63,5 +63,5 @@ jobs: env: VITE_PERF_EFPS_PROJECT_ID: ${{ secrets.PERF_EFPS_PROJECT_ID }} VITE_PERF_EFPS_DATASET: ${{ secrets.PERF_EFPS_DATASET }} - PERF_EFPS_SANITY_TOKEN: ${{ secrets.SANITY_E2E_SESSION_TOKEN_NEW }} + PERF_EFPS_SANITY_TOKEN: ${{ secrets.PERF_EFPS_SANITY_TOKEN }} run: pnpm efps:test diff --git a/perf/efps/index.ts b/perf/efps/index.ts index 87fefb201af..81f382e8b91 100644 --- a/perf/efps/index.ts +++ b/perf/efps/index.ts @@ -80,7 +80,7 @@ const sanityPackagePath = path.join(tmpDir, 'node_modules', 'sanity') await exec({ text: ['Ensuring playwright is installed…', 'Playwright is installed'], - command: 'npx playwright install', + command: 'npx playwright install --with-deps', spinner, }) From d706fa4b35b3c886e7fdd515e561ea88aeba09c0 Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Thu, 19 Sep 2024 22:20:21 -0400 Subject: [PATCH 3/4] test: add comment with perf report result --- .github/workflows/efps.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/efps.yml b/.github/workflows/efps.yml index 80f15bc8573..dbe3c389a63 100644 --- a/.github/workflows/efps.yml +++ b/.github/workflows/efps.yml @@ -65,3 +65,17 @@ jobs: VITE_PERF_EFPS_DATASET: ${{ secrets.PERF_EFPS_DATASET }} PERF_EFPS_SANITY_TOKEN: ${{ secrets.PERF_EFPS_SANITY_TOKEN }} run: pnpm efps:test + + - name: PR comment with report + uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2 + if: ${{ github.event_name == 'pull_request' }} + with: + comment_tag: "efps-report" + filePath: ${{ github.workspace }}/perf/efps/results/benchmark-results.md + + - uses: actions/upload-artifact@v3 + if: always() + with: + name: efps-report + path: perf/efps/results + retention-days: 30 From c3f3a196d287934e0a0b9699e3805b903a0a07f1 Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Thu, 19 Sep 2024 23:01:39 -0400 Subject: [PATCH 4/4] test: keep playwright install script --- perf/efps/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perf/efps/index.ts b/perf/efps/index.ts index 81f382e8b91..87fefb201af 100644 --- a/perf/efps/index.ts +++ b/perf/efps/index.ts @@ -80,7 +80,7 @@ const sanityPackagePath = path.join(tmpDir, 'node_modules', 'sanity') await exec({ text: ['Ensuring playwright is installed…', 'Playwright is installed'], - command: 'npx playwright install --with-deps', + command: 'npx playwright install', spinner, })