Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test pwa #352

Open
wants to merge 169 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
0b72687
add supabase
YousefED Mar 24, 2023
fbf4b76
add hocuspocus
YousefED Mar 24, 2023
e0acbdc
add hocuspocus
YousefED Mar 24, 2023
b8eb6f3
initial supabase schema and tests
YousefED Mar 27, 2023
ba7ec8d
add cascading permissions
YousefED Mar 28, 2023
b1c8fa0
wip
YousefED Mar 30, 2023
64ae764
clean up remotes
YousefED Apr 3, 2023
c6c1c68
clean up old files
YousefED Apr 3, 2023
6f6290c
fix fetch
YousefED Apr 3, 2023
365de2d
Merge branch 'sync-refactor' into server-2
YousefED Apr 3, 2023
e177122
extract matrix related code
YousefED Apr 10, 2023
66ee056
fix login / register
YousefED Apr 10, 2023
2183d7b
username dialog, use ids for docs
YousefED Apr 13, 2023
fe0573c
implement backlinks (inbox), refs, upgrade yjs
YousefED Apr 14, 2023
11e93b5
fix sidebar tree to allow dnd
YousefED Apr 14, 2023
61f398b
use atlaskit sidebar
YousefED Apr 16, 2023
195b9ac
fix styles
YousefED Apr 16, 2023
9294b1f
wip
YousefED Apr 17, 2023
e18c126
simplify Identifier code
YousefED Apr 24, 2023
7477bf3
chore: update filenames
YousefED Apr 24, 2023
45f1027
fix build
YousefED Apr 24, 2023
c3c618b
supabase permissions
YousefED Apr 27, 2023
5b0eb1a
supabase refs
YousefED Apr 27, 2023
cd3f2fa
misc fixes projects and identifiers
YousefED May 5, 2023
fd7b7a6
wip
YousefED May 9, 2023
c226f74
localdoc
YousefED May 10, 2023
6806390
tests wip
YousefED May 12, 2023
aa6dba8
wip
YousefED May 12, 2023
e1ba5d4
aliases etc
YousefED May 15, 2023
0643564
fix path bugs
YousefED May 16, 2023
b9e5ec8
fix tree bug (NaN)
YousefED May 16, 2023
c2ccbe4
fix routing
YousefED May 16, 2023
b4d4e72
breadcrumbs wip
YousefED May 18, 2023
efa0ab4
fix
YousefED May 19, 2023
1362a88
fix breadcrumbs
YousefED May 19, 2023
d884657
wip
YousefED May 19, 2023
6d82ec6
fix playwright tests
YousefED May 21, 2023
bbeb145
fix tests
YousefED May 21, 2023
5ea80ea
upgrade node / npm
YousefED May 21, 2023
35bb172
upgrade vite
YousefED May 21, 2023
265d168
remove react router patch
YousefED May 21, 2023
e4ce77c
Merge pull request #338 from TypeCellOS/dc-upgrade-deps
YousefED May 22, 2023
6220dfa
wip
YousefED May 24, 2023
1fdb678
improve syncmanager tests
YousefED May 25, 2023
2a2a57f
wip
YousefED May 26, 2023
2bba979
add docconnection test (wip)
YousefED May 26, 2023
4aa191c
upgrade ts
YousefED May 26, 2023
4114b57
wip
YousefED May 31, 2023
1574ada
readonly test works
YousefED Jun 19, 2023
e12ada1
background syncer
YousefED Jun 21, 2023
55b216e
bg syncer tests
YousefED Jun 21, 2023
f8f89ca
misc
YousefED Jun 21, 2023
9b89bcf
prevent flashing of tree
YousefED Jun 22, 2023
2e06148
remove global stores
YousefED Jun 22, 2023
fa8eba2
CI
YousefED Jun 22, 2023
8a4fd23
add supabase test
YousefED Jun 22, 2023
a1fcabb
update types
YousefED Jun 22, 2023
4d01ebc
test
YousefED Jun 22, 2023
3bac83d
add test
YousefED Jun 22, 2023
201f03e
debug
YousefED Jun 22, 2023
c5f098a
ci
YousefED Jun 22, 2023
489fd01
update supabase
YousefED Jun 22, 2023
fb6fd78
use patches for hocuspocus
YousefED Jun 22, 2023
691a84c
add server start command
YousefED Jun 22, 2023
6d13af3
fix
YousefED Jun 22, 2023
a5dc49a
fix dep
YousefED Jun 22, 2023
b2a05ef
hp in bg
YousefED Jun 22, 2023
6ed99e5
fix start command
YousefED Jun 22, 2023
e76412c
fix imports
YousefED Jun 22, 2023
b50ce36
config variables
YousefED Jun 22, 2023
21877b4
fix build
YousefED Jun 22, 2023
cb401a8
respect mode
YousefED Jun 22, 2023
d1992e6
test
YousefED Jun 22, 2023
d0bbb06
fix host check
YousefED Jun 22, 2023
5b6a72a
fix security checks
YousefED Jun 22, 2023
a9432a3
update supabase packages
YousefED Jun 22, 2023
3c63e94
ci changes
YousefED Jun 22, 2023
87a3656
ci project id
YousefED Jun 22, 2023
5b518e9
fix gentypes
YousefED Jun 22, 2023
7c02052
fix
YousefED Jun 22, 2023
c261730
fix build
YousefED Jun 22, 2023
af6ece0
ci
YousefED Jun 22, 2023
3c44289
fix
YousefED Jun 22, 2023
1600491
ci wip
YousefED Jun 22, 2023
49a3bec
fix
YousefED Jun 22, 2023
7f4f4e8
fix urls
YousefED Jun 22, 2023
6f7b292
test
YousefED Jun 22, 2023
b3f48f8
update tests
YousefED Jun 22, 2023
92053c7
fix test
YousefED Jun 22, 2023
987437d
disable pw tests
YousefED Jun 22, 2023
19942eb
disable
YousefED Jun 22, 2023
3d4eecb
ci
YousefED Jun 22, 2023
6583bf1
fix
YousefED Jun 22, 2023
e40896e
enable pw
YousefED Jun 22, 2023
3816561
remove timeouts
YousefED Jun 22, 2023
279bb87
hide secrets
YousefED Jun 23, 2023
057170b
fix
YousefED Jun 23, 2023
e4af182
fix ci
YousefED Jun 23, 2023
d5e854a
fix
YousefED Jun 23, 2023
635929b
add docs
YousefED Jun 23, 2023
75db58c
fix ci
YousefED Jun 23, 2023
f97955a
fix some tests
YousefED Jun 23, 2023
1413142
fix server tests
YousefED Jun 23, 2023
cc6e2b0
fix tests
YousefED Jun 23, 2023
3e5cfb9
fix build
YousefED Jun 23, 2023
58fff3f
fix tests
YousefED Jun 23, 2023
119f609
fix tests
YousefED Jun 23, 2023
91e59f2
test
YousefED Jun 23, 2023
f1e93ba
fix
YousefED Jun 23, 2023
2a510e7
refactor packages (#341)
YousefED Jul 10, 2023
e1fcd3b
fix deploy
YousefED Jul 10, 2023
3ce403c
Merge branch 'staging' of github.com:TypeCellOS/TypeCell into staging
YousefED Jul 10, 2023
8792978
Refactor/fix tests (#342)
YousefED Jul 11, 2023
f097f7a
enable cascading access tests
YousefED Jul 11, 2023
563d766
cleanup
YousefED Jul 11, 2023
4d49547
add constraints
YousefED Jul 11, 2023
4a6007e
fix tests
YousefED Jul 11, 2023
0cb49f2
fix
YousefED Jul 11, 2023
656e97d
fix
YousefED Jul 12, 2023
b9fec3e
fix
YousefED Jul 12, 2023
c6910e2
fix rls
YousefED Jul 12, 2023
a3a9cc4
fix RLS
YousefED Jul 12, 2023
78d1fa6
misc fixes
YousefED Jul 12, 2023
e10fd77
remove useless test
YousefED Jul 12, 2023
bc826cf
Supabase constraints (#343)
YousefED Jul 12, 2023
02283c7
misc fixes
YousefED Jul 13, 2023
9267732
apply guest changes
YousefED Jul 13, 2023
64bf444
Merge branch 'staging' into mix-fixes
YousefED Jul 13, 2023
b05b2bf
fix build
YousefED Jul 13, 2023
62f6e66
Merge branch 'mix-fixes' of github.com:TypeCellOS/TypeCell into mix-f…
YousefED Jul 13, 2023
5d1a442
fix
YousefED Jul 13, 2023
794f103
fix build
YousefED Jul 13, 2023
9134765
fix build
YousefED Jul 13, 2023
fe0cd90
bundle stats (#347)
YousefED Jul 14, 2023
5974359
remove matrix and lerna (#346)
YousefED Jul 15, 2023
ac4e9c6
clean tests
YousefED Jul 25, 2023
b5eefe9
remove more matrix related code
YousefED Jul 25, 2023
30014f7
Merge remote-tracking branch 'origin/staging' into mix-fixes
YousefED Jul 25, 2023
153acfd
pwa poc
YousefED Jul 26, 2023
005f56e
Mix fixes (#345)
YousefED Jul 31, 2023
a39fc98
Wip monaco newsandbox (#350)
YousefED Aug 16, 2023
a251e12
V2/fix docs (#351)
YousefED Aug 20, 2023
068c046
Merge remote-tracking branch 'origin/staging' into test-pwa
YousefED Aug 20, 2023
24752f6
sharedworker -> regular worker
YousefED Aug 20, 2023
b0eff31
use CompressionStream for cache
YousefED Aug 20, 2023
795ccd0
Merge branch 'staging' into test-pwa
YousefED Aug 20, 2023
6281ab4
fix build
YousefED Aug 20, 2023
b5f7e0a
Merge branch 'staging' into test-pwa
YousefED Aug 20, 2023
62746c2
with sourcemap
YousefED Aug 20, 2023
360d1d9
prettier async
YousefED Aug 20, 2023
949dfa0
Merge branch 'staging' into test-pwa
YousefED Aug 20, 2023
e17ff04
upgrade prettier
YousefED Aug 20, 2023
064b9ac
Merge branch 'staging' into test-pwa
YousefED Aug 20, 2023
cd29b47
remove prettier patch
YousefED Aug 20, 2023
69fe54e
Merge branch 'staging' into test-pwa
YousefED Aug 20, 2023
f08d982
fix tests
YousefED Aug 20, 2023
9452a21
enable sourcemaps
YousefED Aug 20, 2023
c9241fa
fix
YousefED Aug 20, 2023
1b7e9be
switch to localforage
YousefED Aug 20, 2023
082dc82
fix build
YousefED Aug 20, 2023
a5612a3
Merge branch 'staging' into test-pwa
YousefED Aug 20, 2023
cc464ed
fix
YousefED Aug 20, 2023
95d05de
remove ws
YousefED Aug 20, 2023
12024cb
remove atlaskit userpicker and monaco languages (#353)
YousefED Aug 21, 2023
f8e053a
Merge branch 'staging' into test-pwa
YousefED Aug 21, 2023
6077236
Merge remote-tracking branch 'origin/staging' into test-pwa
YousefED Aug 21, 2023
6b22bd0
fix lint
YousefED Aug 21, 2023
c0250a9
upgrade hocuspocus (#354)
YousefED Aug 21, 2023
11fde6a
Merge remote-tracking branch 'origin/staging' into test-pwa
YousefED Aug 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
120 changes: 76 additions & 44 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,51 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3

- name: Setup Node.js 16.x
uses: actions/setup-node@master
- uses: supabase/setup-cli@v1
with:
node-version: 16.x
version: latest

- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

# from https://github.com/supabase/supabase-action-example/
- run: supabase start -x studio,imgproxy,storage
working-directory: packages/server
env:
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}
- run: supabase db lint
working-directory: packages/server
env:
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}
- run: supabase test db
working-directory: packages/server
env:
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}

- name: Verify generated supabase types are checked in
working-directory: packages/server
run: |
supabase gen types typescript --local --schema public > ../shared/src/schema.ts
if ! git diff --ignore-space-at-eol --exit-code --quiet ../shared/src/schema.ts; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
env:
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}

# doesn't seem to cause significant speed up, probably because it still needs to install deps
- name: cache playwright
id: playwright-cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: pw3-${{ runner.os }}-${{ hashFiles('./package-lock.json') }}
Expand All @@ -33,7 +67,7 @@ jobs:
# key: lerna-${{ runner.os }}-${{ hashFiles('./package-lock.json') }}

- name: Cache node modules
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
Expand All @@ -45,84 +79,82 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-

- name: Set correct access for docker containers (server/test/data)
run: chmod -R a+rw test-util/server/data
# - name: Set correct access for docker containers (server/test/data)
# run: chmod -R a+rw test-util/server/data

- name: Build the docker-compose stack
run: docker-compose -f test-util/server/docker-compose.yml up -d
# - name: Build the docker-compose stack
# run: docker-compose -f test-util/server/docker-compose.yml up -d

- name: Check running containers
run: docker ps -a
# - name: Check running containers
# run: docker ps -a

- name: Check docker logs
run: docker logs synapse
# - name: Check docker logs
# run: docker logs synapse

- name: NPM CI
run: npm ci

# - name: Bootstrap packages
# run: npm run bootstrap

- name: Wait for Matrix
run: npx wait-on http://localhost:8888/_matrix/static/
# - name: Wait for Matrix
# run: npx wait-on http://localhost:8888/_matrix/static/

- name: Build packages
run: npm run build
env:
CI: true

- name: Build packages (vite react)
run: npm run build:react
env:
CI: true
MODE: development

- name: Lint
run: npm run lint
env:
CI: true

- name: Install Playwright
run: npx playwright install --with-deps
# if: steps.playwright-cache.outputs.cache-hit != 'true'
# env:
# PLAYWRIGHT_BROWSERS_PATH: 0 # https://github.com/microsoft/playwright/blob/main/docs/src/ci.md#caching-browsers

- name: Lint
run: npm run lint
- name: Start HocusPocus server
run: RUNNER_TRACKING_ID="" && npm run start:server &
env:
CI: true

# Option A: don't build in CI, but test against dev server
# (with Vite, building in CI is now fast enough so we can go for option B)

# - name: Run dev server
# # Wait on config file needed for vite dev server: https://github.com/jeffbski/wait-on/issues/78
# run: npm run start:local & npx wait-on http://localhost:5173 -c ./packages/editor/wait-on.conf.json
# env:
# CI: true

# - name: Run Playwright tests (against dev server)
# run: npm run playwright:dev
- name: Run Tests
run: npm run test
env:
CI: true

# Option B: actually build and run react code and run tests against that
- name: Build and run preview server
# Actually build and run react code and run tests against that
- name: Build and run preview
# Wait on config file needed for vite dev server: https://github.com/jeffbski/wait-on/issues/78
run: npm run start:preview & npx wait-on http://localhost:4173 -c ./packages/editor/wait-on.conf.json
env:
CI: true
MODE: development

- name: Run Playwright tests (against preview server)
- name: Run Playwright tests (against preview)
run: npm run playwright:preview

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report-editor
path: packages/editor/playwright-report/
retention-days: 30

- uses: actions/upload-artifact@v2
if: always()
# Upload webpack-stats.json to use on relative-ci.yaml workflow
- name: Upload webpack stats artifact
uses: relative-ci/agent-upload-artifact-action@v1
with:
name: playwright-report-engine
path: packages/engine/playwright-report/
retention-days: 30

- name: Run Tests
run: npm run test
env:
CI: true

webpackStatsFile: ./packages/editor/dist/webpack-stats.json
# - name: Upload to coveralls
# uses: coverallsapp/github-action@master
# with:
Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/prettier.yaml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy production db

on:
push:
branches:
- main
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.PRODUCTION_DB_PASSWORD }}
PROJECT_ID: guzxrzrjknsekuefovon
TYPECELL_GITHUB_OAUTH_SECRET: NOT-USED # not used but needs to be set, otherwise supabase cli complains
TYPECELL_GOOGLE_OAUTH_SECRET: NOT-USED # not used but needs to be set, otherwise supabase cli complains

steps:
- uses: actions/checkout@v3

- uses: supabase/setup-cli@v1
with:
version: latest

- run: supabase link --project-ref $PROJECT_ID
working-directory: packages/server
- run: supabase db push
working-directory: packages/server
17 changes: 17 additions & 0 deletions .github/workflows/relative-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: RelativeCI

on:
workflow_run:
workflows: ["build"]
types:
- completed

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Send bundle stats and build information to RelativeCI
uses: relative-ci/agent-action@v2
with:
key: ${{ secrets.RELATIVE_CI_KEY }}
token: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy staging db

on:
push:
branches:
- staging
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.STAGING_DB_PASSWORD }}
PROJECT_ID: glsqqdamehahvdqssxow
TYPECELL_GITHUB_OAUTH_SECRET: NOT-USED # not used but needs to be set, otherwise supabase cli complains
TYPECELL_GOOGLE_OAUTH_SECRET: NOT-USED # not used but needs to be set, otherwise supabase cli complains

steps:
- uses: actions/checkout@v3

- uses: supabase/setup-cli@v1
with:
version: latest

- run: supabase link --project-ref $PROJECT_ID
working-directory: packages/server
- run: supabase db push
working-directory: packages/server
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ yarn-error.log*

.idea/
.vercel
tsconfig.tsbuildinfo
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@matrix-org:registry=https://gitlab.matrix.org/api/v4/packages/npm/
install-links=true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v18.16.0
9 changes: 7 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@
"search.exclude": {
"packages/editor/public/types": true,
"**/coverage": true,
"**/dist": true
"**/dist": true,
"**/coverage/**/*": true,
"**/dist/**/*": true,
"**/node_modules/**/*": true,
"**/supabase": true
},
"vitest.exclude": [
"**/node_modules/**",
"**/dist/**",
"**/cypress/**",
"**/.{idea,git,cache,output,temp}/**",
"**/end-to-end/**"
]
],
"typescript.preferences.autoImportFileExcludePatterns": ["**/*/dist"]
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ blocknote
│ ├── editor - The main React application
│ ├── engine - The live-code execution engine
│ ├── packager - Tool to bundle TypeCell notebook apps (WIP)
│ └── parsers - Helpers to convert to / from TypeCell notebooks
│ └── parsers - Helpers to convert to / from TypeCell
├── patches - patch-package patches
└── test-util - Server and data for unit tests
```
Expand Down
22 changes: 22 additions & 0 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Deployment & CI

TypeCell currently consists of

| | development / CI | staging | prod |
| ----------------------------------- | ---------------- | --------------------------- | ------------------------ |
| React app (packages/editor) | Local | Vercel (branch-specific) | Vercel |
| HocusPocus Server (packages/server) | Local | Render (typecell-staging) | Render (typecell-prod) |
| Supabase DB infra (packages/server) | Docker | Supabase (typecell-staging) | Supabase (typecell-prod) |

A few principles:

- All Github Actions run against `local` (i.e.: no external dependencies)
- All components should be easy to self-host, we don't want forced dependencies on any cloud provider (note that both supabase and the server are self-hostable).
- Only www.typecell.org is considered `prod`. All Vercel branch-preview environments are considered `staging`, except the main branch which is `prod`.
- Preview environments all share the same `staging` database. This means feature-branches must be compatible in terms of database schema.
- Preview environments all share the same `HocusPocus backend server` (`packages/server`). This means feature-branches must be compatible to run against the same `packages/server`.
- DB Migrations are deployed to `staging` / `prod` when they are pushed to the `staging` / `main` branch (see github workflows).

## Self-host

It should be fairly straightforward to host TypeCell yourself, at this moment we don't have a guide for this yet.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ typecell
│ ├── editor - The main React application
│ ├── engine - The live-code execution engine
│ ├── packager - Tool to bundle TypeCell notebook apps (WIP)
│ └── parsers - Helpers to convert to / from TypeCell notebooks
│ └── parsers - Helpers to convert to / from TypeCell documents
├── patches - patch-package patches
└── test-util - Server and data for unit tests
```
Expand Down
6 changes: 0 additions & 6 deletions lerna.json

This file was deleted.

Loading