Skip to content

Commit

Permalink
ci: move pte e2e collaborationtests out in own workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
skogsmaskin committed Oct 26, 2023
1 parent 311d5b6 commit 7d70939
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 2 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/e2e-pte.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: End-to-End PTE collaboration tests
on:
# Build on pushes branches that have a PR (including drafts)
pull_request:
# Build on commits pushed to branches without a PR if it's in the allowlist
push:
branches: [next]
jobs:
playwright-test:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
strategy:
fail-fast: false
matrix:
project: [chromium]
# Add more shards here if needed
shardIndex: [1, 2]
shardTotal: [2]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18

- 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('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-${{ env.cache-name }}-
${{ runner.os }}-modules-
${{ runner.os }}-
- 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: Run end-to-end tests
env:
# Missing in docs but in use
# here https://github.com/microsoft/playwright/blob/main/packages/playwright/src/reporters/blob.ts#L108
PWTEST_BLOB_REPORT_NAME: ${{ matrix.project }}
run: cd packages/@sanity/portable-text-editor && yarn test:e2e --silent --shard=${{ matrix.shardIndex}}/${{ matrix.shardTotal }}

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: blob-report
retention-days: 30
merge-reports:
if: always()
needs: [playwright-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18

- 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('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-${{ env.cache-name }}-
${{ runner.os }}-modules-
${{ runner.os }}-
- name: Install project dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
3 changes: 2 additions & 1 deletion packages/@sanity/portable-text-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"eslint": "eslint 'src/**/*.{ts,js,tsx}'",
"prettier": "prettier --write './**/*.{ts,tsx,js,css,html}'",
"dev": "cd ./test/ && ts-node serve",
"test": "jest",
"test": "jest --testPathIgnorePatterns test/__tests__",
"test:e2e": "jest test/__tests__",
"test:watch": "jest --watch",
"watch": "pkg-utils watch --tsconfig tsconfig.lib.json"
},
Expand Down
6 changes: 5 additions & 1 deletion test/config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ exports.createJestConfig = function createJestConfig(
},
testMatch: [...testMatch, '<rootDir>/**/*.{test,spec}.{js,ts,tsx}'],
transformIgnorePatterns: ['/node_modules/(?!(get-random-values-esm)/)'],
testPathIgnorePatterns: ['/node_modules/', '/.yalc/'],
testPathIgnorePatterns: [
'/node_modules/',
'/.yalc/',
'/packages/@sanity/portable-text-editor/test/__tests__/',
],
transform: {
...transform,
'\\.[jt]sx?$': [
Expand Down

0 comments on commit 7d70939

Please sign in to comment.