Skip to content

Merge branch 'main' into migrate-ci-to-gh-actions #653

Merge branch 'main' into migrate-ci-to-gh-actions

Merge branch 'main' into migrate-ci-to-gh-actions #653

Workflow file for this run

on: push
name: Check JS build
jobs:
check-js-build:
name: Check JS version number and build artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.x"
- name: Check that version number for JS project matches version number for Python project
run: |
PYPROJECT_PATH="pyproject.toml"
PKGJSON_PATH="js/package.json"
PYPROJECT_VERSION=$(awk -F'"' '/^version/ {print $2; exit}' $PYPROJECT_PATH)
JSPROJECT_VERSION=$(cat $PKGJSON_PATH | jq -r '.version')
if [ "$PYPROJECT_VERSION" != "$JSPROJECT_VERSION" ]; then
echo "❌ Version number $JSPROJECT_VERSION in $PKGJSON_PATH does not match version number $PYPROJECT_VERSION in $PYPROJECT_PATH"
exit 1
else
echo "✅ Version number $JSPROJECT_VERSION in $PKGJSON_PATH matches version number $PYPROJECT_VERSION in $PYPROJECT_PATH"
fi
- name: Install Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: '22'
- name: Set up uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
- name: Copy current files to a temporary directory
run: |
mv plotly/labextension/ plotly/labextension-tmp/
- name: Install dependencies and build
run: |
uv venv
source .venv/bin/activate
uv pip install jupyterlab
cd js
npm ci
npm run build
npm ls
- name: Check JupyterLab build artifacts
run: |
# Compare the plotly/labextension and plotly/labextension-tmp directories
diff -r --brief plotly/labextension/ plotly/labextension-tmp/ > labextension_diff.txt
# Check for differences
if [ -s labextension_diff.txt ]; then
echo "❌ Build artifacts differ:"
echo "--- Unexpected diffs ---"
cat labextension_diff.txt
echo "Please replace the 'plotly/labextension' directory with the artifacts of this CI run."
exit 1
else
echo "✅ Build artifacts match expected output"
fi
- name: Store the build artifacts from plotly/labextension
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: failure()
with:
name: labextension
path: plotly/labextension