From 6caf80314f5bec4a1ab8808a9e84e1a24d9b1d8d Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Thu, 15 Feb 2024 18:21:17 -0500 Subject: [PATCH] test(e2e): fix e2e test caching issue (#5763) * test(e2e): fix e2e test caching issue * chore(e2e): fix cache path key * chore(ci): add missing pnpm install step to cleanup --- .github/workflows/e2e.yml | 38 ++++++++++++++++++++++--------- .github/workflows/pr-cleanup.yml | 3 +++ dev/studio-e2e-testing/turbo.json | 9 -------- package.json | 2 +- 4 files changed, 31 insertions(+), 21 deletions(-) delete mode 100644 dev/studio-e2e-testing/turbo.json diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 77a7c6a67d9..649cf44a75d 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -69,6 +69,9 @@ jobs: if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' run: npx playwright install --with-deps + - name: Build CLI + run: pnpm build:cli + - name: Build E2E test studio on next if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }} env: @@ -98,7 +101,9 @@ jobs: env: cache-name: cache-e2e-build with: - path: './*' + path: | + ./* + !**/node_modules/** # Unique key for a workflow run. Should be invalidated in the next run key: ${{ runner.os }}-${{ matrix.project }}-${{ env.cache-name }}-${{ github.run_id }} @@ -175,7 +180,9 @@ jobs: env: cache-name: cache-e2e-build with: - path: ./* + path: | + ./* + !**/node_modules/** key: ${{ runner.os }}-${{ matrix.project }}-${{ env.cache-name }}-${{ github.run_id }} # If the cached build from the pervious step is not available. Fail the build fail-on-cache-miss: true @@ -224,24 +231,33 @@ jobs: with: node-version: 18 - - name: Install pnpm - run: corepack enable && pnpm --version + - uses: pnpm/action-setup@v2 + name: Install pnpm + id: pnpm-install + with: + version: 8 + 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/restore@v3 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | - ${{ runner.os }}-modules-${{ env.cache-name }}- - ${{ runner.os }}-modules- - ${{ runner.os }}- + v1-${{ runner.os }}-pnpm-store-${{ env.cache-name }}- + v1-${{ runner.os }}-pnpm-store- + v1-${{ runner.os }}- - name: Install project dependencies - if: steps.cache-node-modules.outputs.cache-hit != 'true' run: pnpm install - name: Download blob reports from Github Actions Artifacts diff --git a/.github/workflows/pr-cleanup.yml b/.github/workflows/pr-cleanup.yml index d5f635fc51a..a64bafe4970 100644 --- a/.github/workflows/pr-cleanup.yml +++ b/.github/workflows/pr-cleanup.yml @@ -59,6 +59,9 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Install pnpm + run: corepack enable && pnpm --version + - name: Cache node modules id: cache-node-modules uses: actions/cache@v3 diff --git a/dev/studio-e2e-testing/turbo.json b/dev/studio-e2e-testing/turbo.json deleted file mode 100644 index e469515d651..00000000000 --- a/dev/studio-e2e-testing/turbo.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "https://turbo.build/schema.json", - "extends": ["//"], - "pipeline": { - "build": { - "outputs": [".sanity/**", "dist/**"] - } - } -} diff --git a/package.json b/package.json index 7fd3755d97b..b5f182c1211 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "docs:report": "node -r dotenv-flow/config -r esbuild-register scripts/doc-report/docReport", "docs:report:cleanup": "node -r dotenv-flow/config -r esbuild-register scripts/doc-report/docReportCleanup", "docs:report:create": "node -r dotenv-flow/config -r esbuild-register scripts/doc-report/docReportCreate", - "e2e:build": "turbo run --filter=studio-e2e-testing build", + "e2e:build": "pnpm --filter studio-e2e-testing build", "e2e:cleanup": "node -r dotenv-flow/config -r esbuild-register scripts/e2e/cleanup", "e2e:codegen": "node -r dotenv-flow/config ./node_modules/.bin/sanity-test codegen", "e2e:dev": "pnpm --filter studio-e2e-testing dev",