Skip to content

Commit

Permalink
chore(test): jest 29 migration (#5069)
Browse files Browse the repository at this point in the history
* chore: migrate to jest 28

* chore: test jest sharding

* chore(test): ignore playwright tests

* chore(test): revert ci changes from base

* chore(test): add sharding

* chore(test): fix shard dataset name and remove unused deps

* chore(test): split install and test jobs

* chore(test): restore npm cache in test step

* chore(test): add install step

* chore(test): fix cache name

* chore(test): install playwright in test steps

* chore(test): move playwright install after install

* chore(test): upgrade to jest 29

* chore(test): dedupe yarn.lock

* chore(dev): remove the create react app starter example

* chore(deps): add missing dev dependency

* chore(portable-text-editor): speed up tests

* chore(portable-text-editor): update jest-dev-server

---------

Co-authored-by: Fred Carlsen <fred@sjelfull.no>
Co-authored-by: Bjørge Næss <bjoerge@gmail.com>
Co-authored-by: Per-Kristian Nordnes <per.kristian.nordnes@gmail.com>
  • Loading branch information
4 people authored Oct 26, 2023
1 parent 01e3eef commit fd3a972
Show file tree
Hide file tree
Showing 25 changed files with 918 additions and 4,685 deletions.
91 changes: 87 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ on:
branches: [next]

jobs:
test:
install:
timeout-minutes: 60
name: Test (${{ matrix.os }} / node ${{ matrix.node }})
name: Install (${{ matrix.os }} / node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
continue-on-error: ${{ matrix.experimental }}

strategy:
# we want to know if a test fails on a specific node version
fail-fast: false
matrix:
os: [ubuntu-latest]
Expand Down Expand Up @@ -51,6 +50,19 @@ jobs:
${{ runner.os }}-modules-
${{ runner.os }}-
- name: Cache build
id: cache-build
uses: actions/cache@v3
env:
cache-name: cache-build
with:
path: './*'
key: ${{ runner.os }}-build-${{ matrix.node }}-${{ env.cache-name }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install project dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
Expand All @@ -75,11 +87,82 @@ jobs:
- name: Build CLI
run: yarn build:cli # Needed for CLI tests

test:
timeout-minutes: 60
name: Test (${{ matrix.os }} / node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
continue-on-error: ${{ matrix.experimental }}
needs: [install]

strategy:
# we want to know if a test fails on a specific node version
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [18, 20]
experimental: [false]
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
# include:
# - os: windows-latest
# node: 16
# experimental: true

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

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- uses: actions/cache@v3
id: restore-node-modules
env:
cache-name: cache-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}

- uses: actions/cache@v3
id: restore-build
env:
cache-name: cache-build
with:
path: ./*
key: ${{ runner.os }}-build-${{ matrix.node }}-${{ env.cache-name }}-${{ github.run_id }}

- name: Install project dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

- 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@v3
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: Test
id: test
run: |
node -v
npm -v
yarn test --silent
yarn test --silent --shard=${{ matrix.shardIndex}}/${{ matrix.shardTotal }}
env:
SANITY_CI_CLI_AUTH_TOKEN: ${{ secrets.SANITY_CI_CLI_AUTH_TOKEN }}
GITHUB_SHARD_IDENTIFIER: ${{ matrix.shardIndex }}-${{ matrix.shardTotal }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ blob-report
.yarn
.yarnrc
.turbo
.yalc
yalc.lock

## Documentation Report
scripts/docs-report.md

3 changes: 0 additions & 3 deletions dev/starter-cra-studio/.depcheckignore.json

This file was deleted.

23 changes: 0 additions & 23 deletions dev/starter-cra-studio/.gitignore

This file was deleted.

70 changes: 0 additions & 70 deletions dev/starter-cra-studio/README.md

This file was deleted.

31 changes: 0 additions & 31 deletions dev/starter-cra-studio/package.json

This file was deleted.

Binary file removed dev/starter-cra-studio/public/favicon.ico
Binary file not shown.
40 changes: 0 additions & 40 deletions dev/starter-cra-studio/public/index.html

This file was deleted.

Binary file removed dev/starter-cra-studio/public/logo192.png
Binary file not shown.
Binary file removed dev/starter-cra-studio/public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions dev/starter-cra-studio/public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions dev/starter-cra-studio/public/robots.txt

This file was deleted.

33 changes: 0 additions & 33 deletions dev/starter-cra-studio/src/Studio.js

This file was deleted.

9 changes: 0 additions & 9 deletions dev/starter-cra-studio/src/index.css

This file was deleted.

14 changes: 0 additions & 14 deletions dev/starter-cra-studio/src/index.js

This file was deleted.

Loading

2 comments on commit fd3a972

@vercel
Copy link

@vercel vercel bot commented on fd3a972 Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

performance-studio – ./

performance-studio-git-next.sanity.build
performance-studio.sanity.build

@vercel
Copy link

@vercel vercel bot commented on fd3a972 Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio.sanity.build
test-studio-git-next.sanity.build

Please sign in to comment.