refactor: try to cache computed styles at least within updates #15264
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main workflow | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
# cancel in-progress runs on new commits to same PR (gitub.event.number) | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
checks: | |
timeout-minutes: 20 | |
env: | |
DATABASE_URL: postgres:// | |
AUTH_SECRET: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} # HEAD commit instead of merge commit | |
- uses: ./.github/actions/ci-setup | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
./node_modules/.cache/prettier/.prettier-cache | |
./node_modules/.cache/eslint/.eslint-cache | |
key: checks-${{ github.sha }} | |
restore-keys: checks- | |
- run: echo ===SHA USED=== ${{ github.event.pull_request.head.sha || github.sha }} # todo: remove after check whats happening on main | |
- run: pnpm prettier --cache --check "**/*.{js,md,ts,tsx}" | |
- run: pnpm lint --cache --cache-strategy=content --cache-location=node_modules/.cache/eslint/.eslint-cache | |
- run: pnpm -r test | |
- run: pnpm --filter=@webstudio-is/prisma-client build | |
- run: pnpm -r typecheck | |
check-size: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} # HEAD commit instead of merge commit | |
- uses: ./.github/actions/ci-setup | |
- run: pnpm --filter "{./fixtures/*}..." build | |
- uses: actions/github-script@v7 | |
with: | |
script: | | |
const assertSize = async (directory, maxSize) => { | |
let result = '' | |
await exec.exec('du', ['-sk', directory], { | |
silent: true, | |
listeners: { | |
stdout: (data) => { | |
result += data.toString() | |
} | |
} | |
}) | |
const size = Number.parseInt(result, 10) | |
return { | |
passed: size <= maxSize, | |
size, | |
diff: size - maxSize, | |
directory, | |
} | |
} | |
const results = [ | |
await assertSize('./fixtures/ssg/dist/client', 288), | |
await assertSize('./fixtures/webstudio-remix-netlify-functions/build/client', 376), | |
await assertSize('./fixtures/webstudio-remix-vercel/build/client', 904), | |
] | |
for (const result of results) { | |
if (result.passed) { | |
console.info(`${result.directory}: ${result.size}kB (${result.diff}kB)`) | |
} else { | |
console.info('') | |
console.error(`${result.directory}: ${result.size}kB (+${result.diff}kB)`) | |
} | |
} | |
if (results.some(result => result.passed === false)) { | |
console.error('Some fixtures exceeded limits') | |
process.exit(1) | |
} |