feat(docker/ci): migrate Docker and CI from npm to bun

Docker changes:
- Use oven/bun:1-debian as base image instead of node:20-trixie-slim
- Replace npm ci with bun install --frozen-lockfile
- Replace npm run commands with bun run
- Mount bun.lock instead of package-lock.json
- Update cache paths for Bun's cache directory
- Rename NPM_RUN_PRUNE env var to BUN_RUN_PRUNE

CI workflow changes:
- Update bashlib.sh npm-install function to use bun
- Update superset-frontend.yml to use bun run commands
- Update release.yml to use setup-bun action and changesets
- Update superset-e2e.yml to use setup-bun action
- Update superset-playwright.yml to use setup-bun action
- Update superset-translations.yml to use setup-bun action

Note: superset-embedded-sdk and superset-websocket remain on npm
as they are separate packages with their own lockfiles.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Evan Rusackas
2026-02-10 11:46:21 -08:00
parent a44372d994
commit aa94a8eebd
11 changed files with 92 additions and 1915 deletions

View File

@@ -41,21 +41,21 @@ pip-upgrade() {
npm-install() {
cd "$GITHUB_WORKSPACE/superset-frontend"
# cache-restore npm
say "::group::Install npm packages"
echo "npm: $(npm --version)"
# cache-restore bun
say "::group::Install packages with bun"
echo "bun: $(bun --version)"
echo "node: $(node --version)"
npm ci
bun install --frozen-lockfile
say "::endgroup::"
# cache-save npm
# cache-save bun
}
build-assets() {
cd "$GITHUB_WORKSPACE/superset-frontend"
say "::group::Build static assets"
npm run build
bun run build
say "::endgroup::"
}
@@ -67,7 +67,7 @@ build-instrumented-assets() {
if [[ -f "$ASSETS_MANIFEST" ]]; then
echo 'Skip frontend build because instrumented static assets already exist.'
else
npm run build-instrumented
bun run build-instrumented
cache-save instrumented-assets
fi
say "::endgroup::"

View File

@@ -40,48 +40,33 @@ jobs:
git fetch --prune --unshallow
git tag -d `git tag | grep -E '^trigger-'`
- name: Install Node.js
- name: Install Bun
if: env.HAS_TAGS
uses: actions/setup-node@v6
uses: oven-sh/setup-bun@v2
with:
node-version-file: './superset-frontend/.nvmrc'
bun-version: latest
- name: Cache npm
- name: Cache bun
if: env.HAS_TAGS
uses: actions/cache@v5
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Get npm cache directory path
if: env.HAS_TAGS
id: npm-cache-dir-path
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Cache npm
if: env.HAS_TAGS
uses: actions/cache@v5
id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
${{ runner.os }}-bun-
- name: Install dependencies
if: env.HAS_TAGS
working-directory: ./superset-frontend
run: npm ci
run: bun install --frozen-lockfile
- name: Run unit tests
if: env.HAS_TAGS
working-directory: ./superset-frontend
run: npm run test -- plugins packages
run: bun run test -- plugins packages
- name: Build packages
if: env.HAS_TAGS
working-directory: ./superset-frontend
run: npm run plugins:build
run: bun run turbo:build
- name: Configure npm and git
if: env.HAS_TAGS
@@ -96,12 +81,12 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
- name: Bump version and publish package(s)
- name: Publish packages with changesets
if: env.HAS_TAGS
working-directory: ./superset-frontend
run: |
git tag -d `git tag | grep -E '^trigger-'`
npm run plugins:release-from-tag
bun run changeset:publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}

View File

@@ -107,12 +107,12 @@ jobs:
uses: ./.github/actions/cached-dependencies
with:
run: testdata
- name: Setup Node.js
- name: Setup Bun
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: actions/setup-node@v6
uses: oven-sh/setup-bun@v2
with:
node-version-file: './superset-frontend/.nvmrc'
- name: Install npm dependencies
bun-version: latest
- name: Install dependencies
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
@@ -224,12 +224,12 @@ jobs:
uses: ./.github/actions/cached-dependencies
with:
run: playwright_testdata
- name: Setup Node.js
- name: Setup Bun
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: actions/setup-node@v6
uses: oven-sh/setup-bun@v2
with:
node-version-file: './superset-frontend/.nvmrc'
- name: Install npm dependencies
bun-version: latest
- name: Install dependencies
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:

View File

@@ -80,14 +80,14 @@ jobs:
- name: Load Docker Image
run: docker load < docker-image.tar.gz
- name: npm run test with coverage
- name: bun run test with coverage
run: |
mkdir -p ${{ github.workspace }}/superset-frontend/coverage
docker run \
-v ${{ github.workspace }}/superset-frontend/coverage:/app/superset-frontend/coverage \
--rm $TAG \
bash -c \
"npm run test -- --coverage --shard=${{ matrix.shard }}/8 --coverageReporters=json-summary"
"bun run test -- --coverage --shard=${{ matrix.shard }}/8 --coverageReporters=json-summary"
- name: Upload Coverage Artifact
uses: actions/upload-artifact@v6
@@ -138,12 +138,12 @@ jobs:
- name: lint
run: |
docker run --rm $TAG bash -c \
"npm i && npm run lint"
"bun install && bun run lint"
- name: tsc
run: |
docker run --rm $TAG bash -c \
"npm i && npm run plugins:build && npm run type"
"bun install && bun run turbo:build && bun run type"
validate-frontend:
needs: frontend-build
@@ -161,12 +161,12 @@ jobs:
- name: Build Plugins Packages
run: |
docker run --rm $TAG bash -c \
"npm run plugins:build"
"bun run turbo:build"
- name: Build Plugins Storybook
run: |
docker run --rm $TAG bash -c \
"npm run plugins:build-storybook"
"bun run plugins:build-storybook"
test-storybook:
needs: frontend-build
@@ -184,4 +184,4 @@ jobs:
- name: Build Storybook and Run Tests
run: |
docker run --rm $TAG bash -c \
"npm run build-storybook && npx playwright install-deps && npx playwright install chromium && npm run test-storybook:ci"
"bun run build-storybook && bun x playwright install-deps && bun x playwright install chromium && bun run test-storybook:ci"

View File

@@ -98,12 +98,12 @@ jobs:
uses: ./.github/actions/cached-dependencies
with:
run: playwright_testdata
- name: Setup Node.js
- name: Setup Bun
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: actions/setup-node@v6
uses: oven-sh/setup-bun@v2
with:
node-version-file: './superset-frontend/.nvmrc'
- name: Install npm dependencies
bun-version: latest
- name: Install dependencies
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:

View File

@@ -29,21 +29,21 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
- name: Setup Bun
if: steps.check.outputs.frontend
uses: actions/setup-node@v6
uses: oven-sh/setup-bun@v2
with:
node-version-file: './superset-frontend/.nvmrc'
bun-version: latest
- name: Install dependencies
if: steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: npm-install
- name: lint
- name: Build translations
if: steps.check.outputs.frontend
working-directory: ./superset-frontend
run: |
npm run build-translation
bun run build-translation
babel-extract:
runs-on: ubuntu-24.04

View File

@@ -29,7 +29,7 @@ ARG BUILD_TRANSLATIONS="false"
######################################################################
# superset-node-ci used as a base for building frontend assets and CI
######################################################################
FROM --platform=${BUILDPLATFORM} node:20-trixie-slim AS superset-node-ci
FROM --platform=${BUILDPLATFORM} oven/bun:1-debian AS superset-node-ci
ARG BUILD_TRANSLATIONS
ENV BUILD_TRANSLATIONS=${BUILD_TRANSLATIONS}
ARG DEV_MODE="false" # Skip frontend build in dev mode
@@ -37,13 +37,13 @@ ENV DEV_MODE=${DEV_MODE}
COPY docker/ /app/docker/
# Arguments for build configuration
ARG NPM_BUILD_CMD="build"
ARG BUN_BUILD_CMD="build"
# Install system dependencies required for node-gyp
RUN /app/docker/apt-install.sh build-essential python3 zstd
# Define environment variables for frontend build
ENV BUILD_CMD=${NPM_BUILD_CMD} \
ENV BUILD_CMD=${BUN_BUILD_CMD} \
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
# Run the frontend memory monitoring script
@@ -57,17 +57,17 @@ RUN mkdir -p /app/superset/static/assets \
# Mount package files and install dependencies if not in dev mode
# NOTE: we mount packages and plugins as they are referenced in package.json as workspaces
# ideally we'd COPY only their package.json. Here npm ci will be cached as long
# ideally we'd COPY only their package.json. Here bun install will be cached as long
# as the full content of these folders don't change, yielding a decent cache reuse rate.
# Note that it's not possible to selectively COPY or mount using blobs.
RUN --mount=type=bind,source=./superset-frontend/package.json,target=./package.json \
--mount=type=bind,source=./superset-frontend/package-lock.json,target=./package-lock.json \
--mount=type=bind,source=./superset-frontend/bun.lock,target=./bun.lock \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/.npm \
--mount=type=cache,target=/root/.bun/install/cache \
if [ "${DEV_MODE}" = "false" ]; then \
npm ci; \
bun install --frozen-lockfile; \
else \
echo "Skipping 'npm ci' in dev mode"; \
echo "Skipping 'bun install' in dev mode"; \
fi
# Runs the webpack build process
@@ -79,12 +79,12 @@ COPY superset-frontend /app/superset-frontend
FROM superset-node-ci AS superset-node
# Build the frontend if not in dev mode
RUN --mount=type=cache,target=/root/.npm \
RUN --mount=type=cache,target=/root/.bun/install/cache \
if [ "${DEV_MODE}" = "false" ]; then \
echo "Running 'npm run ${BUILD_CMD}'"; \
npm run ${BUILD_CMD}; \
echo "Running 'bun run ${BUILD_CMD}'"; \
bun run ${BUILD_CMD}; \
else \
echo "Skipping 'npm run ${BUILD_CMD}' in dev mode"; \
echo "Skipping 'bun run ${BUILD_CMD}' in dev mode"; \
fi;
# Copy translation files
@@ -92,7 +92,7 @@ COPY superset/translations /app/superset/translations
# Build translations if enabled, then cleanup localization files
RUN if [ "${BUILD_TRANSLATIONS}" = "true" ]; then \
npm run build-translation; \
bun run build-translation; \
fi; \
rm -rf /app/superset/translations/*/*/*.[po,mo];

View File

@@ -152,10 +152,10 @@ services:
DEV_MODE: "true"
BUILD_TRANSLATIONS: ${BUILD_TRANSLATIONS:-false}
environment:
# set this to false if you have perf issues running the npm i; npm run dev in-docker
# set this to false if you have perf issues running bun install; bun run dev in-docker
# if you do so, you have to run this manually on the host, which should perform better!
BUILD_SUPERSET_FRONTEND_IN_DOCKER: true
NPM_RUN_PRUNE: false
BUN_RUN_PRUNE: false
SCARF_ANALYTICS: "${SCARF_ANALYTICS:-}"
# configuring the dev-server to use the host.docker.internal to connect to the backend
superset: "http://superset-light:8088"

View File

@@ -168,10 +168,10 @@ services:
DEV_MODE: "true"
BUILD_TRANSLATIONS: ${BUILD_TRANSLATIONS:-false}
environment:
# set this to false if you have perf issues running the npm i; npm run dev in-docker
# set this to false if you have perf issues running bun install; bun run dev in-docker
# if you do so, you have to run this manually on the host, which should perform better!
BUILD_SUPERSET_FRONTEND_IN_DOCKER: true
NPM_RUN_PRUNE: false
BUN_RUN_PRUNE: false
SCARF_ANALYTICS: "${SCARF_ANALYTICS:-}"
# configuring the dev-server to use the host.docker.internal to connect to the backend
superset: "http://superset:8088"

View File

@@ -27,18 +27,18 @@ if [ "$BUILD_SUPERSET_FRONTEND_IN_DOCKER" = "true" ]; then
echo "Building Superset frontend in dev mode inside docker container"
cd /app/superset-frontend
if [ "$NPM_RUN_PRUNE" = "true" ]; then
echo "Running \"npm run prune\""
npm run prune
if [ "$BUN_RUN_PRUNE" = "true" ]; then
echo "Running \"bun run prune\""
bun run prune
fi
echo "Running \"npm install\""
npm install
echo "Running \"bun install\""
bun install
echo "Start webpack dev server"
# start the webpack dev server, serving dynamically at http://localhost:9000
# it proxies to the backend served at http://localhost:8088
npm run dev-server
bun run dev-server
else
echo "Skipping frontend build steps - YOU NEED TO RUN IT MANUALLY ON THE HOST!"

File diff suppressed because it is too large Load Diff