Tldraw/.github/workflows/checks.yml

80 wiersze
1.8 KiB
YAML

2023-04-21 16:06:21 +00:00
name: Checks
on:
pull_request:
merge_group:
push:
branches: [main]
2023-04-21 16:06:21 +00:00
env:
CI: 1
PRINT_GITHUB_ANNOTATIONS: 1
defaults:
run:
shell: bash
2023-04-21 16:06:21 +00:00
jobs:
test:
name: 'Tests & checks'
2023-04-21 16:06:21 +00:00
timeout-minutes: 15
2023-04-21 16:18:25 +00:00
runs-on: ubuntu-latest-16-cores-open # TODO: this should probably run on multiple OSes
2023-04-21 16:06:21 +00:00
steps:
- name: Check out code
uses: actions/checkout@v3
- uses: ./.github/actions/setup
2023-04-21 16:06:21 +00:00
- name: Check version constraints
run: yarn constraints
- name: Check for duplicate dependencies
run: yarn dedupe --check
# Not the most sophisticated way to check for warnings, but I don't think
# Yarn can be convinced to exit with a non-zero exit code on warnings
# see also https://unix.stackexchange.com/a/433713 for the explanation of the parameters
- name: Check for installation warnings
run: 'yarn | grep -vzq "with warnings"'
use native structuredClone on node, cloudflare workers, and in tests (#3166) Currently, we only use native `structuredClone` in the browser, falling back to `JSON.parse(JSON.stringify(...))` elsewhere, despite Node supporting `structuredClone` [since v17](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone) and Cloudflare Workers supporting it [since 2022](https://blog.cloudflare.com/standards-compliant-workers-api/). This PR adjusts our shim to use the native `structuredClone` on all platforms, if available. Additionally, `jsdom` doesn't implement `structuredClone`, a bug [open since 2022](https://github.com/jsdom/jsdom/issues/3363). This PR patches `jsdom` environment in all packages/apps that use it for tests. Also includes a driveby removal of `deepCopy`, a function that is strictly inferior to `structuredClone`. ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [x] `sdk` — Changes the tldraw SDK - [x] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [ ] `bugfix` — Bug fix - [ ] `feature` — New feature - [x] `improvement` — Improving existing features - [x] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Test Plan 1. A smoke test would be enough - [ ] Unit Tests - [x] End to end tests
2024-03-18 17:16:09 +00:00
- name: Check tsconfigs
run: yarn check-tsconfigs
2023-04-21 16:06:21 +00:00
- name: Typecheck
2023-05-02 12:25:26 +00:00
run: yarn build-types
2023-04-21 16:06:21 +00:00
- name: Check scripts
run: yarn check-scripts
- name: Check PR template
run: yarn update-pr-template --check
2023-04-21 16:06:21 +00:00
- name: Lint
run: yarn lint
- name: Check API declarations and docs work as intended
2023-05-02 12:25:26 +00:00
run: yarn api-check
2023-04-21 16:06:21 +00:00
- name: Test
run: yarn test-ci
build:
name: 'Build all projects'
timeout-minutes: 15
runs-on: ubuntu-latest-16-cores-open
steps:
- name: Check out code
uses: actions/checkout@v3
- uses: ./.github/actions/setup
2023-04-21 16:06:21 +00:00
- name: Build all projects
# the sed pipe makes sure that github annotations come through without
# turbo's prefix
2023-05-02 12:25:26 +00:00
run: "yarn build | sed -E 's/^.*? ::/::/'"
2023-04-21 16:06:21 +00:00
- name: Pack public packages
run: "yarn lazy pack-tarball | sed -E 's/^.*? ::/::/'"