mirror of
https://github.com/apache/superset.git
synced 2026-05-22 00:05:15 +00:00
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>
188 lines
5.3 KiB
YAML
188 lines
5.3 KiB
YAML
name: "Frontend Build CI (unit tests, linting & sanity checks)"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "master"
|
|
- "[0-9].[0-9]*"
|
|
pull_request:
|
|
types: [synchronize, opened, reopened, ready_for_review]
|
|
|
|
# cancel previous workflow jobs for PRs
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
TAG: apache/superset:GHA-${{ github.run_id }}
|
|
|
|
jobs:
|
|
frontend-build:
|
|
runs-on: ubuntu-24.04
|
|
outputs:
|
|
should-run: ${{ steps.check.outputs.frontend }}
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Check for File Changes
|
|
id: check
|
|
uses: ./.github/actions/change-detector/
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build Docker Image
|
|
if: steps.check.outputs.frontend
|
|
shell: bash
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
echo "git rev-parse --short HEAD"
|
|
git rev-parse --short HEAD
|
|
echo "git show -s --format=raw HEAD"
|
|
git show -s --format=raw HEAD
|
|
docker buildx build \
|
|
-t $TAG \
|
|
--cache-from=type=registry,ref=apache/superset-cache:3.10-slim-trixie \
|
|
--target superset-node-ci \
|
|
.
|
|
|
|
- name: Save Docker Image as Artifact
|
|
if: steps.check.outputs.frontend
|
|
run: |
|
|
docker save $TAG | gzip > docker-image.tar.gz
|
|
|
|
- name: Upload Docker Image Artifact
|
|
if: steps.check.outputs.frontend
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: docker-image
|
|
path: docker-image.tar.gz
|
|
|
|
sharded-jest-tests:
|
|
needs: frontend-build
|
|
if: needs.frontend-build.outputs.should-run == 'true'
|
|
strategy:
|
|
matrix:
|
|
shard: [1, 2, 3, 4, 5, 6, 7, 8]
|
|
fail-fast: false
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Download Docker Image Artifact
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
name: docker-image
|
|
|
|
- name: Load Docker Image
|
|
run: docker load < docker-image.tar.gz
|
|
|
|
- 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 \
|
|
"bun run test -- --coverage --shard=${{ matrix.shard }}/8 --coverageReporters=json-summary"
|
|
|
|
- name: Upload Coverage Artifact
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: coverage-artifacts-${{ matrix.shard }}
|
|
path: superset-frontend/coverage
|
|
|
|
report-coverage:
|
|
needs: [sharded-jest-tests]
|
|
if: needs.frontend-build.outputs.should-run == 'true'
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Download Coverage Artifacts
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
pattern: coverage-artifacts-*
|
|
path: coverage/
|
|
|
|
- name: Show Files
|
|
run: find coverage/
|
|
|
|
- name: Merge Code Coverage
|
|
run: npx nyc merge coverage/ merged-output/coverage-summary.json
|
|
|
|
- name: Upload Code Coverage
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
flags: javascript
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
verbose: true
|
|
files: merged-output/coverage-summary.json
|
|
slug: apache/superset
|
|
|
|
lint-frontend:
|
|
needs: frontend-build
|
|
if: needs.frontend-build.outputs.should-run == 'true'
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Download Docker Image Artifact
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
name: docker-image
|
|
|
|
- name: Load Docker Image
|
|
run: |
|
|
docker load < docker-image.tar.gz
|
|
|
|
- name: lint
|
|
run: |
|
|
docker run --rm $TAG bash -c \
|
|
"bun install && bun run lint"
|
|
|
|
- name: tsc
|
|
run: |
|
|
docker run --rm $TAG bash -c \
|
|
"bun install && bun run turbo:build && bun run type"
|
|
|
|
validate-frontend:
|
|
needs: frontend-build
|
|
if: needs.frontend-build.outputs.should-run == 'true'
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Download Docker Image Artifact
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
name: docker-image
|
|
|
|
- name: Load Docker Image
|
|
run: docker load < docker-image.tar.gz
|
|
|
|
- name: Build Plugins Packages
|
|
run: |
|
|
docker run --rm $TAG bash -c \
|
|
"bun run turbo:build"
|
|
|
|
- name: Build Plugins Storybook
|
|
run: |
|
|
docker run --rm $TAG bash -c \
|
|
"bun run plugins:build-storybook"
|
|
|
|
test-storybook:
|
|
needs: frontend-build
|
|
if: needs.frontend-build.outputs.should-run == 'true'
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Download Docker Image Artifact
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
name: docker-image
|
|
|
|
- name: Load Docker Image
|
|
run: docker load < docker-image.tar.gz
|
|
|
|
- name: Build Storybook and Run Tests
|
|
run: |
|
|
docker run --rm $TAG bash -c \
|
|
"bun run build-storybook && bun x playwright install-deps && bun x playwright install chromium && bun run test-storybook:ci"
|