Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Manual Package Publish

on:
workflow_dispatch:
inputs:
package:
description: 'Package to publish (e.g., heatmap, plotly)'
required: true
type: string
dry-run:
description: 'Dry run (do not actually publish)'
required: false
type: boolean
default: false

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Validate package exists
run: |
if [ ! -d "packages/${{ github.event.inputs.package }}" ]; then
echo "Error: Package 'packages/${{ github.event.inputs.package }}' does not exist"
exit 1
fi

if [ ! -f "packages/${{ github.event.inputs.package }}/package.json" ]; then
echo "Error: Package 'packages/${{ github.event.inputs.package }}' has no package.json"
exit 1
fi

- name: Setup pnpm
uses: pnpm/action-setup@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build package
working-directory: packages/${{ github.event.inputs.package }}
run: |
if grep -q '"build"' package.json; then
pnpm build
else
echo "No build script found, skipping"
fi

- name: Check package info
working-directory: packages/${{ github.event.inputs.package }}
run: |
package_name=$(jq -r '.name' package.json)
package_version=$(jq -r '.version' package.json)

echo "Package: $package_name"
echo "Version: $package_version"

if npm view "$package_name@$package_version" version 2>/dev/null; then
echo "Warning: $package_name@$package_version is already published"
echo "published=true" >> $GITHUB_ENV
else
echo "$package_name@$package_version is not yet published"
echo "published=false" >> $GITHUB_ENV
fi

- name: Dry run
if: github.event.inputs.dry-run == 'true'
working-directory: packages/${{ github.event.inputs.package }}
run: |
echo "DRY RUN - Would publish:"
npm pack --dry-run

