Skip to content

Commit

Permalink
Merge branch 'next' into cli/learn
Browse files Browse the repository at this point in the history
  • Loading branch information
SimeonGriggs authored Oct 14, 2024
2 parents 9831346 + e3cc6d5 commit d46abd9
Show file tree
Hide file tree
Showing 524 changed files with 24,061 additions and 7,895 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const config = {
'ButtonProps',
'Dialog',
'DialogProps',
'ErrorBoundary',
'MenuButton',
'MenuButtonProps',
'MenuGroup',
Expand Down
5 changes: 5 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
"description": "ESBuild 0.23 drops support for Windows 7 and 8, for now we don't want renovate to open PRs to bump them",
"allowedVersions": "<=0.21",
"matchPackageNames": ["esbuild"]
},
{
"description": "Group TypeScript related deps in a single PR, as they often have to update together",
"groupName": "typescript-tooling",
"matchPackageNames": ["@sanity/pkg-utils", "@sanity/tsdoc", "typescript"]
}
],
"ignorePaths": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cli-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
run: |
node -v
npm -v
pnpm test -- --silent --selectProjects=@sanity/cli
pnpm test:jest --silent --selectProjects=@sanity/cli
env:
# Update token in github and change below to ${{ secrets.SANITY_CI_CLI_AUTH_TOKEN }} after merge to next
SANITY_CI_CLI_AUTH_TOKEN_STAGING: ${{ secrets.SANITY_CI_CLI_AUTH_TOKEN_STAGING }}
191 changes: 184 additions & 7 deletions .github/workflows/e2e-ct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,82 @@ on:
push:
branches: [next]
jobs:
test:
install:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
strategy:
fail-fast: false
matrix:
# Be sure to update all instances in this file and `pr-cleanup.yml` if updated
project: [chromium, firefox, webkit]
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: Build packages
run: pnpm build --output-logs=full --log-order=grouped

# Caches build from either PR or next
- name: Cache build
id: cache-e2e-build
uses: actions/cache@v4
env:
cache-name: cache-e2e-build
with:
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 }}

playwright-ct-test:
timeout-minutes: 30
needs: [install]
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
strategy:
fail-fast: false
matrix:
# Be sure to update all instances in this file and `pr-cleanup.yml` if updated
project: [chromium, firefox, webkit]
# Add more shards here if needed
shardIndex: [1, 2]
shardTotal: [2]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -58,38 +128,145 @@ jobs:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
- name: Install Playwright Browsers
# TODO: Fix webkit caching when downloading from cache
# for some reason it doesn't work without installing again
# if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Build packages
run: pnpm build --output-logs=full --log-order=grouped

- name: Restore build cache
uses: actions/cache/restore@v4
id: restore-build
env:
cache-name: cache-e2e-build
with:
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

- name: Run end-to-end tests
run: pnpm --filter sanity test:ct
env:
PWTEST_BLOB_REPORT_NAME: ${{ matrix.project }}
NODE_OPTIONS: --max_old_space_size=8192
run: pnpm --filter sanity test:ct --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-ct-report
path: ${{ github.workspace }}/packages/sanity/blob-report
retention-days: 30

merge-reports:
if: always()
needs: [playwright-ct-test]
runs-on: ubuntu-latest
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: Download blob reports from Github Actions Artifacts
uses: actions/download-artifact@v3
with:
name: playwright-ct-report
path: ${{ github.workspace }}/packages/sanity/playwright-ct/playwright-ct-report

- name: Merge into HTML Report
run: npx playwright merge-reports --reporter json ${{ github.workspace }}/packages/sanity/playwright-ct/playwright-ct-report >> ${{ github.workspace }}/packages/sanity/playwright-ct/playwright-ct-report/playwright-ct-test-results.json

- name: Get Current Job Log URL
uses: Tiryoh/gha-jobid-action@c1d1cf7334b70c29374ae382b91053674c8049a2 # v1
uses: Tiryoh/gha-jobid-action@be260d8673c9211a84cdcf37794ebd654ba81eef # v1
id: job_html_url
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
job_name: "test"
# Get the first run's ID even though it might be correct it should bring to the right place
job_name: "playwright-ct-test (chromium, 1, 2)"

- name: Parse playwright report
id: parse-playwright-report
if: always()
run: pnpm --filter sanity write:playwright-report-as-pr-comment
env:
GITHUB_WORKFLOW_URL: "${{ steps.job_html_url.outputs.html_url }}"

- name: PR comment with report
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2
if: ${{ always() && steps.parse-playwright-report.conclusion == 'success' && github.event_name == 'pull_request' }}
with:
comment_tag: "playwright-ct-report"
filePath: ${{ github.workspace }}/packages/sanity/playwright-ct/results/playwright-report-pr-comment.md
filePath: ${{ github.workspace }}/packages/sanity/playwright-ct/playwright-ct-report/playwright-report-pr-comment.md

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-ct-report
path: |
${{ github.workspace }}/packages/sanity/playwright-ct/report
${{ github.workspace }}/packages/sanity/playwright-ct/playwright-ct-report
${{ github.workspace }}/packages/sanity/playwright-ct/results
retention-days: 30

cleanup:
permissions:
contents: read
actions: write # needed to delete the cache
timeout-minutes: 30
name: Cleanup (${{ matrix.project }})
runs-on: ubuntu-latest
needs: [playwright-ct-test]

strategy:
# we want to know if a test fails on a specific node version
fail-fast: false
matrix:
# Be sure to update all instances in this file and `pr-cleanup.yml` if updated
project: [chromium, firefox, webkit]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18

# Delete the cache so it is only used once
- name: Delete Cache
run: gh cache delete ${{ runner.os }}-${{ matrix.project }}-${{ env.cache-name }}-${{ github.run_id }}
env:
cache-name: cache-e2e-build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 3 additions & 5 deletions .github/workflows/e2e-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
TURBO_TOKEN:
SANITY_E2E_SESSION_TOKEN_NEW:
required: true
SANITY_E2E_PROJECT_ID:
required: true

jobs:
prepare:
Expand Down Expand Up @@ -152,8 +150,8 @@ jobs:
# # Change the below to `secrets.SANITY_E2E_SESSION_TOKEN`
# # Delete `SANITY_E2E_SESSION_TOKEN_NEW` from github
# 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 }}
# SANITY_E2E_PROJECT_ID: ${{ vars.SANITY_E2E_PROJECT_ID }}
# SANITY_E2E_DATASET: ${{ vars.SANITY_E2E_DATASET }}
# run: pnpm e2e:setup && pnpm e2e:build

- name: Build E2E test studio on PR
Expand All @@ -164,7 +162,7 @@ jobs:
# Change the below to `secrets.SANITY_E2E_SESSION_TOKEN`
# Delete `SANITY_E2E_SESSION_TOKEN_NEW` from github
SANITY_E2E_SESSION_TOKEN: ${{ secrets.SANITY_E2E_SESSION_TOKEN_NEW }}
SANITY_E2E_PROJECT_ID: ${{ secrets.SANITY_E2E_PROJECT_ID }}
SANITY_E2E_PROJECT_ID: ${{ vars.SANITY_E2E_PROJECT_ID }}
SANITY_E2E_DATASET: pr-${{ matrix.project }}-${{ github.event.number }}
run: pnpm e2e:setup && pnpm e2e:build

Expand Down
Loading

0 comments on commit d46abd9

Please sign in to comment.