Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: cache frontend builds/lint/test in CI (#708)

Myles Scolnick1cf1b6052e67
diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml
index 2b4ebc6cc9..7918306750 100644
--- a/.github/workflows/playwright.yml
+++ b/.github/workflows/playwright.yml
@@ -5,6 +5,13 @@ on:
branches: [main]
pull_request: {}
+env:
+ # Turbocache
+ TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
+ TURBO_TEAM: marimo
+ TURBO_API: "https://cache.turbocache.build"
+ TURBO_RUN_SUMMARY: true
+
jobs:
test:
timeout-minutes: 16
@@ -27,7 +34,6 @@ jobs:
run: |
echo "[experimental]" > .marimo.toml
echo "layouts=true" >> .marimo.toml
- echo "static_export=true" >> .marimo.toml
- uses: pnpm/action-setup@v2
with:
@@ -40,6 +46,8 @@ jobs:
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
+ - uses: turbocache-build/turbocache-action@v1
+
- name: 📦 Build frontend
run: make fe
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 94626dded6..d3c1737c9e 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -5,6 +5,13 @@ on:
branches: [main]
pull_request: {}
+env:
+ # Turbocache
+ TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
+ TURBO_TEAM: marimo
+ TURBO_API: "https://cache.turbocache.build"
+ TURBO_RUN_SUMMARY: true
+
jobs:
test_frontend:
name: 🖥️ Lint, test, build frontend
@@ -20,6 +27,8 @@ jobs:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # so we can run --since on the main branch and turbo can do faster cache hashing
- uses: pnpm/action-setup@v2
with:
@@ -32,6 +41,8 @@ jobs:
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
+ - uses: turbocache-build/turbocache-action@v1
+
- name: 📥 Install dependencies
run: pnpm install
@@ -40,16 +51,16 @@ jobs:
run: pnpm dedupe --check
- name: 🧹 Lint
- run: pnpm run lint
+ run: pnpm turbo lint
- name: 🔎 Type check
- run: pnpm run typecheck
+ run: pnpm turbo typecheck
- name: 🧪 Test
- run: pnpm run test
+ run: pnpm turbo test
- name: 📦 Build
- run: pnpm run build
+ run: pnpm turbo build
test_python:
name: Tests on ${{ matrix.os }}, Python ${{ matrix.python-version }}
diff --git a/.github/workflows/test_cli.yaml b/.github/workflows/test_cli.yaml
index 27ef0e89df..71f4f20812 100644
--- a/.github/workflows/test_cli.yaml
+++ b/.github/workflows/test_cli.yaml
@@ -5,6 +5,13 @@ on:
branches: [main]
pull_request: {}
+env:
+ # Turbocache
+ TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
+ TURBO_TEAM: marimo
+ TURBO_API: "https://cache.turbocache.build"
+ TURBO_RUN_SUMMARY: true
+
jobs:
build_wheel:
name: Build marimo wheel
@@ -19,6 +26,8 @@ jobs:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # so we can run --since on the main branch and turbo can do faster cache hashing
- uses: pnpm/action-setup@v2
with:
@@ -31,6 +40,8 @@ jobs:
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
+ - uses: turbocache-build/turbocache-action@v1
+
- name: 📦 Build frontend
run: make fe
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9e2490d385..bd764e6ef2 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -54,11 +54,13 @@ make check
```
**Frontend.**
+
```bash
make fe-check
```
**Python.**
+
```bash
make py-check
```
@@ -131,13 +133,12 @@ npx playwright test <filename> --ui
npx playwright test cells.test.ts --ui
```
-or
+or
```bash
npx playwright test --debug <filename>
```
-
## Storybook
To open Storybook, run the following:
@@ -197,15 +198,9 @@ marimo server. This means that:
1. You will want to run your marimo server with `--headless` so it does not open a new browser tab, as it will
interfere with the frontend dev server.
-2. You should open an existing notebook instead of creating a new one, as the
- frontend dev server will not be able to create or save notebooks.
-3. marimo normally sets the filename, mode, and config. These will be
- mocked/disabled when running in the frontend in dev mode.
-4. The tradeoff of using the frontend dev server is that it is faster to
+2. The tradeoff of using the frontend dev server is that it is faster to
develop on the frontend, but you will not be able to test the frontend in
- the same way that it will be used in production.
-
-
+ the same way that it will be used in production.
## Editor settings
diff --git a/Makefile b/Makefile
index fd60542276..99f003c112 100644
--- a/Makefile
+++ b/Makefile
@@ -42,7 +42,7 @@ fe-check: fe-lint fe-typecheck
.PHONY: fe-test
# test frontend
fe-test:
- cd frontend; CI=true pnpm test
+ cd frontend; CI=true pnpm turbo test
.PHONY: e2e
# test end-to-end
@@ -55,7 +55,7 @@ fe-lint:
.PHONY: fe-typecheck
fe-typecheck:
- cd frontend; pnpm typecheck
+ cd frontend; pnpm turbo typecheck
.PHONY: py-check
# check python
diff --git a/frontend/.gitignore b/frontend/.gitignore
index 56ee3aef6e..dfdfd24806 100644
--- a/frontend/.gitignore
+++ b/frontend/.gitignore
@@ -3,6 +3,7 @@
/.pnp
.pnp.js
.swc
+.turbo
# testing
/coverage
diff --git a/frontend/package.json b/frontend/package.json
index b9fce52bca..057c7a833e 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -118,7 +118,6 @@
"dev": "vite",
"build:watch": "vite build --watch --outDir ../marimo/_static",
"build": "vite build",
- "build:library": "vite build -c vite.lib.config.ts && tsc --declaration --emitDeclarationOnly --declarationDir lib",
"test": "vitest",
"typecheck": "tsc --noEmit",
"lint": "run-s lint:eslint lint:stylelint lint:prettier",
@@ -183,6 +182,7 @@
"stylelint": "^15.11.0",
"stylelint-config-standard": "^34.0.0",
"tailwindcss": "^3.4.1",
+ "turbo": "^1.12.2",
"typescript": "^5.3.3",
"vite": "^5.0.11",
"vite-tsconfig-paths": "^4.3.1",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 4295f7dd34..a1288383f3 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -433,6 +433,9 @@ devDependencies:
tailwindcss:
specifier: ^3.4.1
version: 3.4.1
+ turbo:
+ specifier: ^1.12.2
+ version: 1.12.2
typescript:
specifier: ^5.3.3
version: 5.3.3
@@ -15536,6 +15539,66 @@ packages:
typescript: 5.3.3
dev: true
+ resolution: {integrity: sha512-Aq/ePQ5KNx6XGwlZWTVTqpQYfysm1vkwkI6kAYgrX5DjMWn+tUXrSgNx4YNte0F+V4DQ7PtuWX+jRG0h0ZNg0A==}
+ cpu: [x64]
+ os: [darwin]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ resolution: {integrity: sha512-wTr+dqkwJo/eXE+4SPTSeNBKyyfQJhI6I9sKVlCSBmtaNEqoGNgdVzgMUdqrg9AIFzLIiKO+zhfskNaSWpVFow==}
+ cpu: [arm64]
+ os: [darwin]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ resolution: {integrity: sha512-BggBKrLojGarDaa2zBo+kUR3fmjpd6bLA8Unm3Aa2oJw0UvEi3Brd+w9lNsPZHXXQYBUzNUY2gCdxf3RteWb0g==}
+ cpu: [x64]
+ os: [linux]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ resolution: {integrity: sha512-v/apSRvVuwYjq1D9MJFsHv2EpGd1S4VoSdZvVfW6FaM06L8CFZa92urNR1svdGYN28YVKwK9Ikc9qudC6t/d5A==}
+ cpu: [arm64]
+ os: [linux]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ resolution: {integrity: sha512-3uDdwXcRGkgopYFdPDpxQiuQjfQ12Fxq0fhj+iGymav0eWA4W4wzYwSdlUp6rT22qOBIzaEsrIspRwx1DsMkNg==}
+ cpu: [x64]
+ os: [win32]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ resolution: {integrity: sha512-zNIHnwtQfJSjFi7movwhPQh2rfrcKZ7Xv609EN1yX0gEp9GxooCUi2yNnBQ8wTqFjioA2M5hZtGJQ0RrKaEm/Q==}
+ cpu: [arm64]
+ os: [win32]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ resolution: {integrity: sha512-BcoQjBZ+LJCMdjzWhzQflOinUjek28rWXj07aaaAQ8T3Ehs0JFSjIsXOm4qIbo52G4xk3gFVcUtJhh/QRADl7g==}
+ hasBin: true
+ optionalDependencies:
+ turbo-darwin-64: 1.12.2
+ turbo-darwin-arm64: 1.12.2
+ turbo-linux-64: 1.12.2
+ turbo-linux-arm64: 1.12.2
+ turbo-windows-64: 1.12.2
+ turbo-windows-arm64: 1.12.2
+ dev: true
+
resolution: {integrity: sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==}
engines: {node: '>= 0.8.0'}
diff --git a/frontend/turbo.json b/frontend/turbo.json
new file mode 100644
index 0000000000..6a6a8d3f90
--- /dev/null
+++ b/frontend/turbo.json
@@ -0,0 +1,18 @@
+{
+ "$schema": "https://turbo.build/schema.json",
+ "pipeline": {
+ "build": {
+ "outputs": ["dist/**"]
+ },
+ "typecheck": {},
+ "test": {},
+ "lint": {},
+ "build-storybook": {
+ "outputs": ["storybook-static/**"]
+ },
+ "dev": {
+ "cache": false,
+ "persistent": true
+ }
+ }
+}
diff --git a/scripts/buildfrontend.sh b/scripts/buildfrontend.sh
index 735385f44f..9f6126e6d7 100755
--- a/scripts/buildfrontend.sh
+++ b/scripts/buildfrontend.sh
@@ -1,7 +1,7 @@
#!/bin/sh
cd frontend
-if pnpm build; then
+if pnpm turbo build; then
echo "Removing old static files..."
rm -rf ../marimo/_static/
echo "Copying new static files..."