- name: Publish to npm
if: github.event.inputs.dry-run == 'false' && env.published == 'false'
working-directory: packages/${{ github.event.inputs.package }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
package_name=$(jq -r '.name' package.json)
package_version=$(jq -r '.version' package.json)

echo "Publishing $package_name@$package_version"
npm publish --access public

- name: Skip publishing
if: github.event.inputs.dry-run == 'false' && env.published == 'true'
run: echo "Skipping publish - package already exists at this version"
98 changes: 98 additions & 0 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Publish Updated Packages

on:
push:
branches: [main]

jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
changed-packages: ${{ steps.detect.outputs.packages }}
has-changes: ${{ steps.detect.outputs.has-changes }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 2

- name: Detect package version changes
id: detect
run: |
changed_files=$(git diff --name-only HEAD~1 HEAD | grep "packages/.*/package.json" || true)

if [ -z "$changed_files" ]; then
echo "has-changes=false" >> $GITHUB_OUTPUT
echo "No package.json files changed"
exit 0
fi

packages_json="[]"

for file in $changed_files; do
package_dir=$(dirname "$file")
package_name=$(basename "$package_dir")

old_version=$(git show HEAD~1:"$file" 2>/dev/null | jq -r '.version' 2>/dev/null || echo "")
new_version=$(jq -r '.version' "$file" 2>/dev/null || echo "")

if [ "$old_version" != "$new_version" ] && [ -n "$new_version" ] && [ "$new_version" != "null" ]; then
echo "Package $package_name version changed: $old_version -> $new_version"
packages_json=$(echo "$packages_json" | jq -c --arg pkg "$package_name" '. + [$pkg]')
fi
done

if [ "$packages_json" != "[]" ]; then
echo "has-changes=true" >> $GITHUB_OUTPUT
echo "packages=$packages_json" >> $GITHUB_OUTPUT
echo "Changed packages: $packages_json"
else
echo "has-changes=false" >> $GITHUB_OUTPUT
echo "No version changes detected"
fi

publish:
needs: detect-changes
if: needs.detect-changes.outputs.has-changes == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{ fromJson(needs.detect-changes.outputs.changed-packages) }}
steps:
- uses: actions/checkout@v5

- name: Setup pnpm
uses: pnpm/action-setup@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build package
working-directory: packages/${{ matrix.package }}
run: |
if grep -q '"build"' package.json; then
pnpm build
else
echo "No build script found, skipping"
fi

- name: Publish to npm
working-directory: packages/${{ matrix.package }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
package_name=$(jq -r '.name' package.json)
package_version=$(jq -r '.version' package.json)

if npm view "$package_name@$package_version" version 2>/dev/null; then
echo "Package $package_name@$package_version already published, skipping"
exit 0
fi

echo "Publishing $package_name@$package_version"
npm publish --access public
62 changes: 33 additions & 29 deletions .github/workflows/test_visualizations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
playwright_packages: ${{ steps.set-packages.outputs.playwright_packages }}
steps:
- uses: actions/checkout@v5

- name: Discover packages with tests
id: set-packages
run: |
Expand Down Expand Up @@ -43,10 +43,10 @@ jobs:
done
packages=$(printf '%s\n' "${regular_packages[@]}" | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "packages=$packages" >> $GITHUB_OUTPUT

playwright_packages_json=$(printf '%s\n' "${playwright_packages[@]}" | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "playwright_packages=$playwright_packages_json" >> $GITHUB_OUTPUT

echo ""
echo "✅ Regular packages with test script (${#regular_packages[@]}):"
printf ' - %s\n' "${regular_packages[@]}"
Expand All @@ -65,22 +65,28 @@ jobs:
fail-fast: false
matrix:
package: ${{ fromJson(needs.discover.outputs.packages) }}

steps:
- uses: actions/checkout@v5

- name: Setup pnpm
uses: pnpm/action-setup@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 20
node-version: 22

- name: Cache dependencies
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: packages/${{ matrix.package }}/node_modules
key: ${{ runner.os }}-node-${{ matrix.package }}-${{ hashFiles(format('packages/{0}/package-lock.json', matrix.package)) }}
path: ~/.local/share/pnpm/store/v10
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.package }}-
${{ runner.os }}-pnpm-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check for requirements.txt
id: check-python
Expand All @@ -105,13 +111,9 @@ jobs:
working-directory: packages/${{ matrix.package }}
run: pip install -r requirements.txt

- name: Install Node dependencies
working-directory: packages/${{ matrix.package }}
run: npm install

- name: Run tests
working-directory: packages/${{ matrix.package }}
run: npm test
run: pnpm test

test-playwright:
needs: discover
Expand All @@ -121,31 +123,37 @@ jobs:
fail-fast: false
matrix:
package: ${{ fromJson(needs.discover.outputs.playwright_packages) }}

steps:
- uses: actions/checkout@v5

- name: Setup pnpm
uses: pnpm/action-setup@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 20
node-version: 22

- name: Cache Node dependencies
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: packages/${{ matrix.package }}/node_modules
key: ${{ runner.os }}-node-${{ matrix.package }}-${{ hashFiles(format('packages/{0}/package-lock.json', matrix.package)) }}
path: ~/.local/share/pnpm/store/v10
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.package }}-
${{ runner.os }}-pnpm-

- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles(format('packages/{0}/package-lock.json', matrix.package)) }}
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check for requirements.txt
id: check-python
working-directory: packages/${{ matrix.package }}
Expand All @@ -169,22 +177,18 @@ jobs:
working-directory: packages/${{ matrix.package }}
run: pip install -r requirements.txt

- name: Install Node dependencies
working-directory: packages/${{ matrix.package }}
run: npm install

- name: Install Playwright browsers
working-directory: packages/${{ matrix.package }}
run: npx playwright install --with-deps chromium
run: pnpm exec playwright install --with-deps chromium

- name: Build
working-directory: packages/${{ matrix.package }}
run: npm run build
run: pnpm build

- name: Start Server in background
working-directory: packages/${{ matrix.package }}
run: |
nohup npm run dev > server.log 2>&1 &
nohup pnpm dev > server.log 2>&1 &
echo $! > server.pid

- name: Wait for Server to be ready
Expand All @@ -207,7 +211,7 @@ jobs:

- name: Run Playwright Tests
working-directory: packages/${{ matrix.package }}
run: npm test
run: pnpm test

- name: Stop Server
if: always()
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ node_modules
.cache
.DS_Store
lerna-debug.log
pnpm-debug.log
packages/**/static
**/test-results/
**/playwright-report/
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pnpm-lock.yaml
**/dist/
**/static/
**/node_modules/
Loading
Loading