Skip to content

Commit

Permalink
test(e2e): fix e2e test caching issue (#5763)
Browse files Browse the repository at this point in the history
* test(e2e): fix e2e test caching issue

* chore(e2e): fix cache path key

* chore(ci): add missing pnpm install step to cleanup
  • Loading branch information
binoy14 authored Feb 15, 2024
1 parent 8f3c44c commit 6caf803
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pr-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions dev/studio-e2e-testing/turbo.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 6caf803

Please sign in to comment.