Skip to content

Commit

Permalink
chore(e2e): fix e2e action failing (#5735)
Browse files Browse the repository at this point in the history
* test(ci): update cache key

* chore(e2e): fix action pnpm cache

* chore(e2e): update pnpm command maybe

* chore(e2e): add missing turbo.json
  • Loading branch information
binoy14 authored and rexxars committed Feb 14, 2024
1 parent f0fad4c commit 4c02649
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 19 deletions.
56 changes: 37 additions & 19 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,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@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: Store Playwright's Version
Expand Down Expand Up @@ -114,24 +123,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: Store Playwright's Version
Expand Down Expand Up @@ -174,7 +192,7 @@ jobs:
SANITY_E2E_SESSION_TOKEN: ${{ secrets.SANITY_E2E_SESSION_TOKEN_NEW }}
SANITY_E2E_PROJECT_ID: ${{ secrets.SANITY_E2E_PROJECT_ID }}
SANITY_E2E_DATASET: ${{ secrets.SANITY_E2E_DATASET }}
run: npx playwright test --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
run: pnpm test:e2e --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- name: Run E2E tests on PR
if: ${{ github.event_name == 'pull_request' }}
Expand All @@ -188,7 +206,7 @@ jobs:
SANITY_E2E_SESSION_TOKEN: ${{ secrets.SANITY_E2E_SESSION_TOKEN_NEW }}
SANITY_E2E_PROJECT_ID: ${{ secrets.SANITY_E2E_PROJECT_ID }}
SANITY_E2E_DATASET: pr-${{ matrix.project }}-${{ github.event.number }}
run: npx playwright test --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
run: pnpm test:e2e --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- uses: actions/upload-artifact@v3
if: always()
Expand Down
9 changes: 9 additions & 0 deletions dev/studio-e2e-testing/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"pipeline": {
"build": {
"outputs": [".sanity/**", "dist/**"]
}
}
}

0 comments on commit 4c02649

Please sign in to comment.